typeprof 0.9.2 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (189) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/main.yml +1 -1
  3. data/Gemfile.lock +6 -5
  4. data/doc/demo.md +2 -2
  5. data/doc/todo.md +133 -0
  6. data/lib/typeprof/analyzer.rb +201 -104
  7. data/lib/typeprof/block.rb +39 -4
  8. data/lib/typeprof/builtin.rb +217 -70
  9. data/lib/typeprof/cli.rb +7 -0
  10. data/lib/typeprof/config.rb +30 -14
  11. data/lib/typeprof/container-type.rb +24 -0
  12. data/lib/typeprof/export.rb +134 -74
  13. data/lib/typeprof/import.rb +87 -39
  14. data/lib/typeprof/iseq.rb +116 -41
  15. data/lib/typeprof/method.rb +29 -7
  16. data/lib/typeprof/type.rb +75 -13
  17. data/lib/typeprof/version.rb +1 -1
  18. data/smoke/alias.rb +4 -4
  19. data/smoke/alias2.rb +3 -1
  20. data/smoke/arguments.rb +2 -2
  21. data/smoke/arguments2.rb +5 -5
  22. data/smoke/array-each.rb +1 -1
  23. data/smoke/array-each3.rb +1 -1
  24. data/smoke/array-map.rb +1 -1
  25. data/smoke/array-map2.rb +1 -1
  26. data/smoke/array-map3.rb +3 -3
  27. data/smoke/array-mul.rb +2 -2
  28. data/smoke/array-plus1.rb +1 -1
  29. data/smoke/array-plus2.rb +1 -0
  30. data/smoke/array-range-aref.rb +11 -11
  31. data/smoke/array-replace.rb +1 -1
  32. data/smoke/array1.rb +5 -5
  33. data/smoke/array10.rb +1 -1
  34. data/smoke/array11.rb +1 -1
  35. data/smoke/array12.rb +1 -1
  36. data/smoke/array14.rb +1 -1
  37. data/smoke/array15.rb +1 -1
  38. data/smoke/array2.rb +2 -2
  39. data/smoke/array3.rb +1 -0
  40. data/smoke/array6.rb +2 -1
  41. data/smoke/array8.rb +1 -1
  42. data/smoke/array9.rb +1 -1
  43. data/smoke/attr-module.rb +1 -0
  44. data/smoke/attr-vis.rb +43 -0
  45. data/smoke/attr-vis.rbs +4 -0
  46. data/smoke/attr.rb +2 -2
  47. data/smoke/block-ambiguous.rb +4 -4
  48. data/smoke/block-args1-rest.rb +6 -5
  49. data/smoke/block-args1.rb +5 -5
  50. data/smoke/block-args2-rest.rb +6 -5
  51. data/smoke/block-args2.rb +5 -5
  52. data/smoke/block-args3-rest.rb +7 -6
  53. data/smoke/block-args3.rb +6 -6
  54. data/smoke/block-blockarg.rb +3 -3
  55. data/smoke/block-kwarg.rb +4 -4
  56. data/smoke/block1.rb +1 -1
  57. data/smoke/block10.rb +1 -1
  58. data/smoke/block11.rb +2 -2
  59. data/smoke/block2.rb +1 -1
  60. data/smoke/block3.rb +1 -1
  61. data/smoke/block5.rb +1 -0
  62. data/smoke/block_given.rb +37 -0
  63. data/smoke/break4.rb +17 -0
  64. data/smoke/class_eval.rb +22 -0
  65. data/smoke/class_method.rb +2 -2
  66. data/smoke/class_method2.rb +2 -2
  67. data/smoke/constant2.rb +3 -2
  68. data/smoke/context-sensitive1.rb +1 -1
  69. data/smoke/cvar.rb +3 -2
  70. data/smoke/define_method.rb +2 -2
  71. data/smoke/define_method3.rb +1 -0
  72. data/smoke/define_method4.rb +1 -1
  73. data/smoke/define_method6.rb +19 -0
  74. data/smoke/define_method7.rb +18 -0
  75. data/smoke/demo.rb +6 -6
  76. data/smoke/demo1.rb +1 -1
  77. data/smoke/demo11.rb +1 -1
  78. data/smoke/demo2.rb +1 -1
  79. data/smoke/demo3.rb +1 -1
  80. data/smoke/demo4.rb +3 -3
  81. data/smoke/demo5.rb +1 -1
  82. data/smoke/demo6.rb +2 -1
  83. data/smoke/demo7.rb +1 -1
  84. data/smoke/demo9.rb +1 -0
  85. data/smoke/dummy-execution1.rb +1 -1
  86. data/smoke/dummy-execution2.rb +1 -1
  87. data/smoke/dummy_element.rb +1 -1
  88. data/smoke/ensure1.rb +1 -1
  89. data/smoke/enum_for.rb +15 -0
  90. data/smoke/enum_for2.rb +17 -0
  91. data/smoke/extended.rb +38 -0
  92. data/smoke/fib.rb +2 -2
  93. data/smoke/flow1.rb +1 -1
  94. data/smoke/flow10.rb +17 -0
  95. data/smoke/flow11.rb +17 -0
  96. data/smoke/flow2.rb +1 -1
  97. data/smoke/flow3.rb +1 -1
  98. data/smoke/flow5.rb +1 -1
  99. data/smoke/flow6.rb +1 -1
  100. data/smoke/flow7.rb +1 -1
  101. data/smoke/flow8.rb +1 -1
  102. data/smoke/flow9.rb +1 -1
  103. data/smoke/function.rb +1 -1
  104. data/smoke/gvar.rb +1 -1
  105. data/smoke/gvar2.rb +1 -1
  106. data/smoke/hash-fetch.rb +3 -3
  107. data/smoke/included.rb +38 -0
  108. data/smoke/inheritance.rb +4 -4
  109. data/smoke/inherited.rb +26 -0
  110. data/smoke/initialize.rb +3 -2
  111. data/smoke/instance_eval.rb +2 -2
  112. data/smoke/instance_eval4.rb +12 -0
  113. data/smoke/int_times.rb +1 -1
  114. data/smoke/integer.rb +1 -1
  115. data/smoke/ivar.rb +3 -2
  116. data/smoke/ivar2.rb +2 -2
  117. data/smoke/ivar3.rb +2 -1
  118. data/smoke/ivar4.rb +1 -0
  119. data/smoke/kernel-class.rb +1 -1
  120. data/smoke/keyword4.rb +1 -1
  121. data/smoke/kwrest.rb +1 -0
  122. data/smoke/kwsplat1.rb +2 -2
  123. data/smoke/kwsplat2.rb +1 -1
  124. data/smoke/manual-rbs.rb +1 -0
  125. data/smoke/manual-rbs3.rb +1 -0
  126. data/smoke/method_missing.rb +4 -3
  127. data/smoke/module3.rb +1 -1
  128. data/smoke/module4.rb +1 -0
  129. data/smoke/module5.rb +1 -1
  130. data/smoke/module_function1.rb +3 -2
  131. data/smoke/module_function2.rb +3 -2
  132. data/smoke/multiple-include.rb +1 -0
  133. data/smoke/next1.rb +1 -1
  134. data/smoke/object-send1.rb +3 -3
  135. data/smoke/optional1.rb +1 -1
  136. data/smoke/optional2.rb +1 -1
  137. data/smoke/optional3.rb +1 -1
  138. data/smoke/parameterizedd-self.rb +2 -1
  139. data/smoke/prepend1.rb +33 -0
  140. data/smoke/prepend2.rb +10 -0
  141. data/smoke/prepend2.rbs +9 -0
  142. data/smoke/primitive_method.rb +19 -0
  143. data/smoke/proc4.rb +1 -1
  144. data/smoke/public.rb +4 -0
  145. data/smoke/range.rb +1 -1
  146. data/smoke/rbs-attr.rb +2 -2
  147. data/smoke/rbs-proc2.rb +1 -1
  148. data/smoke/rbs-proc3.rb +1 -1
  149. data/smoke/rbs-tyvar4.rb +3 -2
  150. data/smoke/rbs-tyvar6.rb +3 -3
  151. data/smoke/redo1.rb +1 -1
  152. data/smoke/redo2.rb +1 -1
  153. data/smoke/rescue1.rb +1 -1
  154. data/smoke/rescue2.rb +1 -1
  155. data/smoke/rescue3.rb +1 -0
  156. data/smoke/rescue4.rb +1 -1
  157. data/smoke/respond_to.rb +1 -1
  158. data/smoke/rest1.rb +2 -2
  159. data/smoke/rest2.rb +1 -1
  160. data/smoke/rest3.rb +6 -6
  161. data/smoke/rest4.rb +2 -2
  162. data/smoke/rest5.rb +1 -1
  163. data/smoke/rest6.rb +1 -1
  164. data/smoke/retry1.rb +2 -2
  165. data/smoke/simple.rb +1 -1
  166. data/smoke/step.rb +3 -3
  167. data/smoke/struct-keyword_init.rb +6 -16
  168. data/smoke/struct.rb +1 -1
  169. data/smoke/struct2.rb +1 -1
  170. data/smoke/struct3.rb +1 -1
  171. data/smoke/struct4.rb +1 -1
  172. data/smoke/struct5.rb +2 -2
  173. data/smoke/struct6.rb +2 -2
  174. data/smoke/struct7.rb +1 -1
  175. data/smoke/super1.rb +4 -4
  176. data/smoke/super3.rb +3 -2
  177. data/smoke/super4.rb +7 -5
  178. data/smoke/super5.rb +6 -4
  179. data/smoke/symbol-proc-attr.rb +1 -1
  180. data/smoke/tap1.rb +2 -2
  181. data/smoke/toplevel.rb +1 -1
  182. data/smoke/type_var.rb +3 -3
  183. data/smoke/user-demo.rb +1 -1
  184. data/smoke/wrong-extend.rb +1 -0
  185. data/smoke/wrong-include.rb +1 -0
  186. data/smoke/wrong-include2.rb +1 -1
  187. data/testbed/goodcheck-Gemfile.lock +1 -1
  188. data/typeprof.gemspec +1 -1
  189. metadata +25 -5
