typeprof 0.20.3 → 0.21.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ee0445d195b9ab48538b37afc382d3b48d74c4fd9c5628010a3ac5084349259
4
- data.tar.gz: 183309d5b70590396a7b0eec078b1b980b5e38877d5d756e66e03acefb971055
3
+ metadata.gz: 9cfc98929d3481526809f92f41edd0abe30d82aaab6f1e1e95d574c74e1cee9b
4
+ data.tar.gz: 895a3f4949b010d2809e32016fec9e7597ae6b5e29175448b668ede33ab20b99
5
5
  SHA512:
6
- metadata.gz: 2b43a67c81128f11a34bd3d9aeecad1763e3baf7a8498e68c411fa652579213519956a6ff4d301873b8d9291d1ce89f1c1e33f0379846df620118d47b42add0f
7
- data.tar.gz: e1768b62ac2fe976fb94abe2fbf41656002f80e8016cd8c5e634a44770a4a8eeafb1e50bc5003a774d84621a5c14fbad9fef4eb40c9c383b9b48bee74ca05907
6
+ metadata.gz: 736ebc69c1715474973c514ca0e013991575732bee3549b7ac80865264bf3fde42065b1e00b408d3a543a8730030979e891be0427f73a297808bfd890c5698f0
7
+ data.tar.gz: 6bbe63293cfa70dc393e6a97d7a761865ed76a4cbb12a95a19134649079849a82510671e2d1661c55319958040f30c70f2ab06f255a28af5d0cbb6eba96ac0f0
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- typeprof (0.20.3)
5
- rbs (>= 1.6.2)
4
+ typeprof (0.21.2)
5
+ rbs (>= 1.8.1)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
@@ -11,7 +11,7 @@ GEM
11
11
  docile (1.4.0)
12
12
  power_assert (2.0.1)
13
13
  rake (13.0.1)
14
- rbs (1.7.0)
14
+ rbs (2.0.0)
15
15
  simplecov (0.21.2)
16
16
  docile (~> 1.1)
17
17
  simplecov-html (~> 0.11)
@@ -19,7 +19,7 @@ GEM
19
19
  simplecov-html (0.12.3)
20
20
  simplecov_json_formatter (0.1.3)
21
21
  stackprof (0.2.17)
22
- test-unit (3.5.1)
22
+ test-unit (3.5.3)
23
23
  power_assert
24
24
 
25
25
  PLATFORMS
@@ -345,7 +345,7 @@ module TypeProf
345
345
  attr_reader :class_defs
346
346
 
347
347
  class ClassDef # or ModuleDef
348
- def initialize(kind, name, absolute_path)
348
+ def initialize(kind, name, absolute_path, superclass)
349
349
  raise unless name.is_a?(Array)
350
350
  @kind = kind
