typeprof 0.5.3 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (208) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +6 -4
  3. data/doc/doc.ja.md +3 -4
  4. data/doc/doc.md +3 -4
  5. data/lib/typeprof/analyzer.rb +248 -166
  6. data/lib/typeprof/arguments.rb +12 -6
  7. data/lib/typeprof/builtin.rb +123 -23
  8. data/lib/typeprof/cli.rb +33 -34
  9. data/lib/typeprof/config.rb +6 -4
  10. data/lib/typeprof/container-type.rb +175 -112
  11. data/lib/typeprof/export.rb +23 -17
  12. data/lib/typeprof/import.rb +58 -53
  13. data/lib/typeprof/method.rb +59 -125
  14. data/lib/typeprof/type.rb +26 -14
  15. data/lib/typeprof/version.rb +1 -1
  16. data/smoke/alias.rb +1 -0
  17. data/smoke/any1.rb +1 -0
  18. data/smoke/any2.rb +1 -0
  19. data/smoke/arguments.rb +1 -0
  20. data/smoke/arguments2.rb +1 -0
  21. data/smoke/array-each.rb +1 -0
  22. data/smoke/array-each2.rb +1 -0
  23. data/smoke/array-each3.rb +2 -1
  24. data/smoke/array-ltlt.rb +1 -0
  25. data/smoke/array-ltlt2.rb +1 -0
  26. data/smoke/array-map.rb +1 -0
  27. data/smoke/array-map2.rb +1 -0
  28. data/smoke/array-map3.rb +1 -0
  29. data/smoke/array-mul.rb +1 -0
  30. data/smoke/array-plus1.rb +1 -0
  31. data/smoke/array-pop.rb +1 -0
  32. data/smoke/array-range-aref.rb +71 -0
  33. data/smoke/array-replace.rb +1 -0
  34. data/smoke/array-s-aref.rb +1 -0
  35. data/smoke/array1.rb +1 -0
  36. data/smoke/array10.rb +1 -0
  37. data/smoke/array11.rb +2 -1
  38. data/smoke/array12.rb +1 -0
  39. data/smoke/array13.rb +1 -0
  40. data/smoke/array14.rb +1 -0
  41. data/smoke/array2.rb +1 -0
  42. data/smoke/array4.rb +1 -0
  43. data/smoke/array5.rb +1 -0
  44. data/smoke/array6.rb +3 -2
  45. data/smoke/array7.rb +1 -0
  46. data/smoke/array8.rb +1 -1
  47. data/smoke/array9.rb +1 -0
  48. data/smoke/autoload.rb +14 -0
  49. data/smoke/backtrace.rb +1 -0
  50. data/smoke/block-ambiguous.rb +1 -0
  51. data/smoke/block-args1-rest.rb +1 -0
  52. data/smoke/block-args1.rb +1 -0
  53. data/smoke/block-args2-rest.rb +1 -0
  54. data/smoke/block-args2.rb +4 -3
  55. data/smoke/block-args3-rest.rb +1 -0
  56. data/smoke/block-args3.rb +5 -4
  57. data/smoke/block-blockarg.rb +2 -1
  58. data/smoke/block-kwarg.rb +1 -0
  59. data/smoke/block1.rb +1 -0
  60. data/smoke/block10.rb +1 -0
  61. data/smoke/block11.rb +1 -0
  62. data/smoke/block12.rb +1 -0
  63. data/smoke/block14.rb +1 -0
  64. data/smoke/block2.rb +1 -0
  65. data/smoke/block4.rb +1 -0
  66. data/smoke/block5.rb +2 -1
  67. data/smoke/block6.rb +1 -0
  68. data/smoke/block7.rb +1 -0
  69. data/smoke/block8.rb +1 -0
  70. data/smoke/block9.rb +1 -0
  71. data/smoke/blown.rb +1 -0
  72. data/smoke/break1.rb +1 -0
  73. data/smoke/break2.rb +1 -0
  74. data/smoke/case.rb +1 -0
  75. data/smoke/case2.rb +1 -0
  76. data/smoke/class_method3.rb +2 -0
  77. data/smoke/constant2.rb +2 -2
  78. data/smoke/constant3.rb +1 -0
  79. data/smoke/constant4.rb +1 -0
  80. data/smoke/context-sensitive1.rb +1 -0
  81. data/smoke/cvar.rb +1 -0
  82. data/smoke/define_method.rb +16 -0
  83. data/smoke/define_method2.rb +18 -0
  84. data/smoke/demo.rb +1 -0
  85. data/smoke/demo1.rb +1 -0
  86. data/smoke/demo10.rb +1 -0
  87. data/smoke/demo11.rb +1 -0
  88. data/smoke/demo2.rb +1 -0
  89. data/smoke/demo3.rb +1 -0
  90. data/smoke/demo5.rb +1 -1
  91. data/smoke/demo7.rb +1 -0
  92. data/smoke/demo8.rb +1 -0
  93. data/smoke/demo9.rb +2 -1
  94. data/smoke/dummy-execution1.rb +1 -0
  95. data/smoke/ensure1.rb +1 -0
  96. data/smoke/enumerator.rb +1 -0
  97. data/smoke/expandarray1.rb +1 -0
  98. data/smoke/expandarray2.rb +1 -0
  99. data/smoke/flow1.rb +1 -0
  100. data/smoke/flow2.rb +1 -0
  101. data/smoke/flow3.rb +1 -0
  102. data/smoke/flow5.rb +1 -0
  103. data/smoke/flow6.rb +1 -0
  104. data/smoke/flow7.rb +1 -0
  105. data/smoke/flow8.rb +1 -0
  106. data/smoke/freeze.rb +1 -0
  107. data/smoke/function.rb +1 -0
  108. data/smoke/gvar.rb +1 -0
  109. data/smoke/gvar2.rb +1 -0
  110. data/smoke/hash-fetch.rb +1 -0
  111. data/smoke/hash-merge-bang.rb +1 -0
  112. data/smoke/hash1.rb +3 -1
  113. data/smoke/hash2.rb +1 -0
  114. data/smoke/hash3.rb +1 -0
  115. data/smoke/hash4.rb +2 -1
  116. data/smoke/inheritance2.rb +2 -2
  117. data/smoke/initialize.rb +1 -0
  118. data/smoke/int_times.rb +1 -0
  119. data/smoke/integer.rb +1 -0
  120. data/smoke/ivar.rb +1 -0
  121. data/smoke/ivar2.rb +1 -1
  122. data/smoke/kernel-class.rb +2 -1
  123. data/smoke/keyword1.rb +1 -0
  124. data/smoke/keyword2.rb +1 -0
  125. data/smoke/keyword3.rb +1 -0
  126. data/smoke/keyword4.rb +1 -0
  127. data/smoke/keyword5.rb +1 -0
  128. data/smoke/kwrest.rb +12 -0
  129. data/smoke/kwrest.rbs +3 -0
  130. data/smoke/kwsplat1.rb +2 -1
  131. data/smoke/kwsplat2.rb +1 -0
  132. data/smoke/manual-rbs.rb +1 -0
  133. data/smoke/manual-rbs2.rb +1 -0
  134. data/smoke/masgn1.rb +1 -0
  135. data/smoke/masgn2.rb +1 -0
  136. data/smoke/masgn3.rb +1 -0
  137. data/smoke/method_in_branch.rb +1 -0
  138. data/smoke/method_missing.rb +28 -0
  139. data/smoke/multiple-superclass.rb +1 -1
  140. data/smoke/next1.rb +1 -0
  141. data/smoke/next2.rb +1 -0
  142. data/smoke/object-send1.rb +1 -0
  143. data/smoke/once.rb +1 -0
  144. data/smoke/optional1.rb +1 -0
  145. data/smoke/optional2.rb +1 -0
  146. data/smoke/optional3.rb +1 -0
  147. data/smoke/parameterizedd-self.rb +3 -2
  148. data/smoke/parameterizedd-self2.rb +15 -0
  149. data/smoke/pathname1.rb +1 -0
  150. data/smoke/pathname2.rb +1 -0
  151. data/smoke/pattern-match1.rb +1 -0
  152. data/smoke/pattern-match2.rb +1 -0
  153. data/smoke/proc.rb +1 -0
  154. data/smoke/proc2.rb +1 -0
  155. data/smoke/proc3.rb +1 -0
  156. data/smoke/proc4.rb +1 -0
  157. data/smoke/range.rb +1 -0
  158. data/smoke/rbs-alias.rb +1 -0
  159. data/smoke/rbs-attr.rb +3 -2
  160. data/smoke/rbs-attr2.rb +11 -0
  161. data/smoke/rbs-attr2.rbs +3 -0
  162. data/smoke/rbs-extend.rb +1 -0
  163. data/smoke/rbs-interface.rb +1 -0
  164. data/smoke/rbs-proc1.rb +1 -0
  165. data/smoke/rbs-proc2.rb +1 -0
  166. data/smoke/rbs-proc3.rb +1 -0
  167. data/smoke/rbs-record.rb +1 -0
  168. data/smoke/rbs-tyvar.rb +1 -0
  169. data/smoke/rbs-tyvar2.rb +1 -0
  170. data/smoke/rbs-tyvar3.rb +1 -0
  171. data/smoke/rbs-tyvar5.rb +1 -0
  172. data/smoke/rbs-tyvar6.rb +18 -0
  173. data/smoke/rbs-tyvar6.rbs +12 -0
  174. data/smoke/rbs-tyvar7.rb +12 -0
  175. data/smoke/rbs-tyvar7.rbs +7 -0
  176. data/smoke/rbs-vars.rb +1 -2
  177. data/smoke/redo1.rb +1 -0
  178. data/smoke/redo2.rb +1 -0
  179. data/smoke/req-keyword.rb +1 -0
  180. data/smoke/rescue1.rb +1 -0
  181. data/smoke/rescue2.rb +1 -0
  182. data/smoke/respond_to.rb +1 -0
  183. data/smoke/rest-farg.rb +1 -0
  184. data/smoke/rest1.rb +1 -0
  185. data/smoke/rest2.rb +1 -0
  186. data/smoke/rest3.rb +1 -0
  187. data/smoke/rest4.rb +1 -0
  188. data/smoke/rest5.rb +1 -0
  189. data/smoke/rest6.rb +1 -0
  190. data/smoke/retry1.rb +1 -0
  191. data/smoke/return.rb +1 -0
  192. data/smoke/step.rb +1 -0
  193. data/smoke/string-split.rb +1 -0
  194. data/smoke/struct.rb +2 -2
  195. data/smoke/struct2.rb +1 -0
  196. data/smoke/super1.rb +1 -0
  197. data/smoke/super4.rb +43 -0
  198. data/smoke/super5.rb +36 -0
  199. data/smoke/svar1.rb +1 -0
  200. data/smoke/symbol-proc.rb +1 -0
  201. data/smoke/tap1.rb +1 -0
  202. data/smoke/toplevel.rb +1 -0
  203. data/smoke/two-map.rb +1 -0
  204. data/smoke/type_var.rb +1 -0
  205. data/smoke/typed_method.rb +1 -0
  206. data/smoke/uninitialize-var.rb +1 -0
  207. data/smoke/union-recv.rb +2 -2
  208. metadata +18 -2