@@ -1,5 +1,7 @@
1
1
  module TypeProf
2
2
  class MethodDef
3
+ attr_accessor :pub_meth
4
+
3
5
  include Utils::StructuralEquality
4
6
  end
5
7
 
@@ -12,8 +14,6 @@ module TypeProf
12
14
  @pub_meth = pub_meth
13
15
  end
14
16
 
15
- attr_accessor :pub_meth
16
-
17
17
  def do_send(recv, mid, aargs, caller_ep, caller_env, scratch, &ctn)
18
18
  recv = recv.base_type while recv.respond_to?(:base_type)
19
19
  recv = scratch.globalize_type(recv, caller_env, caller_ep)
@@ -153,14 +153,34 @@ module TypeProf
153
153
  end
154
154
  end
155
155
 
156
+ class AliasMethodDef < MethodDef
157
+ def initialize(orig_mid, mdef, def_ep)
158
+ @orig_mid = orig_mid
159
+ @mdef = mdef
160
+ @pub_meth = mdef.pub_meth
161
+ @def_ep = def_ep
162
+ end
163
+
164
+ attr_reader :orig_mid, :mdef, :def_ep
165
+
166
+ def do_send(recv, _mid, aargs, caller_ep, caller_env, scratch, &ctn)
167
+ @mdef.do_send(recv, @orig_mid, aargs, caller_ep, caller_env, scratch, &ctn)
168
+ end
169
+
170
+ def do_check_send(msig, recv, mid, ep, scratch)
171
+ @mdef.do_check_send(msig, recv, mid, ep, scratch)
172
+ end
173
+ end
174
+
156
175
  class AttrMethodDef < MethodDef