351
351
  @modules = {
@@ -359,10 +359,11 @@ module TypeProf
359
359
  @cvars = VarTable.new
360
360
  @absolute_path = absolute_path
361
361
  @namespace = nil
362
+ @superclass = superclass
362
363
  @subclasses = []
363
364
  end
364
365
 
365
- attr_reader :kind, :modules, :methods, :ivars, :cvars, :absolute_path, :subclasses
366
+ attr_reader :kind, :modules, :methods, :ivars, :cvars, :absolute_path, :superclass, :subclasses
366
367
  attr_accessor :name, :klass_obj
367
368
 
368
369
  def mix_module(kind, mod, type_args, singleton, absolute_path)
@@ -446,14 +447,22 @@ module TypeProf
446
447
  end
447
448
  end
448
449
 
449
- def check_typed_method(mid, singleton)
450
+ def check_typed(mid, singleton, klass)
450
451
  set = @methods[[singleton, mid]]
451
452
  return nil unless set
452
- set = set.select {|mdef| mdef.is_a?(TypedMethodDef) }
453
+ set = set.select {|mdef| mdef.is_a?(klass) }
453
454
  return nil if set.empty?
454
455
  return set
455
456
  end
456
457
 
458
+ def check_typed_method(mid, singleton)
459
+ check_typed(mid, singleton, TypedMethodDef)
460
+ end
461
+
462
+ def check_typed_attr(mid, singleton)
463
+ check_typed(mid, singleton, TypedAttrMethodDef)
464
+ end
465
+
457
466
  def add_method(mid, singleton, mdef)
458
467
  @methods[[singleton, mid]] ||= Utils::MutableSet.new
459
468
  @methods[[singleton, mid]] << mdef
@@ -494,8 +503,9 @@ module TypeProf
494
503
  show_name = cbase_path(cbase) + [name]
495
504
  idx = @class_defs.size
496
505
  if superclass
497
- @class_defs[idx] = ClassDef.new(:class, show_name, def_ep&.absolute_path)
498
- @class_defs[superclass.idx].subclasses << idx unless superclass == :__root__
506
+ superclass_def = @class_defs[superclass.idx] unless superclass == :__root__
507
+ @class_defs[idx] = ClassDef.new(:class, show_name, def_ep&.absolute_path, superclass_def)
508
+ superclass_def.subclasses << idx if superclass_def
499
509
  klass = Type::Class.new(:class, idx, type_params, superclass, show_name)
500
510
  @class_defs[idx].klass_obj = klass
501
511
  cbase ||= klass # for bootstrap
@@ -503,7 +513,7 @@ module TypeProf
503
513
  return klass
504
514
  else
505
515
  # module
506
- @class_defs[idx] = ClassDef.new(:module, show_name, def_ep&.absolute_path)
516
+ @class_defs[idx] = ClassDef.new(:module, show_name, def_ep&.absolute_path, nil)
507
517
  mod = Type::Class.new(:module, idx, type_params, nil, show_name)
508
518
  @class_defs[idx].klass_obj = mod
509
519
  add_constant(cbase, name, mod, def_ep)
@@ -521,7 +531,8 @@ module TypeProf
521
531
  idx = @class_defs.size
522
532
  superclass = Type::Builtin[:struct]
523
533
  name = "AnonymousStruct_generated_#{ @anonymous_struct_gen_id += 1 }"
524
- @class_defs[idx] = ClassDef.new(:class, [name], ep.ctx.iseq.absolute_path)
534
+ # Should we pass a superclass here?
535
+ @class_defs[idx] = ClassDef.new(:class, [name], ep.ctx.iseq.absolute_path, nil)
525
536
  #@class_defs[superclass.idx].subclasses << idx # needed?
526
537
  klass = Type::Class.new(:class, idx, [], superclass, name)
527
538
  add_superclass_type_args!(klass, [Type.any])
@@ -701,6 +712,10 @@ module TypeProf
701
712
  @class_defs[klass.idx].check_typed_method(mid, singleton)
702
713
  end
703
714
 
715
+ def check_typed_attr(klass, mid, singleton)
716
+ @class_defs[klass.idx].check_typed_attr(mid, singleton)
717
+ end
718
+
704
719
  def add_method(klass, mid, singleton, mdef)
705
720
  @class_defs[klass.idx].add_method(mid, singleton, mdef)
706
721
  mdef
@@ -713,13 +728,26 @@ module TypeProf
713
728
 
714
729
  def add_attr_method(klass, mid, ivar, kind, pub_meth, ep)
715
730
  if kind == :reader || kind == :accessor
716
- add_method(klass, mid, false, AttrMethodDef.new(ivar, :reader, pub_meth, ep))
731
+ typed_mdef = check_typed_attr(klass, mid, ep.ctx.cref.singleton)
732
+ unless typed_mdef
733
+ add_method(klass, mid, false, ExecutedAttrMethodDef.new(ivar, :reader, pub_meth, ep))
734
+ end
717
735
  end
718
736
  if kind == :writer || kind == :accessor
719
- add_method(klass, :"#{ mid }=", false, AttrMethodDef.new(ivar, :writer, pub_meth, ep))
737
+ mid = :"#{ mid }="
738
+ typed_mdef = check_typed_attr(klass, mid, ep.ctx.cref.singleton)
739
+ unless typed_mdef
740
+ add_method(klass, mid, false, ExecutedAttrMethodDef.new(ivar, :writer, pub_meth, ep))
741
+ end
720
742
  end
721
743
  end
722
744
 
745
+ def add_typed_attr_method(klass, mdef)
746
+ name = mdef.ivar[1..-1]
747
+ name = mdef.kind == :writer ? :"#{ name }=" : name.to_sym
748
+ add_method(klass, name, false, mdef)
749
+ end
750
+
723
751
  def add_iseq_method(klass, mid, iseq, cref, outer_ep, pub_meth)
724
752
  add_method(klass, mid, false, ISeqMethodDef.new(iseq, cref, outer_ep, pub_meth))
725
753
  end
@@ -848,7 +876,7 @@ module TypeProf
848
876
  end
849
877
  entry.type = entry.type.union(ty)
850
878
  entry.read_continuations.each do |read_ep, ctn|
851
- ctn[ty, read_ep, [ep]]
879
+ ctn[ty, read_ep, ep ? [ep] : []]
852
880
  end
853
881
  end
854
882
 
@@ -1396,6 +1424,9 @@ module TypeProf
1396
1424
  when :tostring, :anytostring
1397
1425
  env, (_ty1, _ty2,) = env.pop(2)
1398
1426
  env = env.push(Type::Instance.new(Type::Builtin[:str]))
1427
+ when :objtostring
1428
+ env, (_ty1,) = env.pop(1)
1429
+ env = env.push(Type::Instance.new(Type::Builtin[:str]))
1399
1430
  when :freezestring
1400
1431
  # do nothing
1401
1432
  when :toregexp
@@ -1418,7 +1449,16 @@ module TypeProf
1418
1449
  cref = ep.ctx.cref
1419
1450
  recv.each_child do |recv|
1420
1451
  if recv.is_a?(Type::Class)
1421
- meth = add_singleton_iseq_method(recv, mid, iseq, cref, nil, env.static_env.pub_meth)
1452
+ typed_mdef = check_typed_method(recv, mid, true)
1453
+ if typed_mdef
1454
+ mdef = ISeqMethodDef.new(iseq, cref, nil, env.static_env.pub_meth)
1455
+ typed_mdef.each do |typed_mdef|
1456
+ typed_mdef.do_match_iseq_mdef(mdef, recv, mid, env, ep, self)
1457
+ end
1458
+ else
1459
+ meth = add_singleton_iseq_method(recv, mid, iseq, cref, nil, env.static_env.pub_meth)
1460
+ end
1461
+
1422
1462
  pend_method_execution(iseq, meth, recv, mid, ep.ctx.cref, nil)
1423
1463
  else
1424
1464
  recv = Type.any # XXX: what to do?
@@ -97,7 +97,8 @@ module TypeProf
97
97
  # check?
98
98
  #subst = { Type::Var.new(:self) => caller_env.static_env.recv_ty }
99
99
  # XXX: Update type vars
100
- ctn[@ret_ty, caller_ep, caller_env]
100
+ ret_ty = @ret_ty.remove_type_vars
101
+ ctn[ret_ty, caller_ep, caller_env]
101
102
  end
102
103
  end
103
104
 
@@ -227,8 +227,9 @@ module TypeProf
227
227
 
228
228
  def screen_name(scratch)
229
229
  str = @elems.screen_name(scratch)
230
- if str.start_with?("*")
231
- str = @base_type.screen_name(scratch) + str[1..]
230
+ if str =~ /\A\*\[(.*)\]\z/
231
+ str = @base_type.klass.type_params.map {|var_name,| var_name == :Elem ? $1 : "untyped" }.join(", ")
232
+ str = "#{ @base_type.screen_name(scratch) }[#{ str }]"
232
233
  end
233
234
  str
234
235
  end
@@ -163,8 +163,7 @@ module TypeProf
163
163
  visibilities[key] ||= mdef.pub_meth
164
164
  source_locations[key] ||= mdef.def_ep&.source_location
165
165
  methods[key] = orig_name
166
- when AttrMethodDef
167
- next if !mdef.def_ep
166
+ when ExecutedAttrMethodDef
168
167
  absolute_path = mdef.def_ep.ctx.iseq.absolute_path
169
168
  next if !absolute_path || Config.current.check_dir_filter(absolute_path) == :exclude
170
169
  mid = mid.to_s[0..-2].to_sym if mid.to_s.end_with?("=")
@@ -191,14 +190,46 @@ module TypeProf
191
190
  visibilities[key] ||= mdef.pub_meth
192
191
  source_locations[key] ||= mdef.iseq&.source_location(0)
193
192
  end
193
+ when TypedAttrMethodDef
194
+ if mdef.rbs_source
195
+ mid = mid.to_s[0..-2].to_sym if mid.to_s.end_with?("=")
196
+ method_name = mid
197
+ method_name = [method_name, :"@#{ mid }" != mdef.ivar]
198
+ key = [:rbs_attr, method_name]
199
+ visibilities[key] ||= mdef.pub_meth
200
+ if methods[key]
201
+ if methods[key][0] != mdef.kind
202
+ methods[key][0] = :accessor
203
+ end
204
+ else
205
+ entry = ivars[[singleton, mdef.ivar]]
206
+ ty = entry ? entry.type : Type.any
207
+ methods[key] = [mdef.kind, ty.screen_name(@scratch), ty.include_untyped?(@scratch)]
208
+ end
209
+ end
194
210
  end
195
211
  end
196
212
  end
197
213
 
214
+ superclass_ivars = {}
215
+ while (superclass_def = (superclass_def || class_def).superclass)
216
+ superclass_ivars.merge!(superclass_def.ivars.dump)
217
+ end
218
+
198
219
  ivars = ivars.map do |(singleton, var), entry|
199
220
  next if entry.absolute_paths.all? {|path| Config.current.check_dir_filter(path) == :exclude }
200
221
  ty = entry.type
201
222
  next unless var.to_s.start_with?("@")
223
+
224
+ if (_, existing = superclass_ivars.find {|((s, v), _)| s == singleton && v == var })
225
+ existing_types = existing.type.is_a?(Type::Union) ? existing.type.types : [existing.type]
226
+ entry_types = entry.type.is_a?(Type::Union) ? entry.type.types : [entry.type]
227
+ if entry_types.all? { |t| existing_types.include?(t) }
228
+ # This type is a subset of the parent type
229
+ next
230
+ end
231
+ end
232
+
202
233
  var = "self.#{ var }" if singleton
203
234
  next if methods[[:attr, [singleton ? "self.#{ var.to_s[1..] }" : var.to_s[1..].to_sym, false]]]
204
235
  next if entry.rbs_declared
@@ -302,7 +333,7 @@ module TypeProf
302
333
  visibilities[key] ||= mdef.pub_meth
303
334
  source_locations[key] ||= [mdef.def_ep&.source_location]
304
335
  methods[key] = orig_name
305
- when AttrMethodDef
336
+ when ExecutedAttrMethodDef
306
337
  next if !mdef.def_ep
307
338
  absolute_path = mdef.def_ep.ctx.iseq.absolute_path
308
339
  next if !absolute_path || Config.current.check_dir_filter(absolute_path) == :exclude
@@ -383,7 +414,7 @@ module TypeProf
383
414
  source_location, rbs_code_range = class_data.source_locations[key]
384
415
  type, (method_name, hidden) = key
385
416
  case type
386
- when :attr
417
+ when :attr, :rbs_attr
387
418
  kind, ty, untyped = *arg
388
419
  line = "attr_#{ kind } #{ method_name }#{ hidden ? "()" : "" }: #{ ty }"
389
420
  when :rbs
@@ -522,11 +553,15 @@ module TypeProf
522
553
  end
523
554
  type, (method_name, hidden) = key
524
555
  case type
556
+ when :rbs_attr
557
+ kind, ty, untyped = *arg
558
+ lines << (indent + "# attr_#{ kind } #{ method_name }#{ hidden ? "()" : "" }: #{ ty }")
525
559
  when :attr
526
560
  kind, ty, untyped = *arg
527
561
  exclude = Config.current.options[:exclude_untyped] && untyped ? "#" : " " # XXX
528
562
  lines << (indent + "#{ exclude } attr_#{ kind } #{ method_name }#{ hidden ? "()" : "" }: #{ ty }")
529
563
  when :rbs
564
+ arg = arg.map { |a| a.split("\n").join("\n" + indent + "#" + " " * (method_name.size + 5)) }
530
565
  sigs = arg.sort.join("\n" + indent + "#" + " " * (method_name.size + 5) + "| ")
531
566
  lines << (indent + "# def #{ method_name }: #{ sigs }")
532
567
  when :iseq
@@ -158,7 +158,10 @@ module TypeProf
158
158
  decls.each do |decl|
159
159
  decl = decl.decl
160
160
 
161
- type_params2 = decl.type_params.params.map {|param| [param.name, param.variance] }
161
+ type_params2 = decl.type_params
162
+ # A hack to deal with the imcompatibility between rbs 1.8 and 2.0
163
+ type_params2 = type_params2.params if type_params2.respond_to?(:params)
164
+ type_params2 = type_params2.map {|param| [param.name, param.variance] }
162
165
  raise "inconsistent type parameter declaration" if type_params && type_params != type_params2
163
166
  type_params = type_params2
164
167
 
@@ -191,12 +194,15 @@ module TypeProf
191
194
  when RBS::AST::Members::AttrReader
192
195
  ty = conv_type(member.type)
193
196
  attr_methods[[false, member.name]] = attr_method_def(:reader, member.name, ty, visibility)
197
+ rbs_sources[[false, member.name]] = attr_rbs_source(member)
194
198
  when RBS::AST::Members::AttrWriter
195
199
  ty = conv_type(member.type)
196
200
  attr_methods[[false, member.name]] = attr_method_def(:writer, member.name, ty, visibility)
201
+ rbs_sources[[false, member.name]] = attr_rbs_source(member)
197
202
  when RBS::AST::Members::AttrAccessor
198
203
  ty = conv_type(member.type)
199
204
  attr_methods[[false, member.name]] = attr_method_def(:accessor, member.name, ty, visibility)
205
+ rbs_sources[[false, member.name]] = attr_rbs_source(member)
200
206
  when RBS::AST::Members::Alias
201
207
  # XXX: an alias to attr methods?
202
208
  if member.instance?
@@ -394,6 +400,14 @@ module TypeProf
394
400
  }
