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
@@ -7,5 +7,6 @@ foo("x", "x")
7
7
  __END__
8
8
  # Classes
9
9
  class Object
10
+ private
10
11
  def foo : (?Integer | String, *String) -> [Array[String]]
11
12
  end
@@ -15,6 +15,7 @@ foo(42)
15
15
  __END__
16
16
  # Classes
17
17
  class Object
18
+ private
18
19
  def bar : (Integer | String) -> (Integer | String)
19
20
  def foo : (Integer | String) -> (Integer | String)
20
21
  end
@@ -9,5 +9,6 @@ foo
9
9
  __END__
10
10
  # Classes
11
11
  class Object
12
+ private
12
13
  def foo : -> Integer
13
14
  end
@@ -11,6 +11,7 @@ log3(1.step(5))
11
11
  __END__
12
12
  # Classes
13
13
  class Object
14
+ private
14
15
  def log1 : (Integer | Numeric) -> nil
15
16
  def log2 : (void) -> nil
16
17
  def log3 : (Enumerator[Integer | Numeric]) -> nil
@@ -7,5 +7,6 @@ foo
7
7
  __END__
8
8
  # Classes
9
9
  class Object
10
+ private
10
11
  def foo : -> Array[Integer]
11
12
  end
@@ -5,9 +5,9 @@ end
5
5
  Foo.new.a = 1
6
6
  __END__
7
7
  # Classes
8
- class (Anonymous Struct) < Struct
8
+ class AnonymousStruct_generated_1 < Struct
9
9
  attr_accessor a() : untyped
10
10
  end
11
11
 
12
- class Foo < (Anonymous Struct)
12
+ class Foo < AnonymousStruct_generated_1
13
13
  end
@@ -14,6 +14,7 @@ foobar.bar = :sym
14
14
  __END__
15
15
  # Classes
16
16
  class Object
17
+ private
17
18
  def gen_foobar : -> FooBar
18
19
  end
19
20
 
@@ -34,6 +34,7 @@ Baz.new.f(A.new)
34
34
  __END__
35
35
  # Classes
36
36
  class Object
37
+ private
37
38
  def log : (Baz) -> nil
38
39
  end
39
40
 
@@ -0,0 +1,43 @@
1
+ module M1
2
+ def f(m); super :M1; end
3
+ end
4
+ module M2
5
+ def f(m); super :M2; end
6
+ end
7
+ class C
8
+ def f(m); end
9
+ end
10
+ class D < C
11
+ def f(m); super :D; end
12
+ include M1
13
+ end
14
+ class E < D
15
+ def f(m); super :E; end
16
+ include M2
17
+ end
18
+
19
+ E.new.f(:top)
20
+
21
+ __END__
22
+ # Classes
23
+ module M1
24
+ def f : (:D) -> nil
25
+ end
26
+
27
+ module M2
28
+ def f : (:E) -> nil
29
+ end
30
+
31
+ class C
32
+ def f : (:M1) -> nil
33
+ end
34
+
35
+ class D < C
36
+ include M1
37
+ def f : (:M2) -> nil
38
+ end
39
+
40
+ class E < D
41
+ include M2
42
+ def f : (:top) -> nil
43
+ end
@@ -0,0 +1,36 @@
1
+ module M
2
+ def f(m); super :M; end
3
+ end
4
+ class C
5
+ def f(m); end
6
+ end
7
+ class D < C
8
+ def f(m); super :D; end
9
+ include M
10
+ end
11
+ class E < D
12
+ def f(m); super :E; end
13
+ include M
14
+ end
15
+
16
+ E.new.f(:top)
17
+
18
+ __END__
19
+ # Classes
20
+ module M
21
+ def f : (:D | :E) -> nil
22
+ end
23
+
24
+ class C
25
+ def f : (:M) -> nil
26
+ end
27
+
28
+ class D < C
29
+ include M
30
+ def f : (:M) -> nil
31
+ end
32
+
33
+ class E < D
34
+ include M
35
+ def f : (:top) -> nil
36
+ end
@@ -8,5 +8,6 @@ foo
8
8
  __END__
9
9
  # Classes
10
10
  class Object
11
+ private
11
12
  def foo : -> [String?, String?]
12
13
  end
@@ -15,6 +15,7 @@ end
15
15
  __END__
16
16
  # Classes
17
17
  class Object
18
+ private
18
19
  def foo : -> Array[String]
19
20
  def bar : -> Array[:foo]
20
21
  end
@@ -12,6 +12,7 @@ foo(1)
12
12
  __END__
13
13
  # Classes
14
14
  class Object
15
+ private
15
16
  def bar : (Integer) -> nil
16
17
  def foo : (Integer) -> Integer
17
18
  end
@@ -8,5 +8,6 @@ foo(x)
8
8
  __END__
9
9
  # Classes
10
10
  class Object
11
+ private
11
12
  def foo : (Integer) -> Integer
12
13
  end
@@ -12,6 +12,7 @@ bar
12
12
  __END__
13
13
  # Classes
14
14
  class Object