157
- def initialize(ivar, kind, absolute_path)
176
+ def initialize(ivar, kind, pub_meth, def_ep)
158
177
  @ivar = ivar
159
178
  @kind = kind # :reader | :writer
160
- @absolute_path = absolute_path
179
+ @pub_meth = pub_meth
180
+ @def_ep = def_ep
161
181
  end
162
182
 
163
- attr_reader :ivar, :kind, :absolute_path
183
+ attr_reader :ivar, :kind, :def_ep
164
184
 
165
185
  def do_send(recv, mid, aargs, caller_ep, caller_env, scratch, &ctn)
166
186
  case @kind
@@ -185,9 +205,10 @@ module TypeProf
185
205
  end
186
206
 
187
207
  class TypedMethodDef < MethodDef
188
- def initialize(sig_rets, rbs_source) # sig_rets: Array<[MethodSignature, (return)Type]>
208
+ def initialize(sig_rets, rbs_source, pub_meth) # sig_rets: Array<[MethodSignature, (return)Type]>
189
209
  @sig_rets = sig_rets
190
210
  @rbs_source = rbs_source
211
+ @pub_meth = pub_meth
191
212
  end
192
213
 
193
214
  attr_reader :rbs_source
@@ -286,8 +307,9 @@ module TypeProf
286
307
  end