@@ -149,6 +149,10 @@ module TypeProf
149
149
  raise "cannot substitute abstract type: #{ self.class }"
150
150
  end
151
151
 
152
+ def generate_substitution
153
+ {}
154
+ end
155
+
152
156
  DummySubstitution = Object.new
153
157
  def DummySubstitution.[](_)
154
158
  Type.any
@@ -170,7 +174,7 @@ module TypeProf
170
174
  "untyped"
171
175
  end
172
176
 
173
- def get_method(mid, scratch)
177
+ def method_dispatch_info
174
178
  nil
175
179
  end
176
180
 
@@ -203,11 +207,12 @@ module TypeProf
203
207
  local = nil
204
208
  tys.each do |ty|
205
209
  raise ty.inspect unless ty.is_a?(Type)
206
- local = true if ty.is_a?(LocalArray) || ty.is_a?(LocalHash)
210
+ local = true if ty.is_a?(Local)
207
211
  end
208
212
  raise if local && elems
209
213
 
210
214
  @elems = elems
215
+ raise elems.inspect if elems && !elems.is_a?(::Hash)
211
216
  end
212
217
 
213
218
  def each_free_type_variable(&blk)
@@ -285,7 +290,7 @@ module TypeProf
285
290
  types.delete(Type::Instance.new(Type::Builtin[:true]))