395
401
  end
396
402
 
403
+ def attr_rbs_source(member)
404
+ [
405
+ member.name.to_s,
406
+ member.type.location.source,
407
+ [member.location.name, CodeRange.from_rbs(member.location)],
408
+ ]
409
+ end
410
+
397
411
  def conv_block(rbs_block)
398
412
  blk = rbs_block.type
399
413
 
@@ -604,11 +618,13 @@ module TypeProf
604
618
  end
605
619
 
606
620
  attr_methods.each do |(singleton, method_name), mdef|
607
- kind = mdef[:kind]
608
- ivar = mdef[:ivar]
621
+ rbs_source = explicit ? rbs_sources[[singleton, method_name]] : nil
609
622
  ty = conv_type(mdef[:ty]).remove_type_vars
610
- @scratch.add_attr_method(klass, ivar, :"@#{ ivar }", kind, mdef[:visibility], nil)
611
- @scratch.add_ivar_write!(Type::Instance.new(klass), :"@#{ ivar }", ty, nil)
623
+ mdefs = conv_attr_defs(mdef, rbs_source)
624
+ mdefs.each do |mdef|
625
+ @scratch.add_typed_attr_method(klass, mdef)
626
+ end
627
+ @scratch.add_ivar_write!(Type::Instance.new(klass), :"@#{ mdef[:ivar] }", ty, nil)
612
628
  end