287
308
 
288
309
  class CustomMethodDef < MethodDef
289
- def initialize(impl)
310
+ def initialize(impl, pub_meth)
290
311
  @impl = impl
312
+ @pub_meth = pub_meth
291
313
  end
292
314
 
293
315
  def do_send(recv, mid, aargs, caller_ep, caller_env, scratch, &ctn)
data/lib/typeprof/type.rb CHANGED
@@ -162,6 +162,10 @@ module TypeProf
162
162
  substitute(DummySubstitution, Config.options[:type_depth_limit])
163
163
  end
164
164
 
165
+ def include_untyped?(_scratch)
166
+ false
167
+ end
168
+
165
169
  class Any < Type
166
170
  def initialize
167
171
  end
@@ -185,6 +189,10 @@ module TypeProf
185
189
  def substitute(_subst, _depth)
186
190
  self
187
191
  end
192
+
193
+ def include_untyped?(_scratch)
194
+ true
195
+ end
188
196
  end
189
197
 
190
198
  class Void < Any
@@ -379,6 +387,17 @@ module TypeProf
379
387
  end
380
388
  ty
381
389
  end
390
+
391
+ def include_untyped?(scratch)
392
+ @types.each do |ty|
393
+ return true if ty.include_untyped?(scratch)
394
+ end
395
+ @elems&.each do |(container_kind, base_type), elems|
396
+ return true if base_type.include_untyped?(scratch)
397
+ return true if elems.include_untyped?(scratch)
398
+ end
399
+ false
400
+ end
382
401
  end
383
402
 
384
403
  def self.any
@@ -583,6 +602,10 @@ module TypeProf
583
602
  def screen_name(scratch)
584
603
  scratch.show_proc_signature([self])
585
604
  end
605
+
606
+ def include_untyped?(scratch)
607
+ false # XXX: need to check the block signatures recursively
608
+ end
586
609
  end
587
610
 
588
611
  class Symbol < Type
@@ -781,31 +804,56 @@ module TypeProf
781
804
  class Signature
782
805
  include Utils::StructuralEquality
783
806
 
784
- def screen_name(scratch)
785
- str = @lead_tys.map {|ty| ty.screen_name(scratch) }
807
+ def screen_name(iseq, scratch)
808
+ fargs = @lead_tys.map {|ty| ty.screen_name(scratch) }
809
+ farg_names = []
810
+ farg_names += iseq.locals[0, @lead_tys.size] if iseq
786
811
  if @opt_tys