286
291
  bool = true
287
292
  end
288
- types.delete(Type.any) unless Config.options[:pedantic_output]
293
+ types.delete(Type.any) unless Config.options[:show_untyped]
289
294
  proc_tys, types = types.partition {|ty| ty.is_a?(Proc) }
290
295
  types = types.map {|ty| ty.screen_name(scratch) }
291
296
  types << scratch.show_proc_signature(proc_tys) unless proc_tys.empty?
@@ -435,10 +440,12 @@ module TypeProf
435
440
  @idx = idx
436
441
  @type_params = type_params
437
442
  @superclass = superclass
443
+ raise if @kind == :class && !@superclass
438
444
  @_name = name
439
445
  end
440
446
 
441
447
  attr_reader :kind, :idx, :type_params, :superclass
448
+ attr_accessor :superclass_type_args
442
449
 
443
450
  def inspect
444
451
  if @_name
@@ -449,11 +456,11 @@ module TypeProf
449
456
  end
450
457
 
451
458
  def screen_name(scratch)
452
- "#{ scratch.get_class_name(self) }.class"
459
+ "singleton(#{ scratch.get_class_name(self) })"
453
460
  end
454
461
 
455
- def get_method(mid, scratch)
456
- scratch.get_method(self, true, mid)
462
+ def method_dispatch_info
463
+ [self, true]
457
464
  end