613
629
 
614
630
  ivars.each do |ivar_name, ty|
@@ -644,6 +660,22 @@ module TypeProf
644
660
  TypedMethodDef.new(sig_rets, rbs_source, mdef[:visibility])
645
661
  end
646
662
 
663
+ def conv_attr_defs(mdef, rbs_source)
664
+ ivar = :"@#{ mdef[:ivar] }"
665
+ kind = mdef[:kind]
666
+ pub_meth = mdef[:visibility]
667
+
668
+ defs = []
669
+ if kind == :reader || kind == :accessor
670
+ defs << TypedAttrMethodDef.new(ivar, :reader, pub_meth, rbs_source)
671
+ end
672
+ if kind == :writer || kind == :accessor
673
+ defs << TypedAttrMethodDef.new(ivar, :writer, pub_meth, rbs_source)
674
+ end
675
+ raise if defs.empty?
676
+ defs
677
+ end
678
+
647
679
  def conv_func(sig_ret)
648
680
  #type_params = sig_ret[:type_params] # XXX
649
681
  lead_tys = sig_ret[:lead_tys]
@@ -21,6 +21,7 @@ TypeProf::INSN_TABLE = {:nop=>[],
21
21
  :putstring=>["VALUE"],
22
22
  :concatstrings=>["rb_num_t"],
23
23
  :tostring=>[],
24
+ :objtostring=>[],
24
25
  :anytostring=>[],
25
26
  :freezestring=>["VALUE"],
26
27
  :toregexp=>["rb_num_t", "rb_num_t"],
data/lib/typeprof/iseq.rb CHANGED
@@ -704,7 +704,7 @@ module TypeProf
704
704
  sp += 1
705
705
  when :newhashfromarray
706
706
  raise NotImplementedError, "newhashfromarray"
707
- when :newrange, :tostring, :anytostring
707
+ when :newrange, :tostring, :objtostring, :anytostring
708
708
  sp -= 2
709
709
  return nil if sp <= 0
710
710
  sp += 1
@@ -753,7 +753,7 @@ module TypeProf
753
753
  when :setlocal, :setblockparam
754
754
  return # conservative
755
755
  when :getinstancevariable, :getclassvariable, :getglobal,
756
- :getlocal, :getblockparam, :getblockparamproxy
756
+ :getlocal, :getblockparam, :getblockparamproxy, :getlocal_checkmatch_branch
757
757
  sp += 1
758
758
  when :getconstant
759
759
  sp -= 2
@@ -67,6 +67,10 @@ module TypeProf
67
67
  if rest_start
68
68
  # almost ok
69
69
  else
70
+ if msig.rest_ty
71
+ scratch.error(ep, "RBS says that a rest argument is accepted, but the method definition does not accept one")
72
+ return
73
+ end
70
74
  if msig.lead_tys.size + msig.post_tys.size < lead_num + post_num
71
75
  scratch.error(ep, "RBS says that the arity may be %d, but the method definition requires at least %d arguments" % [msig.lead_tys.size + msig.post_tys.size, lead_num + post_num])
72
76
  return
@@ -79,7 +83,6 @@ module TypeProf
79
83
 
80
84
  lead_num = @iseq.fargs_format[:lead_num] || 0
81
85
  post_start = @iseq.fargs_format[:post_start]
82
- rest_start = @iseq.fargs_format[:rest_start]
83
86
  kw_start = @iseq.fargs_format[:kwbits]
84
87
  keyword = @iseq.fargs_format[:keyword]
85
88
  kw_start -= keyword.size if kw_start
@@ -175,14 +178,13 @@ module TypeProf
175
178
  end
176
179
 
177
180
  class AttrMethodDef < MethodDef
178
- def initialize(ivar, kind, pub_meth, def_ep)
181
+ def initialize(ivar, kind, pub_meth)
179
182
  @ivar = ivar
180
183
  @kind = kind # :reader | :writer
181
184
  @pub_meth = pub_meth
182
- @def_ep = def_ep
183
185
  end
184
186
 
185
- attr_reader :ivar, :kind, :def_ep
187
+ attr_reader :ivar, :kind
186
188
 
187
189
  def do_send(recv, mid, aargs, caller_ep, caller_env, scratch, &ctn)
188
190
  case @kind
@@ -206,6 +208,25 @@ module TypeProf
206
208
  end
207
209
  end
208
210
 
211
+ class ExecutedAttrMethodDef < AttrMethodDef
212
+ def initialize(ivar, kind, pub_meth, def_ep)
213
+ super(ivar, kind, pub_meth)
214
+ @def_ep = def_ep
215
+ end
216
+
217
+ attr_reader :def_ep
218
+ end
219
+
220
+ class TypedAttrMethodDef < AttrMethodDef
221
+ def initialize(ivar, kind, pub_meth, rbs_source)
222
+ @rbs_source = rbs_source
223
+
224
+ super(ivar, kind, pub_meth)
225
+ end
226
+
227
+ attr_reader :rbs_source
228
+ end
229
+
209
230
  class TypedMethodDef < MethodDef
210
231
  def initialize(sig_rets, rbs_source, pub_meth) # sig_rets: Array<[MethodSignature, (return)Type]>
211
232
  @sig_rets = sig_rets
data/lib/typeprof/type.rb CHANGED
@@ -855,7 +855,7 @@ module TypeProf
855
855
  sig_help = {}
856
856
  add_farg = -> farg, name, help: false, key: sig_help.size do
857
857
  name = "`#{ name }`" if RBS::Parser::KEYWORDS.key?(name.to_s)
858
- name = "noname_#{ name }" if name.is_a?(Integer)
858
+ name = "noname" if name.is_a?(Integer) || name == :"*"
859
859
  fargs_str << ", " if fargs_str != "("
860
860
  i = fargs_str.size
861
861
  fargs_str << (Config.current.options[:show_parameter_names] && name ? "#{ farg } #{ name }" : farg)
@@ -1,3 +1,3 @@
1
1
  module TypeProf
2
- VERSION = "0.20.3"
2
+ VERSION = "0.21.2"
3
3
  end
data/typeprof.gemspec CHANGED
@@ -24,11 +24,11 @@ Gem::Specification.new do |spec|
24
24
  # Specify which files should be added to the gem when it is released.
25
25
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
26
26
  spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
27
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|smoke|testbed)/}) }
27
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(doc|test|spec|features|smoke|testbed)/}) }
28
28
  end