787
- str += @opt_tys.map {|ty| "?" + ty.screen_name(scratch) }
812
+ fargs += @opt_tys.map {|ty| "?" + ty.screen_name(scratch) }
813
+ farg_names += iseq.locals[@lead_tys.size, @opt_tys.size] if iseq
788
814
  end
789
815
  if @rest_ty
790
- str << ("*" + @rest_ty.screen_name(scratch))
816
+ fargs << ("*" + @rest_ty.screen_name(scratch))
817
+ if iseq
818
+ rest_index = iseq.fargs_format[:rest_start]
819
+ farg_names << (rest_index ? iseq.locals[rest_index] : nil)
820
+ end
791
821
  end
792
822
  if @post_tys
793
- str += @post_tys.map {|ty| ty.screen_name(scratch) }
823
+ fargs += @post_tys.map {|ty| ty.screen_name(scratch) }
824
+ if iseq
825
+ post_start = iseq.fargs_format[:post_start]
826
+ farg_names += (post_start ? iseq.locals[post_start, @post_tys.size] : [nil] * @post_tys.size)
827
+ end
794
828
  end
795
829
  if @kw_tys
796
830
  @kw_tys.each do |req, sym, ty|
797
831
  opt = req ? "" : "?"
798
- str << "#{ opt }#{ sym }: #{ ty.screen_name(scratch) }"
832
+ fargs << "#{ opt }#{ sym }: #{ ty.screen_name(scratch) }"
799
833
  end
800
834
  end
801
835
  if @kw_rest_ty
802
- str << ("**" + @kw_rest_ty.screen_name(scratch))
836
+ all_val_ty = Type.bot
837
+ @kw_rest_ty.each_child_global do |ty|
838
+ if ty == Type.any
839
+ val_ty = ty
840
+ else
841
+ # ty is a Type::Hash
842
+ _key_ty, val_ty = ty.elems.squash
843
+ end
844
+ all_val_ty = all_val_ty.union(val_ty)
845
+ end
846
+ fargs << ("**" + all_val_ty.screen_name(scratch))
847
+ end
848
+ if Config.options[:show_parameter_names]
849
+ farg_names = farg_names.map {|name| name == :type ? :type_ : name } # XXX: workaround of RBS parser bug
850
+ fargs = fargs.zip(farg_names).map {|farg, name| name ? "#{ farg } #{ name }" : farg }
803
851
  end
804
- str = str.empty? ? "" : "(#{ str.join(", ") })"
852
+ fargs = fargs.empty? ? "" : "(#{ fargs.join(", ") })"
805
853
 
806
854
  # Dirty Hack: Stop the iteration at most once!
807
855
  # I'll remove this hack if RBS removes the limitation of nesting blocks
808
- return str if caller_locations.any? {|frame| frame.label == "show_block_signature" }
856
+ return fargs if caller_locations.any? {|frame| frame.label == "show_block_signature" }
809
857
 
810
858
  optional = false
811
859
  blks = []
@@ -818,12 +866,12 @@ module TypeProf
818
866
  end
819
867
  end
820
868
  if blks != []
821
- str << " " if str != ""
822
- str << "?" if optional
823
- str << scratch.show_block_signature(blks)
869
+ fargs << " " if fargs != ""
870
+ fargs << "?" if optional
871
+ fargs << scratch.show_block_signature(blks)
824
872
  end
825
873
 
826
- str
874
+ fargs
827
875
  end
828
876
  end
829
877
 
@@ -838,9 +886,23 @@ module TypeProf
838
886
  @kw_tys = kw_tys
839
887
  kw_tys.each {|a| raise if a.size != 3 } if kw_tys
840
888
  @kw_rest_ty = kw_rest_ty
889
+ kw_rest_ty&.each_child_global do |ty|
890
+ raise ty.inspect if ty != Type.any && !ty.is_a?(Type::Hash)
891
+ end
841
892
  @blk_ty = blk_ty