15
+ private
15
16
  def foo : -> Array[String]
16
17
  def bar : -> Array[Integer]
17
18
  end
@@ -6,5 +6,6 @@ number?('string')
6
6
  __END__
7
7
  # Classes
8
8
  class Object
9
+ private
9
10
  def number? : (String) -> nil
10
11
  end
@@ -11,5 +11,6 @@ smoke/typed_method.rb:6: [error] undefined method: Object#unknown
11
11
 
12
12
  # Classes
13
13
  class Object
14
+ private
14
15
  def foo : -> Float
15
16
  end
@@ -8,5 +8,6 @@ end
8
8
  __END__
9
9
  # Classes
10
10
  class Object
11
+ private
11
12
  def foo : -> nil
12
13
  end
@@ -21,11 +21,11 @@ end
21
21
  __END__
22
22
  # Classes
23
23
  class SuperBase
24
- def self.foo : -> (A.class | B.class)
24
+ def self.foo : -> (singleton(A) | singleton(B))
25
25
  end
26
26
 
27
27
  class Base < SuperBase
28
- def self.foo : -> (A.class | B.class)
28
+ def self.foo : -> (singleton(A) | singleton(B))
29
29
  end
30
30
 
31
31
  class A < Base
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.5.3
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yusuke Endoh
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-17 00:00:00.000000000 Z
11
+ date: 2020-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbs
@@ -84,6 +84,7 @@ files:
84
84
  - smoke/array-plus1.rb
85
85
  - smoke/array-plus2.rb
86
86
  - smoke/array-pop.rb
87
+ - smoke/array-range-aref.rb
87
88
  - smoke/array-replace.rb
88
89
  - smoke/array-s-aref.rb
89
90
  - smoke/array1.rb
@@ -101,6 +102,7 @@ files:
101
102
  - smoke/array8.rb
102
103
  - smoke/array9.rb
103
104
  - smoke/attr.rb
105
+ - smoke/autoload.rb
104
106
  - smoke/backtrace.rb
105
107
  - smoke/block-ambiguous.rb
106
108
  - smoke/block-args1-rest.rb
@@ -145,6 +147,8 @@ files:
145
147
  - smoke/context-sensitive1.rb
146
148
  - smoke/cvar.rb
147
149
  - smoke/cvar2.rb
150
+ - smoke/define_method.rb
151
+ - smoke/define_method2.rb
148
152
  - smoke/demo.rb
149
153
  - smoke/demo1.rb
150
154
  - smoke/demo10.rb
@@ -201,6 +205,8 @@ files:
201
205
  - smoke/keyword3.rb
202
206
  - smoke/keyword4.rb
203
207
  - smoke/keyword5.rb
208
+ - smoke/kwrest.rb
209
+ - smoke/kwrest.rbs
204
210
  - smoke/kwsplat1.rb
205
211
  - smoke/kwsplat2.rb
206
212
  - smoke/manual-rbs.rb
@@ -213,6 +219,7 @@ files:
213
219
  - smoke/masgn2.rb
214
220
  - smoke/masgn3.rb
215
221
  - smoke/method_in_branch.rb
222
+ - smoke/method_missing.rb
216
223
  - smoke/module1.rb
217
224
  - smoke/module2.rb
218
225
  - smoke/module3.rb
@@ -229,6 +236,7 @@ files:
229
236
  - smoke/optional2.rb
230
237
  - smoke/optional3.rb
231
238
  - smoke/parameterizedd-self.rb
239
+ - smoke/parameterizedd-self2.rb
232
240
  - smoke/pathname1.rb
233
241
  - smoke/pathname2.rb
234
242
  - smoke/pattern-match1.rb
@@ -243,6 +251,8 @@ files:
243
251
  - smoke/rbs-alias.rbs
244
252
  - smoke/rbs-attr.rb
245
253
  - smoke/rbs-attr.rbs
254
+ - smoke/rbs-attr2.rb
255
+ - smoke/rbs-attr2.rbs
246
256
  - smoke/rbs-extend.rb
247
257
  - smoke/rbs-extend.rbs
248
258
  - smoke/rbs-interface.rb
@@ -264,6 +274,10 @@ files:
264
274
  - smoke/rbs-tyvar4.rb
265
275
  - smoke/rbs-tyvar5.rb
266
276
  - smoke/rbs-tyvar5.rbs
277
+ - smoke/rbs-tyvar6.rb
278
+ - smoke/rbs-tyvar6.rbs
279
+ - smoke/rbs-tyvar7.rb
280
+ - smoke/rbs-tyvar7.rbs
267
281
  - smoke/rbs-vars.rb
268
282
  - smoke/rbs-vars.rbs
269
283
  - smoke/redo1.rb
@@ -292,6 +306,8 @@ files:
292
306
  - smoke/super1.rb
293
307
  - smoke/super2.rb
294
308
  - smoke/super3.rb
309
+ - smoke/super4.rb
310
+ - smoke/super5.rb
295
311
  - smoke/svar1.rb
296
312
  - smoke/symbol-proc.rb
297
313
  - smoke/tap1.rb