458
465
 
459
466
  def consistent?(other)
@@ -504,8 +511,8 @@ module TypeProf
504
511
  end
505
512
  end
506
513
 
507
- def get_method(mid, scratch)
508
- scratch.get_method(@klass, false, mid)
514
+ def method_dispatch_info
515
+ [@klass, false]
509
516
  end
510
517
 
511
518
  def consistent?(other)
@@ -558,8 +565,8 @@ module TypeProf
558
565
  end
559
566
  end
560
567
 
561
- def get_method(mid, scratch)
562
- @base_type.get_method(mid, scratch)
568
+ def method_dispatch_info
569
+ @base_type.method_dispatch_info
563
570
  end
564
571
 
565
572
  def substitute(subst, depth)
@@ -600,8 +607,8 @@ module TypeProf
600
607
  end
601
608
  end
602
609
 
603
- def get_method(mid, scratch)
604
- @base_type.get_method(mid, scratch)
610
+ def method_dispatch_info
611
+ @base_type.method_dispatch_info
605
612
  end
606
613
 
607
614
  def substitute(_subst, _depth)
@@ -630,8 +637,8 @@ module TypeProf
630
637
  @base_type
631
638
  end
632
639
 
633
- def get_method(mid, scratch)
634
- @base_type.get_method(mid, scratch)
640
+ def method_dispatch_info
641
+ @base_type.method_dispatch_info
635
642
  end
636
643
 
637
644
  def consistent?(_other)
@@ -785,6 +792,10 @@ module TypeProf
785
792
  end
786
793
  str = str.empty? ? "" : "(#{ str.join(", ") })"
787
794
 
795
+ # Dirty Hack: Stop the iteration at most once!
796
+ # I'll remove this hack if RBS removes the limitation of nesting blocks
797
+ return str if caller_locations.any? {|frame| frame.label == "show_block_signature" }
798
+
788
799
  optional = false
789
800
  blks = []
790
801
  @blk_ty.each_child_global do |ty|
@@ -811,6 +822,7 @@ module TypeProf
811
822
  @opt_tys = opt_tys
812
823
  @rest_ty = rest_ty
813
824
  @post_tys = post_tys
825
+ raise unless post_tys
814
826
  @kw_tys = kw_tys
815
827
  kw_tys.each {|a| raise if a.size != 3 } if kw_tys
816
828
  @kw_rest_ty = kw_rest_ty
@@ -1,3 +1,3 @@
1
1
  module TypeProf
2
- VERSION = "0.5.3"
2
+ VERSION = "0.8.0"
3
3
  end
@@ -20,6 +20,7 @@ Test.new.qux("str")
20
20
  __END__
21
21
  # Classes
22
22
  class Object
23
+ private
23
24
  def foo : (Integer) -> Integer
24
25
  def bar : (String) -> String
25
26
  end
@@ -11,5 +11,6 @@ smoke/any1.rb:2: [error] undefined method: Integer#undefined_method
11
11
 
12
12
  # Classes
13
13
  class Object
14
+ private
14
15
  def foo : -> untyped
15
16
  end
@@ -12,6 +12,7 @@ bar
12
12
  __END__