842
893
  end
843
894
 
895
+ def include_untyped?(scratch)
896
+ return true if @lead_tys.any? {|ty| ty.include_untyped?(scratch) }
897
+ return true if @opt_tys.any? {|ty| ty.include_untyped?(scratch) }
898
+ return true if @rest_ty&.include_untyped?(scratch)
899
+ return true if @post_tys.any? {|ty| ty.include_untyped?(scratch) }
900
+ return true if @kw_tys&.any? {|_, _, ty| ty.include_untyped?(scratch) }
901
+ return true if @kw_rest_ty&.include_untyped?(scratch)
902
+ return true if @blk_ty&.include_untyped?(scratch)
903
+ false
904
+ end
905
+
844
906
  attr_reader :lead_tys, :opt_tys, :rest_ty, :post_tys, :kw_tys, :kw_rest_ty, :blk_ty
845
907
 
846
908
  def substitute(subst, depth)
@@ -1,3 +1,3 @@
1
1
  module TypeProf
2
- VERSION = "0.9.2"
2
+ VERSION = "0.14.0"
3
3
  end
data/smoke/alias.rb CHANGED
@@ -21,11 +21,11 @@ __END__
21
21
  # Classes
22
22
  class Object
23
23
  private
24
- def foo: (Integer) -> Integer
25
- def bar: (String) -> String
24
+ def foo: (Integer | String x) -> (Integer | String)
25
+ alias bar foo
26
26
  end
27
27
 
28
28
  class Test
29
- def baz: (Integer) -> Integer
30
- def qux: (String) -> String
29
+ def baz: (Integer | String x) -> (Integer | String)
30
+ alias qux baz
31
31
  end
data/smoke/alias2.rb CHANGED
@@ -15,5 +15,7 @@ class Foo
15
15
  @a: :x
16
16
  @b: :y
17
17
  @c: :z
18
- def initialize: (:x, :y, :z) -> [:x, :y, :z]
18
+
19
+ alias self.[] self.new
20
+ def initialize: (:x a, :y b, :z c) -> [:x, :y, :z]
19
21
  end
data/smoke/arguments.rb CHANGED
@@ -12,6 +12,6 @@ smoke/arguments.rb:6: [error] wrong number of arguments (given 2, expected 1)
12
12
  # Classes
13
13
  class Object
14
14
  private
15
- def foo: (untyped) -> nil
16
- def bar: (untyped) -> nil
15
+ def foo: (untyped x) -> nil
16
+ def bar: (untyped x) -> nil
17
17
  end
data/smoke/arguments2.rb CHANGED
@@ -44,13 +44,13 @@ __END__
44
44
  class Object
45
45
  private
46
46
  def f1: -> nil
47
- def f2: (:x, :y, :z) -> nil
48
- def f3: (?String, ?String) -> nil
49
- def f4: (*:a | :b | :c) -> nil
50
- def f5: (:x, ?String, :z) -> nil
47
+ def f2: (:x x, :y y, :z z) -> nil
48
+ def f3: (?String x, ?String y) -> nil
49
+ def f4: (*:a | :b | :c r) -> nil
50
+ def f5: (:x x, ?String y, :z z) -> nil
51
51
  def f6: (k: :kk) -> nil
52
52
  def f7: (?k: Integer) -> nil
53
53
  def f8: (?k: String) -> nil
54
- def f9: (**{k: :kk}) -> nil
54
+ def f9: (**:kk) -> nil
55
55
  def f10: { (Integer) -> nil } -> nil
56
56
  end
data/smoke/array-each.rb CHANGED
@@ -11,5 +11,5 @@ __END__
11
11
  # Classes
12
12
  class Object
13
13
  private
14
- def log: ((:sym | Integer | String)?) -> nil
14
+ def log: ((:sym | Integer | String)? x) -> nil
15
15
  end
data/smoke/array-each3.rb CHANGED
@@ -9,5 +9,5 @@ __END__
9
9
  # Classes
