typeprof 0.15.3 → 0.20.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (366) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/main.yml +1 -1
  3. data/Gemfile.lock +5 -5
  4. data/doc/ide.md +81 -0
  5. data/doc/typeprof-for-ide-log.png +0 -0
  6. data/doc/typeprof-for-ide.png +0 -0
  7. data/exe/typeprof +5 -1
  8. data/lib/typeprof/analyzer.rb +235 -56
  9. data/lib/typeprof/arguments.rb +1 -0
  10. data/lib/typeprof/builtin.rb +23 -23
  11. data/lib/typeprof/cli.rb +23 -5
  12. data/lib/typeprof/code-range.rb +177 -0
  13. data/lib/typeprof/config.rb +41 -20
  14. data/lib/typeprof/container-type.rb +3 -0
  15. data/lib/typeprof/export.rb +191 -15
  16. data/lib/typeprof/import.rb +33 -9
  17. data/lib/typeprof/insns-def.rb +1 -0
  18. data/lib/typeprof/iseq.rb +224 -17
  19. data/lib/typeprof/lsp.rb +884 -0
  20. data/lib/typeprof/method.rb +15 -11
  21. data/lib/typeprof/type.rb +50 -42
  22. data/lib/typeprof/utils.rb +18 -1
  23. data/lib/typeprof/version.rb +1 -1
  24. data/lib/typeprof.rb +3 -5
  25. data/typeprof-lsp +3 -0
  26. data/typeprof.gemspec +2 -2
  27. data/vscode/.gitignore +5 -0
  28. data/vscode/.vscode/launch.json +16 -0
  29. data/vscode/.vscodeignore +7 -0
  30. data/vscode/README.md +22 -0
  31. data/vscode/development.md +31 -0
  32. data/vscode/package-lock.json +3249 -0
  33. data/vscode/package.json +71 -0
  34. data/vscode/sandbox/test.rb +24 -0
  35. data/vscode/src/extension.ts +299 -0
  36. data/vscode/tsconfig.json +15 -0
  37. metadata +21 -334
  38. data/smoke/alias.rb +0 -31
  39. data/smoke/alias2.rb +0 -21
  40. data/smoke/any-cbase.rb +0 -5
  41. data/smoke/any1.rb +0 -16
  42. data/smoke/any2.rb +0 -18
  43. data/smoke/arguments.rb +0 -17
  44. data/smoke/arguments2.rb +0 -56
  45. data/smoke/array-each.rb +0 -15
  46. data/smoke/array-each2.rb +0 -16
  47. data/smoke/array-each3.rb +0 -13
  48. data/smoke/array-ltlt.rb +0 -14
  49. data/smoke/array-ltlt2.rb +0 -17
  50. data/smoke/array-map.rb +0 -12
  51. data/smoke/array-map2.rb +0 -11
  52. data/smoke/array-map3.rb +0 -23
  53. data/smoke/array-mul.rb +0 -18
  54. data/smoke/array-plus1.rb +0 -11
  55. data/smoke/array-plus2.rb +0 -16
  56. data/smoke/array-pop.rb +0 -12
  57. data/smoke/array-range-aref.rb +0 -71
  58. data/smoke/array-replace.rb +0 -13
  59. data/smoke/array-s-aref.rb +0 -12
  60. data/smoke/array1.rb +0 -27
  61. data/smoke/array10.rb +0 -15
  62. data/smoke/array11.rb +0 -14
  63. data/smoke/array12.rb +0 -25
  64. data/smoke/array13.rb +0 -31
  65. data/smoke/array14.rb +0 -14
  66. data/smoke/array15.rb +0 -16
  67. data/smoke/array2.rb +0 -28
  68. data/smoke/array3.rb +0 -26
  69. data/smoke/array4.rb +0 -15
  70. data/smoke/array5.rb +0 -14
  71. data/smoke/array6.rb +0 -17
  72. data/smoke/array7.rb +0 -14
  73. data/smoke/array8.rb +0 -13
  74. data/smoke/array9.rb +0 -13
  75. data/smoke/attr-module.rb +0 -24
  76. data/smoke/attr-vis.rb +0 -43
  77. data/smoke/attr-vis.rbs +0 -4
  78. data/smoke/attr.rb +0 -28
  79. data/smoke/autoload.rb +0 -14
  80. data/smoke/backtrace.rb +0 -33
  81. data/smoke/block-ambiguous.rb +0 -37
  82. data/smoke/block-args1-rest.rb +0 -64
  83. data/smoke/block-args1.rb +0 -60
  84. data/smoke/block-args2-rest.rb +0 -64
  85. data/smoke/block-args2.rb +0 -60
  86. data/smoke/block-args3-rest.rb +0 -75
  87. data/smoke/block-args3.rb +0 -71
  88. data/smoke/block-blockarg.rb +0 -28
  89. data/smoke/block-kwarg.rb +0 -53
  90. data/smoke/block1.rb +0 -23
  91. data/smoke/block10.rb +0 -15
  92. data/smoke/block11.rb +0 -40
  93. data/smoke/block12.rb +0 -23
  94. data/smoke/block13.rb +0 -9
  95. data/smoke/block13.rbs +0 -3
  96. data/smoke/block14.rb +0 -18
  97. data/smoke/block2.rb +0 -15
  98. data/smoke/block3.rb +0 -38
  99. data/smoke/block4.rb +0 -19
  100. data/smoke/block5.rb +0 -21
  101. data/smoke/block6.rb +0 -21
  102. data/smoke/block7.rb +0 -19
  103. data/smoke/block8.rb +0 -28
  104. data/smoke/block9.rb +0 -13
  105. data/smoke/block_given.rb +0 -37
  106. data/smoke/blown.rb +0 -13
  107. data/smoke/break1.rb +0 -19
  108. data/smoke/break2.rb +0 -16
  109. data/smoke/break3.rb +0 -13
  110. data/smoke/break4.rb +0 -17
  111. data/smoke/case.rb +0 -17
  112. data/smoke/case2.rb +0 -18
  113. data/smoke/case3.rb +0 -17
  114. data/smoke/class-hierarchy.rb +0 -54
  115. data/smoke/class-hierarchy2.rb +0 -27
  116. data/smoke/class-new.rb +0 -15
  117. data/smoke/class.rb +0 -7
  118. data/smoke/class_eval.rb +0 -22
  119. data/smoke/class_instance_var.rb +0 -9
  120. data/smoke/class_method.rb +0 -25
  121. data/smoke/class_method2.rb +0 -21
  122. data/smoke/class_method3.rb +0 -29
  123. data/smoke/constant1.rb +0 -46
  124. data/smoke/constant2.rb +0 -36
  125. data/smoke/constant3.rb +0 -10
  126. data/smoke/constant4.rb +0 -12
  127. data/smoke/context-sensitive1.rb +0 -13
  128. data/smoke/cvar.rb +0 -31
  129. data/smoke/cvar2.rb +0 -17
  130. data/smoke/define_method.rb +0 -16
  131. data/smoke/define_method2.rb +0 -18
  132. data/smoke/define_method3.rb +0 -14
  133. data/smoke/define_method3.rbs +0 -3
  134. data/smoke/define_method4.rb +0 -15
  135. data/smoke/define_method4.rbs +0 -3
  136. data/smoke/define_method5.rb +0 -12
  137. data/smoke/define_method6.rb +0 -19
  138. data/smoke/define_method7.rb +0 -18
  139. data/smoke/demo.rb +0 -81
  140. data/smoke/demo1.rb +0 -17
  141. data/smoke/demo10.rb +0 -21
  142. data/smoke/demo11.rb +0 -12
  143. data/smoke/demo2.rb +0 -15
  144. data/smoke/demo3.rb +0 -17
  145. data/smoke/demo4.rb +0 -27
  146. data/smoke/demo5.rb +0 -16
  147. data/smoke/demo6.rb +0 -22
  148. data/smoke/demo7.rb +0 -15
  149. data/smoke/demo8.rb +0 -19
  150. data/smoke/demo9.rb +0 -18
  151. data/smoke/dummy-execution1.rb +0 -15
  152. data/smoke/dummy-execution2.rb +0 -16
  153. data/smoke/dummy_element.rb +0 -14
  154. data/smoke/ensure1.rb +0 -21
  155. data/smoke/enum_for.rb +0 -15
  156. data/smoke/enum_for2.rb +0 -17
  157. data/smoke/enumerator.rb +0 -16
  158. data/smoke/expandarray1.rb +0 -23
  159. data/smoke/expandarray2.rb +0 -24
  160. data/smoke/extended.rb +0 -38
  161. data/smoke/fib.rb +0 -28
  162. data/smoke/flip-flop.rb +0 -28
  163. data/smoke/flow1.rb +0 -17
  164. data/smoke/flow10.rb +0 -17
  165. data/smoke/flow11.rb +0 -17
  166. data/smoke/flow2.rb +0 -15
  167. data/smoke/flow3.rb +0 -15
  168. data/smoke/flow4.rb +0 -5
  169. data/smoke/flow5.rb +0 -20
  170. data/smoke/flow6.rb +0 -20
  171. data/smoke/flow7.rb +0 -21
  172. data/smoke/flow8.rb +0 -14
  173. data/smoke/flow9.rb +0 -12
  174. data/smoke/for.rb +0 -9
  175. data/smoke/freeze.rb +0 -12
  176. data/smoke/function.rb +0 -17
  177. data/smoke/gvar.rb +0 -14
  178. data/smoke/gvar2.rb +0 -15
  179. data/smoke/gvar2.rbs +0 -1
  180. data/smoke/hash-bot.rb +0 -12
  181. data/smoke/hash-fetch.rb +0 -28
  182. data/smoke/hash-merge-bang.rb +0 -12
  183. data/smoke/hash1.rb +0 -20
  184. data/smoke/hash2.rb +0 -13
  185. data/smoke/hash3.rb +0 -14
  186. data/smoke/hash4.rb +0 -11
  187. data/smoke/hash5.rb +0 -14
  188. data/smoke/huge_union.rb +0 -86
  189. data/smoke/identifier_keywords.rb +0 -17
  190. data/smoke/included.rb +0 -38
  191. data/smoke/inheritance.rb +0 -34
  192. data/smoke/inheritance2.rb +0 -35
  193. data/smoke/inherited.rb +0 -26
  194. data/smoke/initialize.rb +0 -28
  195. data/smoke/instance_eval.rb +0 -18
  196. data/smoke/instance_eval2.rb +0 -10
  197. data/smoke/instance_eval3.rb +0 -25
  198. data/smoke/instance_eval4.rb +0 -12
  199. data/smoke/int_times.rb +0 -15
  200. data/smoke/integer.rb +0 -11
  201. data/smoke/ivar.rb +0 -31
  202. data/smoke/ivar2.rb +0 -30
  203. data/smoke/ivar3.rb +0 -17
  204. data/smoke/ivar3.rbs +0 -3
  205. data/smoke/ivar4.rb +0 -21
  206. data/smoke/kernel-class.rb +0 -13
  207. data/smoke/keyword1.rb +0 -12
  208. data/smoke/keyword2.rb +0 -12
  209. data/smoke/keyword3.rb +0 -12
  210. data/smoke/keyword4.rb +0 -12
  211. data/smoke/keyword5.rb +0 -16
  212. data/smoke/kwrest.rb +0 -13
  213. data/smoke/kwrest.rbs +0 -3
  214. data/smoke/kwsplat1.rb +0 -43
  215. data/smoke/kwsplat2.rb +0 -13
  216. data/smoke/lit-complex.rb +0 -10
  217. data/smoke/lit-encoding.rb +0 -10
  218. data/smoke/manual-rbs.rb +0 -29
  219. data/smoke/manual-rbs.rbs +0 -3
  220. data/smoke/manual-rbs2.rb +0 -21
  221. data/smoke/manual-rbs2.rbs +0 -8
  222. data/smoke/manual-rbs3.rb +0 -13
  223. data/smoke/manual-rbs3.rbs +0 -3
  224. data/smoke/masgn1.rb +0 -14
  225. data/smoke/masgn2.rb +0 -18
  226. data/smoke/masgn3.rb +0 -13
  227. data/smoke/method_in_branch.rb +0 -23
  228. data/smoke/method_missing.rb +0 -29
  229. data/smoke/module1.rb +0 -29
  230. data/smoke/module2.rb +0 -28
  231. data/smoke/module3.rb +0 -33
  232. data/smoke/module4.rb +0 -35
  233. data/smoke/module5.rb +0 -17
  234. data/smoke/module6.rb +0 -40
  235. data/smoke/module_function1.rb +0 -29
  236. data/smoke/module_function2.rb +0 -29
  237. data/smoke/multiple-include.rb +0 -15
  238. data/smoke/multiple-superclass.rb +0 -28
  239. data/smoke/next1.rb +0 -21
  240. data/smoke/next2.rb +0 -17
  241. data/smoke/noname.rb +0 -9
  242. data/smoke/object-send1.rb +0 -23
  243. data/smoke/object-send2.rb +0 -10
  244. data/smoke/object-send3.rb +0 -18
  245. data/smoke/once.rb +0 -13
  246. data/smoke/optional1.rb +0 -14
  247. data/smoke/optional2.rb +0 -16
  248. data/smoke/optional3.rb +0 -11
  249. data/smoke/or_raise.rb +0 -18
  250. data/smoke/parameterizedd-self.rb +0 -20
  251. data/smoke/parameterizedd-self2.rb +0 -15
  252. data/smoke/pathname1.rb +0 -14
  253. data/smoke/pathname2.rb +0 -14
  254. data/smoke/pattern-match1.rb +0 -19
  255. data/smoke/pattern-match2.rb +0 -16
  256. data/smoke/prepend1.rb +0 -33
  257. data/smoke/prepend2.rb +0 -10
  258. data/smoke/prepend2.rbs +0 -9
  259. data/smoke/primitive_method.rb +0 -19
  260. data/smoke/printf.rb +0 -20
  261. data/smoke/proc.rb +0 -20
  262. data/smoke/proc2.rb +0 -17
  263. data/smoke/proc3.rb +0 -15
  264. data/smoke/proc4.rb +0 -12
  265. data/smoke/proc5.rb +0 -19
  266. data/smoke/proc6.rb +0 -13
  267. data/smoke/proc7.rb +0 -32
  268. data/smoke/public.rb +0 -38
  269. data/smoke/range.rb +0 -14
  270. data/smoke/rbs-alias.rb +0 -10
  271. data/smoke/rbs-alias.rbs +0 -4
  272. data/smoke/rbs-attr.rb +0 -27
  273. data/smoke/rbs-attr.rbs +0 -5
  274. data/smoke/rbs-attr2.rb +0 -11
  275. data/smoke/rbs-attr2.rbs +0 -3
  276. data/smoke/rbs-extend.rb +0 -10
  277. data/smoke/rbs-extend.rbs +0 -7
  278. data/smoke/rbs-interface.rb +0 -25
  279. data/smoke/rbs-interface.rbs +0 -12
  280. data/smoke/rbs-module.rb +0 -26
  281. data/smoke/rbs-module.rbs +0 -4
  282. data/smoke/rbs-opt-and-rest.rb +0 -10
  283. data/smoke/rbs-opt-and-rest.rbs +0 -3
  284. data/smoke/rbs-proc1.rb +0 -10
  285. data/smoke/rbs-proc1.rbs +0 -3
  286. data/smoke/rbs-proc2.rb +0 -21
  287. data/smoke/rbs-proc2.rbs +0 -3
  288. data/smoke/rbs-proc3.rb +0 -14
  289. data/smoke/rbs-proc3.rbs +0 -4
  290. data/smoke/rbs-record.rb +0 -18
  291. data/smoke/rbs-record.rbs +0 -4
  292. data/smoke/rbs-tyvar.rb +0 -19
  293. data/smoke/rbs-tyvar.rbs +0 -5
  294. data/smoke/rbs-tyvar2.rb +0 -21
  295. data/smoke/rbs-tyvar2.rbs +0 -9
  296. data/smoke/rbs-tyvar3.rb +0 -18
  297. data/smoke/rbs-tyvar3.rbs +0 -5
  298. data/smoke/rbs-tyvar4.rb +0 -37
  299. data/smoke/rbs-tyvar5.rb +0 -13
  300. data/smoke/rbs-tyvar5.rbs +0 -8
  301. data/smoke/rbs-tyvar6.rb +0 -18
  302. data/smoke/rbs-tyvar6.rbs +0 -12
  303. data/smoke/rbs-tyvar7.rb +0 -12
  304. data/smoke/rbs-tyvar7.rbs +0 -7
  305. data/smoke/rbs-vars.rb +0 -35
  306. data/smoke/rbs-vars.rbs +0 -7
  307. data/smoke/redo1.rb +0 -22
  308. data/smoke/redo2.rb +0 -23
  309. data/smoke/req-keyword.rb +0 -13
  310. data/smoke/require1.rb +0 -13
  311. data/smoke/require2.rb +0 -13
  312. data/smoke/rescue1.rb +0 -21
  313. data/smoke/rescue2.rb +0 -23
  314. data/smoke/rescue3.rb +0 -20
  315. data/smoke/rescue4.rb +0 -17
  316. data/smoke/respond_to.rb +0 -23
  317. data/smoke/rest-farg.rb +0 -11
  318. data/smoke/rest1.rb +0 -26
  319. data/smoke/rest2.rb +0 -31
  320. data/smoke/rest3.rb +0 -37
  321. data/smoke/rest4.rb +0 -19
  322. data/smoke/rest5.rb +0 -11
  323. data/smoke/rest6.rb +0 -12
  324. data/smoke/retry1.rb +0 -21
  325. data/smoke/return.rb +0 -14
  326. data/smoke/reveal.rb +0 -13
  327. data/smoke/simple.rb +0 -12
  328. data/smoke/singleton_class.rb +0 -8
  329. data/smoke/singleton_method.rb +0 -12
  330. data/smoke/step.rb +0 -18
  331. data/smoke/string-split.rb +0 -12
  332. data/smoke/struct-keyword_init.rb +0 -10
  333. data/smoke/struct.rb +0 -13
  334. data/smoke/struct2.rb +0 -25
  335. data/smoke/struct3.rb +0 -14
  336. data/smoke/struct4.rb +0 -7
  337. data/smoke/struct5.rb +0 -16
  338. data/smoke/struct6.rb +0 -15
  339. data/smoke/struct7.rb +0 -17
  340. data/smoke/stub-keyword.rb +0 -10
  341. data/smoke/super1.rb +0 -69
  342. data/smoke/super2.rb +0 -16
  343. data/smoke/super3.rb +0 -20
  344. data/smoke/super4.rb +0 -45
  345. data/smoke/super5.rb +0 -38
  346. data/smoke/svar1.rb +0 -13
  347. data/smoke/symbol-proc-attr.rb +0 -22
  348. data/smoke/symbol-proc-attr2.rb +0 -15
  349. data/smoke/symbol-proc-bot.rb +0 -13
  350. data/smoke/symbol-proc.rb +0 -25
  351. data/smoke/tap1.rb +0 -18
  352. data/smoke/toplevel.rb +0 -13
  353. data/smoke/two-map.rb +0 -18
  354. data/smoke/type_var.rb +0 -11
  355. data/smoke/typed_method.rb +0 -16
  356. data/smoke/uninitialize-var.rb +0 -13
  357. data/smoke/union-recv.rb +0 -35
  358. data/smoke/user-demo.rb +0 -15
  359. data/smoke/wrong-extend.rb +0 -27
  360. data/smoke/wrong-include.rb +0 -27
  361. data/smoke/wrong-include2.rb +0 -17
  362. data/smoke/wrong-rbs.rb +0 -15
  363. data/smoke/wrong-rbs.rbs +0 -7
  364. data/testbed/ao.rb +0 -297
  365. data/testbed/diff-lcs-entrypoint.rb +0 -4
  366. data/testbed/goodcheck-Gemfile.lock +0 -51