13
13
  # Classes
14
14
  class Object
15
+ private
15
16
  def foo : -> untyped
16
17
  def bar : -> Integer
17
18
  end
@@ -11,6 +11,7 @@ smoke/arguments.rb:6: [error] wrong number of arguments (given 2, expected 1)
11
11
 
12
12
  # Classes
13
13
  class Object
14
+ private
14
15
  def foo : (untyped) -> nil
15
16
  def bar : (untyped) -> nil
16
17
  end
@@ -42,6 +42,7 @@ f10 {|n| }
42
42
  __END__
43
43
  # Classes
44
44
  class Object
45
+ private
45
46
  def f1 : -> nil
46
47
  def f2 : (:x, :y, :z) -> nil
47
48
  def f3 : (?String, ?String) -> nil
@@ -10,5 +10,6 @@ log(nil)
10
10
  __END__
11
11
  # Classes
12
12
  class Object
13
+ private
13
14
  def log : ((:sym | Integer | String)?) -> nil
14
15
  end
@@ -11,5 +11,6 @@ foo
11
11
  __END__
12
12
  # Classes
13
13
  class Object
14
+ private
14
15
  def foo : -> ((Integer | String)?)
15
16
  end
@@ -8,5 +8,6 @@ end
8
8
  __END__
9
9
  # Classes
10
10
  class Object
11
- def log : (untyped) -> nil
11
+ private
12
+ def log : (bot) -> nil
12
13
  end
@@ -9,5 +9,6 @@ foo
9
9
  __END__
10
10
  # Classes
11
11
  class Object
12
+ private
12
13
  def foo : -> (Array[Integer | String])
13
14
  end
@@ -12,5 +12,6 @@ foo
12
12
  __END__
13
13
  # Classes
14
14
  class Object
15
+ private
15
16
  def foo : -> (Array[Integer | String])
16
17
  end
@@ -7,5 +7,6 @@ foo([1, 2, 3])
7
7
  __END__
8
8
  # Classes
9
9
  class Object
10
+ private
10
11
  def foo : ([Integer, Integer, Integer]) -> Array[String]
11
12
  end
@@ -6,5 +6,6 @@ foo([1, 2, 3])
6
6
  __END__
7
7
  # Classes
8
8
  class Object
9
+ private
9
10
  def foo : ([Integer, Integer, Integer]) -> (Array[Integer | String])
10
11
  end
@@ -16,6 +16,7 @@ map_bang_test_known_bug([1, 2, 3])
16
16
  __END__
17
17
  # Classes
18
18
  class Object
19
+ private
19
20
  def map_test : ([Integer, Integer, Integer]) -> Array[String]
20
21
  def map_bang_test : ([Integer, Integer, Integer]) -> (Array[Integer | String])
21
22
  def map_bang_test_known_bug : ([Integer, Integer, Integer]) -> [Integer, Integer, Integer]
@@ -12,6 +12,7 @@ bar([1, 2, 3])
12
12
  __END__
13
13
  # Classes
14
14
  class Object
15
+ private
15
16
  def foo : ([Integer, Integer, Integer]) -> Array[Integer]
16
17
  def bar : ([Integer, Integer, Integer]) -> String
17
18
  end
@@ -6,5 +6,6 @@ log([1] + ["str"] + [2] + [:sym])
6
6
  __END__
7
7
  # Classes
8
8
  class Object
9
+ private
9
10
  def log : (Array[:sym | Integer | String]) -> nil
10
11
  end
@@ -7,5 +7,6 @@ foo
7
7
  __END__
8
8
  # Classes
9
9
  class Object
10
+ private
10
11
  def foo : -> (:sym | Integer | String)
11
12
  end