10
10
  class Object
11
11
  private
12
- def log: (bot) -> nil
12
+ def log: (bot x) -> nil
13
13
  end
data/smoke/array-map.rb CHANGED
@@ -8,5 +8,5 @@ __END__
8
8
  # Classes
9
9
  class Object
10
10
  private
11
- def foo: ([Integer, Integer, Integer]) -> Array[String]
11
+ def foo: ([Integer, Integer, Integer] a) -> Array[String]
12
12
  end
data/smoke/array-map2.rb CHANGED
@@ -7,5 +7,5 @@ __END__
7
7
  # Classes
8
8
  class Object
9
9
  private
10
- def foo: ([Integer, Integer, Integer]) -> (Array[Integer | String])
10
+ def foo: ([Integer, Integer, Integer] a) -> (Array[Integer | String])
11
11
  end
data/smoke/array-map3.rb CHANGED
@@ -17,7 +17,7 @@ __END__
17
17
  # Classes
18
18
  class Object
19
19
  private
20
- def map_test: ([Integer, Integer, Integer]) -> Array[String]
21
- def map_bang_test: ([Integer, Integer, Integer]) -> (Array[Integer | String])
22
- def map_bang_test_known_bug: ([Integer, Integer, Integer]) -> [Integer, Integer, Integer]
20
+ def map_test: ([Integer, Integer, Integer] a) -> Array[String]
21
+ def map_bang_test: ([Integer, Integer, Integer] a) -> (Array[Integer | String])
22
+ def map_bang_test_known_bug: ([Integer, Integer, Integer] a) -> [Integer, Integer, Integer]
23
23
  end
data/smoke/array-mul.rb CHANGED
@@ -13,6 +13,6 @@ __END__
13
13
  # Classes
14
14
  class Object
15
15
  private
16
- def foo: ([Integer, Integer, Integer]) -> Array[Integer]
17
- def bar: ([Integer, Integer, Integer]) -> String
16
+ def foo: ([Integer, Integer, Integer] a) -> Array[Integer]
17
+ def bar: ([Integer, Integer, Integer] a) -> String
18
18
  end
data/smoke/array-plus1.rb CHANGED
@@ -7,5 +7,5 @@ __END__
7
7
  # Classes
8
8
  class Object
9
9
  private
10
- def log: (Array[:sym | Integer | String]) -> nil
10
+ def log: (Array[:sym | Integer | String] x) -> nil
11
11
  end
data/smoke/array-plus2.rb CHANGED
@@ -11,5 +11,6 @@ __END__
11
11
  # Classes
12
12
  class Foo
13
13
  @var: Array[Integer]
14
+
14
15
  def foo: -> Array[Integer]
15
16
  end
@@ -57,15 +57,15 @@ __END__
57
57
  # Classes
58
58
  class Object
59
59
  private