data/smoke/public.rb DELETED
@@ -1,38 +0,0 @@
1
- class Foo
2
- def foo
3
- end
4
-
5
- private
6
-
7
- def bar
8
- end
9
-
10
- public
11
-
12
- def baz
13
- end
14
-
15
- private def qux
16
- end
17
-
18
- def corge
19
- end
20
- end
21
-
22
- __END__
23
- # Classes
24
- class Foo
25
- def foo: -> nil
26
-
27
- private
28
- def bar: -> nil
29
-
30
- public
31
- def baz: -> nil
32
-
33
- private
34
- def qux: -> nil
35
-
36
- public
37
- def corge: -> nil
38
- end
data/smoke/range.rb DELETED
@@ -1,14 +0,0 @@
1
- # dummy implementation
2
-
3
- def foo(x, y)
4
- (x..y)
5
- end
6
-
7
- foo(1, 2)
8
-
9
- __END__
10
- # Classes
11
- class Object
12
- private
13
- def foo: (Integer x, Integer y) -> Range
14
- end
data/smoke/rbs-alias.rb DELETED
@@ -1,10 +0,0 @@
1
- def log
2
- Foo.new.bar
3
- end
4
-
5
- __END__
6
- # Classes
7
- class Object
8
- private
9
- def log: -> Integer
10
- end
data/smoke/rbs-alias.rbs DELETED
@@ -1,4 +0,0 @@
1
- class Foo
2
- def foo: -> Integer
3
- alias bar foo
4
- end
data/smoke/rbs-attr.rb DELETED
@@ -1,27 +0,0 @@
1
- def read_test_1
2
- Foo.new.reader_example
3
- end
4
-
5
- def read_test_2
6
- Foo.new.accessor_example
7
- end
8
-
9
- def write_test
10
- Foo.new.writer_example = 1
11
- Foo.new.writer_example = "str"
12
- Foo.new.accessor_example = 1
13
- Foo.new.accessor_example = "str"
14
- end
15
-
16
- __END__
17
- # Errors
18
- smoke/rbs-attr.rb:11: [warning] inconsistent assignment to RBS-declared variable
19
- smoke/rbs-attr.rb:13: [warning] inconsistent assignment to RBS-declared variable
20
-
21
- # Classes
22
- class Object
23
- private
24
- def read_test_1: -> Integer
25
- def read_test_2: -> Integer
26
- def write_test: -> String
27
- end
data/smoke/rbs-attr.rbs DELETED
@@ -1,5 +0,0 @@
1
- class Foo
2
- attr_reader reader_example: Integer
3
- attr_writer writer_example: Integer
4
- attr_accessor accessor_example: Integer
5
- end
data/smoke/rbs-attr2.rb DELETED
@@ -1,11 +0,0 @@
1
- class Foo
2
- def foo
3
- @name
4
- end
5
- end
6
-
7
- __END__
8
- # Classes
9
- class Foo
10
- def foo: -> String
11
- end
data/smoke/rbs-attr2.rbs DELETED
@@ -1,3 +0,0 @@
1
- class Foo
2
- attr_reader name: String
3
- end
data/smoke/rbs-extend.rb DELETED
@@ -1,10 +0,0 @@
1
- def log
2
- C.foo
3
- end
4
-
5
- __END__
6
- # Classes
7
- class Object
8
- private
9
- def log: -> Integer
10
- end
data/smoke/rbs-extend.rbs DELETED
@@ -1,7 +0,0 @@
1
- module M
2
- def foo: -> Integer
3
- end
4
-
5
- class C
6
- extend M
7
- end
@@ -1,25 +0,0 @@
1
- def get_module
2
- C.new.get_module
3
- end
4
-
5
- def get_module_foo
6
- C.new.get_module.foo
7
- end
8
-
9
- def get_interface
10
- C.new.get_interface
11
- end
12
-
13
- def get_interface_foo
14
- C.new.get_interface.foo
15
- end
16
-
17
- __END__
18
- # Classes
19
- class Object
20
- private
21
- def get_module: -> M
22
- def get_module_foo: -> Integer
23
- def get_interface: -> _I
24
- def get_interface_foo: -> Integer
25
- end
@@ -1,12 +0,0 @@
1
- module M
2
- def foo: -> Integer
3
- end
4
-
5
- interface _I
6
- def foo: -> Integer
7
- end
8
-
9
- class C
10
- def get_module : -> M
11
- def get_interface : -> _I
12
- end
data/smoke/rbs-module.rb DELETED
@@ -1,26 +0,0 @@
1
- module Foo
2
- class << self
3
- def foo
4
- end
5
-
6
- def foo2
7
- foo
8
- end
9
- end
10
-
11
- def bar
12
- end
13
-
14
- def bar2
15
- bar
16
- end
17
- end
18
-
19
- __END__
20
- # Classes
21
- module Foo
22
- # def self.foo: -> Integer
23
- # def bar: -> Integer
24
- def self.foo2: -> Integer
25
- def bar2: -> Integer
26
- end
data/smoke/rbs-module.rbs DELETED
@@ -1,4 +0,0 @@
1
- module Foo
2
- def self.foo: -> Integer
3
- def bar: -> Integer
4
- end
@@ -1,10 +0,0 @@
1
- def foo
2
- Foo.foo
3
- end
4
-
5
- __END__
6
- # Classes
7
- class Object
8
- private
9
- def foo: -> void
10
- end
@@ -1,3 +0,0 @@
1
- module Foo
2
- def self.foo: (?Integer, *String) -> void
3
- end
data/smoke/rbs-proc1.rb DELETED
@@ -1,10 +0,0 @@
1
- def log
2
- Foo.new.foo.call(42)
3
- end
4
-
5
- __END__
6
- # Classes
7
- class Object
8
- private
9
- def log: -> Integer
10
- end
data/smoke/rbs-proc1.rbs DELETED
@@ -1,3 +0,0 @@
1
- class Foo
2
- def foo: -> ^(Integer) -> Integer
3
- end
data/smoke/rbs-proc2.rb DELETED
@@ -1,21 +0,0 @@
1
- # two issues:
2
- # (1) TypedProc should call `-> n { log1(n) }` with an Integer, but not implemented yet
3
- # (2) log1 returns a String, which is inconsistent and should be reported
4
-
5
- def log1(n)
6
- n.to_s # XXX: should be reported as "inconsistent with RBS"
7
- end
8
-
9
- def log2
10
- Foo.new.foo(-> n { log1(n) })
11
- end
12
-
13
- log2
14
-
15
- __END__
16
- # Classes
17
- class Object
18
- private
19
- def log1: (untyped n) -> untyped
20
- def log2: -> String
21
- end
data/smoke/rbs-proc2.rbs DELETED
@@ -1,3 +0,0 @@
1
- class Foo
2
- def foo: (^(Integer) -> Integer) -> String
3
- end
data/smoke/rbs-proc3.rb DELETED
@@ -1,14 +0,0 @@
1
- def log(foo)
2
- foo.get.call
3
- end
4
-
5
- foo = Foo.new
6
- foo.set(1)
7
- log(foo)
8
-
9
- __END__
10
- # Classes
11
- class Object
12
- private
13
- def log: (Foo[Integer] foo) -> Integer
14
- end
data/smoke/rbs-proc3.rbs DELETED
@@ -1,4 +0,0 @@
1
- class Foo[X]
2
- def set: (X) -> void
3
- def get: -> ^() -> X
4
- end
data/smoke/rbs-record.rb DELETED
@@ -1,18 +0,0 @@
1
- def test_foo
2
- h = C.new.foo
3
- return h[:aaa], h[:bbb]
4
- end
5
-
6
- def test_bar
7
- h = { }
8
- h[:a] = 42
9
- C.new.bar(h)
10
- end
11
-
12
- __END__
13
- # Classes
14
- class Object
15
- private
16
- def test_foo: -> [Integer, String]
17
- def test_bar: -> Integer
18
- end
data/smoke/rbs-record.rbs DELETED
@@ -1,4 +0,0 @@
1
- class C
2
- def foo: -> { aaa: Integer, bbb: String }
3
- def bar: ({ a: Integer }) -> Integer
4
- end
data/smoke/rbs-tyvar.rb DELETED
@@ -1,19 +0,0 @@
1
- def foo
2
- cell = Cell.new("str")
3
- cell.set_elem(42) if rand < 0.5
4
- cell
5
- end
6
-
7
- def bar
8
- foo.get_elem
9
- end
10
-
11
- bar
12
-
13
- __END__
14
- # Classes
15
- class Object
16
- private
17
- def foo: -> (Cell[Integer | String])
18
- def bar: -> (Integer | String)
19
- end
data/smoke/rbs-tyvar.rbs DELETED
@@ -1,5 +0,0 @@
1
- class Cell[T]
2
- def initialize : (T) -> void
3
- def set_elem : (T) -> void
4
- def get_elem : -> T
5
- end
data/smoke/rbs-tyvar2.rb DELETED
@@ -1,21 +0,0 @@
1
- def foo
2
- cell = Cell.new(:a1, :b1, :c1)
3
- cell.set_a(:a2)
4
- cell.set_b(:b2)
5
- cell.set_c(:c2)
6
- cell
7
- end
8
-
9
- def bar
10
- foo.get_b
11
- end
12
-
13
- bar
14
-
15
- __END__
16
- # Classes
17
- class Object
18
- private
19
- def foo: -> (Cell[:a1 | :a2, :b1 | :b2, :c1 | :c2])
20
- def bar: -> (:b1 | :b2)
21
- end
data/smoke/rbs-tyvar2.rbs DELETED
@@ -1,9 +0,0 @@
1
- class Cell[A, B, C]
2
- def initialize : (A, B, C) -> void
3
- def set_a : (A) -> void
4
- def set_b : (B) -> void
5
- def set_c : (C) -> void
6
- def get_a : -> A
7
- def get_b : -> B
8
- def get_c : -> C
9
- end
data/smoke/rbs-tyvar3.rb DELETED
@@ -1,18 +0,0 @@
1
- def foo
2
- cell = Cell.new(42)
3
- cell.map {|s| (s + 1).to_s }
4
- end
5
-
6
- def bar
7
- cell = Cell.new(42)
8
- cell.map! {|s| (s + 1).to_s }
9
- cell
10
- end
11
-
12
- __END__
13
- # Classes
14
- class Object
15
- private
16
- def foo: -> Cell[String]
17
- def bar: -> (Cell[Integer | String])
18
- end
data/smoke/rbs-tyvar3.rbs DELETED
@@ -1,5 +0,0 @@
1
- class Cell[T]
2
- def initialize : (T) -> void
3
- def map: [A] { (T) -> A } -> Cell[A]
4
- def map!: { (T) -> T } -> self
5
- end
data/smoke/rbs-tyvar4.rb DELETED
@@ -1,37 +0,0 @@
1
- # This code is created by simplifying matrix.rb.
2
- # The issue occurs when `Array.new` creates a cell-type container,
3
- # so this test will be obsolete, but keep it just for case of regression.
4
- #
5
- # https://github.com/ruby/typeprof/issues/14
6
-
7
- class Foo
8
- def initialize(ivar)
9
- @ivar = ivar
10
- end
11
-
12
- def foo(n)
13
- @ivar.each_with_index { }
14
- nil
15
- end
16
- end
17
-
18
- Foo.new([])
19
-
20
- rows = Array.new(1) do |i|
21
- Array.new(1) do |j|
22
- "str"
23
- end
24
- end
25
- obj = Foo.new(rows)
26
-
27
- obj.foo(:a)
28
- obj.foo(:b)
29
-
30
- __END__
31
- # Classes
32
- class Foo
33
- @ivar: Array[Array[String]]
34
-
35
- def initialize: (Array[Array[String]] ivar) -> void
36
- def foo: (:a | :b n) -> nil
37
- end
data/smoke/rbs-tyvar5.rb DELETED
@@ -1,13 +0,0 @@
1
- def foo
2
- cell = Cell.new
3
- cell.set { Foo.new(:a, :b) }
4
- cell.dummy { }
5
- cell
6
- end
7
-
8
- __END__
9
- # Classes
10
- class Object
11
- private
12
- def foo: -> Cell[Foo[:a, :b]]
13
- end
data/smoke/rbs-tyvar5.rbs DELETED
@@ -1,8 +0,0 @@
1
- class Cell[X]
2
- def set: { -> X } -> self
3
- def dummy: { -> void } -> self
4
- end
5
-
6
- class Foo[X, Y]
7
- def initialize: (X, Y) -> void
8
- end
data/smoke/rbs-tyvar6.rb DELETED
@@ -1,18 +0,0 @@
1
- def log1(obj) end
2
- def log2(obj) end
3
- def log3(obj) end
4
-
5
- obj = Bar.new("str")
6
-
7
- log1(obj)
8
- log2(obj.test_superclass)
9
- log3(obj.test_module)
10
-
11
- __END__
12
- # Classes
13
- class Object
14
- private
15
- def log1: (Bar[String] obj) -> nil
16
- def log2: (Array[String] obj) -> nil
17
- def log3: (Integer obj) -> nil
18
- end
data/smoke/rbs-tyvar6.rbs DELETED
@@ -1,12 +0,0 @@
1
- class Foo[X]
2
- def test_superclass: -> X
3
- end
4
-
5
- module M[X]
6
- def test_module: -> X
7
- end
8
-
9
- class Bar[X] < Foo[Array[X]]
10
- def initialize: (X) -> void
11
- include M[Integer]
12
- end
data/smoke/rbs-tyvar7.rb DELETED
@@ -1,12 +0,0 @@
1
- def foo
2
- bar = Bar.new(1)
3
- bar.set(["str"]) # TODO: This should update Bar[Integer] to Bar[Integer | String]
4
- bar
5
- end
6
-
7
- __END__
8
- # Classes
9
- class Object
10
- private
11
- def foo: -> Bar[Integer]
12
- end
data/smoke/rbs-tyvar7.rbs DELETED
@@ -1,7 +0,0 @@
1
- class Foo[X]
2
- def set: (X) -> void
3
- end
4
-
5
- class Bar[X] < Foo[Integer]
6
- def initialize: (X) -> void
7
- end
data/smoke/rbs-vars.rb DELETED
@@ -1,35 +0,0 @@
1
- def gvar_test
2
- $gvar
3
- end
4
-
5
- class Foo
6
- def const_test
7
- CONST
8
- end
9
-
10
- def ivar_test
11
- @ivar
12
- end
13
-
14
- def cvar_test
15
- @@cvar
16
- end
17
-
18
- def self.cvar_test2
19
- @@cvar
20
- end
21
- end
22
-
23
- __END__
24
- # Classes
25
- class Object
26
- private
27
- def gvar_test: -> :gvar_example
28
- end
29
-
30
- class Foo
31
- def const_test: -> :const_example
32
- def ivar_test: -> :ivar_example
33
- def cvar_test: -> :cvar_example
34
- def self.cvar_test2: -> :cvar_example
35
- end
data/smoke/rbs-vars.rbs DELETED
@@ -1,7 +0,0 @@
1
- $gvar: :gvar_example
2
-
3
- class Foo
4
- CONST: :const_example
5
- @ivar: :ivar_example
6
- @@cvar: :cvar_example
7
- end
data/smoke/redo1.rb DELETED
@@ -1,22 +0,0 @@
1
- def bar(x)
2
- x
3
- end
4
-
5
- def foo
6
- yield 42
7
- end
8
-
9
- foo do |x|
10
- bar(x)
11
- x = "str"
12
- redo if rand < 0.5
13
- x
14
- end
15
-
16
- __END__
17
- # Classes
18
- class Object
19
- private
20
- def bar: (Integer | String x) -> (Integer | String)
21
- def foo: { (Integer) -> String } -> String
22
- end
data/smoke/redo2.rb DELETED
@@ -1,23 +0,0 @@
1
- def bar(x)
2
- x
3
- end
4
-
5
- def foo
6
- yield 42
7
- end
8
-
9
- foo do |x|
10
- bar(x)
11
- rescue
12
- x = "str"
13
- redo if rand < 0.5
14
- 42
15
- end
16
-
17
- __END__
18
- # Classes
19
- class Object
20
- private
21
- def bar: (Integer | String x) -> (Integer | String)
22
- def foo: { (Integer) -> (Integer | String) } -> (Integer | String)
23
- end
data/smoke/req-keyword.rb DELETED
@@ -1,13 +0,0 @@
1
- def foo(a:)
2
- foo(a: a + 1) if rand < 0.5
3
- a
4
- end
5
-
6
- foo(a:1)
7
-
8
- __END__
9
- # Classes
10
- class Object
11
- private
12
- def foo: (a: Integer) -> Integer
13
- end
data/smoke/require1.rb DELETED
@@ -1,13 +0,0 @@
1
- require_relative "require2"
2
-
3
- class Foo
4
- def foo
5
- end
6
- end
7
-
8
- __END__
9
- # Classes
10
- class Foo
11
- def bar: -> nil
12
- def foo: -> nil
13
- end
data/smoke/require2.rb DELETED
@@ -1,13 +0,0 @@
1
- require_relative "require1"
2
-
3
- class Foo
4
- def bar
5
- end
6
- end
7
-
8
- __END__
9
- # Classes
10
- class Foo
11
- def foo: -> nil
12
- def bar: -> nil
13
- end
data/smoke/rescue1.rb DELETED
@@ -1,21 +0,0 @@
1
- def foo(x)
2
- 42
3
- end
4
-
5
- def bar
6
- x = 1
7
- x = "str"
8
- x = :sym
9
- rescue
10
- foo(x)
11
- end
12
-
13
- bar
14
-
15
- __END__
16
- # Classes
17
- class Object
18
- private
19
- def foo: ((:sym | Integer | String)? x) -> Integer
20
- def bar: -> (:sym | Integer)
21
- end