@@ -0,0 +1,71 @@
1
+ def f1(*ary)
2
+ ary[1..3]
3
+ end
4
+
5
+ def f2(*ary)
6
+ ary[1...3]
7
+ end
8
+
9
+ def f3(*ary)
10
+ ary[1..-3]
11
+ end
12
+
13
+ def f4(*ary)
14
+ ary[1...-3]
15
+ end
16
+
17
+ def f5(*ary)
18
+ ary[-4..3]
19
+ end
20
+
21
+ def f6(*ary)
22
+ ary[-4...3]
23
+ end
24
+
25
+ def f7(*ary)
26
+ ary[-4..-3]
27
+ end
28
+
29
+ def f8(*ary)
30
+ ary[-4...-3]
31
+ end
32
+
33
+ def f9(*ary)
34
+ ary[...3]
35
+ end
36
+
37
+ def f10(*ary)
38
+ ary[3..]
39
+ end
40
+
41
+ def dispatch(*ary)
42
+ f1(*ary)
43
+ f2(*ary)
44
+ f3(*ary)
45
+ f4(*ary)
46
+ f5(*ary)
47
+ f6(*ary)
48
+ f7(*ary)
49
+ f8(*ary)
50
+ f9(*ary)
51
+ f10(*ary)
52
+ end
53
+
54
+ dispatch(:a, :b, :c, :d, :e)
55
+
56
+ __END__
57
+ # Classes
58
+ class Object
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])
71
+ end
@@ -8,5 +8,6 @@ foo([1, 2, 3])
8
8
  __END__
9
9
  # Classes
10
10
  class Object
11
+ private
11
12
  def foo : ([Integer, Integer, Integer]) -> (Array[Integer | String])
12
13
  end
@@ -7,5 +7,6 @@ foo
7
7
  __END__
8
8
  # Classes
9
9
  class Object
10
+ private
10
11
  def foo : -> (Array[Integer | String])
11
12
  end
@@ -18,6 +18,7 @@ quux(a[n])
18
18
  __END__
19
19
  # Classes
20
20
  class Object
21
+ private
21
22
  def foo : ([Integer, String]) -> Integer
22
23
  def bar : (Integer) -> nil
23
24
  def baz : (String) -> nil
@@ -10,5 +10,6 @@ foo([:a, :b, :c])
10
10
  __END__
11
11
  # Classes
12
12
  class Object
13
+ private
13
14
  def foo : ([:a, :b, :c]) -> :a
14
15
  end
@@ -9,5 +9,6 @@ array("foo")
9
9
  __END__
10
10
  # Classes
11
11
  class Object
12
- def array : (Array[Integer] | String | {Integer=>Integer}) -> (Array[Integer | String | {Integer=>Integer}])
12
+ private
13
+ def array : (Array[Integer] | Hash[Integer, Integer] | String) -> (Array[Hash[Integer, Integer] | Integer | String])
13
14
  end
@@ -18,6 +18,7 @@ foo
18
18
  __END__
19
19
  # Classes
20
20
  class Object
21
+ private
21
22
  def bar : ([Integer]) -> nil
22
23
  def test_yield : { -> nil } -> nil
23
24
  def foo : -> [Integer]
@@ -23,6 +23,7 @@ end
23
23
  __END__
24
24
  # Classes
25
25
  class Object
26
+ private
26
27
  def tuple_set : -> [:a, :b, :z]
27
28
  def tuple_get : -> :c
28
29
  def seq_set : -> (Array[:a | :b | :c | :z])
@@ -9,5 +9,6 @@ f(:a, :b, :c)
9
9
  __END__
10
10
  # Classes
11
11
  class Object
12
+ private
12
13
  def f : (:a, :b, :c) -> :c
13
14
  end
@@ -21,6 +21,7 @@ log(a)
21
21
  __END__
22
22
  # Classes
23
23
  class Object
24
+ private
24
25
  def foo : -> [[String]]
25
26
  def bar : ([[Integer]]) -> [[String]]
26
27
  def log : ([[Integer]]) -> nil
@@ -10,5 +10,6 @@ foo
10
10
  __END__
11
11
  # Classes
12
12
  class Object
13
+ private
13
14
  def foo : -> [Integer]?
14
15
  end
@@ -9,5 +9,6 @@ foo
9
9
  __END__
10
10
  # Classes
11
11
  class Object
12
+ private
12
13
  def foo : -> [untyped]
13
14
  end
@@ -10,6 +10,7 @@ foo(1, "str")
10
10
  __END__
11
11
  # Classes
12
12
  class Object
13
- ARY : []
14
- def foo : (Integer, String) -> []
13
+ ARY : Array[bot]
14
+ private
15
+ def foo : (Integer, String) -> Array[bot]
15
16
  end
@@ -9,5 +9,6 @@ foo
9
9
  __END__
10
10
  # Classes
11
11
  class Object
12
+ private
12
13
  def foo : -> (Array[Integer | String])
13
14
  end