60
- def f1: (*:a | :b | :c | :d | :e) -> (Array[:a | :b | :c | :d | :e])
61
- def f2: (*:a | :b | :c | :d | :e) -> (Array[:a | :b | :c | :d | :e])
62
- def f3: (*:a | :b | :c | :d | :e) -> (Array[:a | :b | :c | :d | :e])
63
- def f4: (*:a | :b | :c | :d | :e) -> (Array[:a | :b | :c | :d | :e])
64
- def f5: (*:a | :b | :c | :d | :e) -> (Array[:a | :b | :c | :d | :e])
65
- def f6: (*:a | :b | :c | :d | :e) -> (Array[:a | :b | :c | :d | :e])
66
- def f7: (*:a | :b | :c | :d | :e) -> (Array[:a | :b | :c | :d | :e])
67
- def f8: (*:a | :b | :c | :d | :e) -> (Array[:a | :b | :c | :d | :e])
68
- def f9: (*:a | :b | :c | :d | :e) -> (Array[:a | :b | :c | :d | :e])
69
- def f10: (*:a | :b | :c | :d | :e) -> (Array[:a | :b | :c | :d | :e])
70
- def dispatch: (*:a | :b | :c | :d | :e) -> (Array[:a | :b | :c | :d | :e])
60
+ def f1: (*:a | :b | :c | :d | :e ary) -> (Array[:a | :b | :c | :d | :e])
61
+ def f2: (*:a | :b | :c | :d | :e ary) -> (Array[:a | :b | :c | :d | :e])
62
+ def f3: (*:a | :b | :c | :d | :e ary) -> (Array[:a | :b | :c | :d | :e])
63
+ def f4: (*:a | :b | :c | :d | :e ary) -> (Array[:a | :b | :c | :d | :e])
64
+ def f5: (*:a | :b | :c | :d | :e ary) -> (Array[:a | :b | :c | :d | :e])
65
+ def f6: (*:a | :b | :c | :d | :e ary) -> (Array[:a | :b | :c | :d | :e])
66
+ def f7: (*:a | :b | :c | :d | :e ary) -> (Array[:a | :b | :c | :d | :e])
67
+ def f8: (*:a | :b | :c | :d | :e ary) -> (Array[:a | :b | :c | :d | :e])
68
+ def f9: (*:a | :b | :c | :d | :e ary) -> (Array[:a | :b | :c | :d | :e])
69
+ def f10: (*:a | :b | :c | :d | :e ary) -> (Array[:a | :b | :c | :d | :e])
70
+ def dispatch: (*:a | :b | :c | :d | :e ary) -> (Array[:a | :b | :c | :d | :e])
71
71
  end
@@ -9,5 +9,5 @@ __END__
9
9
  # Classes
10
10
  class Object
11
11
  private
12
- def foo: ([Integer, Integer, Integer]) -> (Array[Integer | String])
12
+ def foo: ([Integer, Integer, Integer] a) -> (Array[Integer | String])
13
13
  end
data/smoke/array1.rb CHANGED
@@ -19,9 +19,9 @@ __END__
19
19
  # Classes
20
20
  class Object
21
21
  private
22
- def foo: ([Integer, String]) -> Integer
23
- def bar: (Integer) -> nil
24
- def baz: (String) -> nil
25
- def qux: (nil) -> nil
26
- def quux: (Integer | String) -> nil
22
+ def foo: ([Integer, String] a) -> Integer
23
+ def bar: (Integer n) -> nil
24
+ def baz: (String n) -> nil
25
+ def qux: (nil n) -> nil
26
+ def quux: (Integer | String n) -> nil
27
27
  end
data/smoke/array10.rb CHANGED
@@ -11,5 +11,5 @@ __END__
11
11
  # Classes
12
12
  class Object
13
13
  private
14
- def foo: ([:a, :b, :c]) -> :a
14
+ def foo: ([:a, :b, :c] a) -> :a
15
15
  end
data/smoke/array11.rb CHANGED
@@ -10,5 +10,5 @@ __END__
10
10
  # Classes
11
11
  class Object
12
12
  private
13
- def array: (Array[Integer] | Hash[Integer, Integer] | String) -> (Array[Hash[Integer, Integer] | Integer | String])
13
+ def array: (Array[Integer] | Hash[Integer, Integer] | String obj) -> (Array[Hash[Integer, Integer] | Integer | String])
14
14
  end
data/smoke/array12.rb CHANGED
@@ -19,7 +19,7 @@ __END__
19
19
  # Classes
20
20
  class Object
21
21
  private
22
- def bar: ([Integer]) -> nil
22
+ def bar: ([Integer] x) -> nil
23
23
  def test_yield: { -> nil } -> nil
24
24
  def foo: -> [Integer]
25
25
  end
data/smoke/array14.rb CHANGED
@@ -10,5 +10,5 @@ __END__
10
10
  # Classes
11
11
  class Object
12
12
  private
13
- def f: (:a, :b, :c) -> :c
13
+ def f: (:a a, :b b, :c c) -> :c
14
14
  end