29
29
  spec.bindir = "exe"
30
30
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
31
  spec.require_paths = ["lib"]
32
32
 
33
- spec.add_runtime_dependency "rbs", ">= 1.6.2"
33
+ spec.add_runtime_dependency "rbs", ">= 1.8.1"
34
34
  end
@@ -88,6 +88,9 @@ function executeTypeProf(folder: vscode.WorkspaceFolder, arg: String): child_pro
88
88
  if (shell && (shell.endsWith("bash") || shell.endsWith("zsh") || shell.endsWith("fish"))) {
89
89
  typeprof = child_process.spawn(shell, ["-c", "-l", cmd], { cwd });
90
90
  }
91
+ else if (process.platform === "win32") {
92
+ typeprof = child_process.spawn("C:\\Windows\\System32\\cmd.exe", ["/c", cmd], { cwd });
93
+ }
91
94
  else {
92
95
  typeprof = child_process.spawn(cmd, { cwd });
93
96
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typeprof
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.3
4
+ version: 0.21.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yusuke Endoh
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-11 00:00:00.000000000 Z
11
+ date: 2021-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbs
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.6.2
19
+ version: 1.8.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 1.6.2
26
+ version: 1.8.1
27
27
  description: |
28
28
  TypeProf performs a type analysis of non-annotated Ruby code.
29
29
 
@@ -44,14 +44,6 @@ files:
44
44
  - LICENSE
45
45
  - README.md
46
46
  - Rakefile
47
- - doc/demo.md
48
- - doc/doc.ja.md
49
- - doc/doc.md
50
- - doc/ide.md
51
- - doc/ppl2019.pdf
52
- - doc/todo.md
53
- - doc/typeprof-for-ide-log.png
54
- - doc/typeprof-for-ide.png
55
47
  - exe/typeprof
56
48
  - lib/typeprof.rb
57
49
  - lib/typeprof/analyzer.rb
@@ -106,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
98
  - !ruby/object:Gem::Version
107
99
  version: '0'
108
100
  requirements: []
109
- rubygems_version: 3.3.0.dev
101
+ rubygems_version: 3.4.0.dev
110
102
  signing_key:
111
103
  specification_version: 4
112
104
  summary: TypeProf is a type analysis tool for Ruby code based on abstract interpretation