typed.rb 0.0.11

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 (173) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +26 -0
  3. data/bin/typed.rb +110 -0
  4. data/lib/typed/language.rb +131 -0
  5. data/lib/typed/model/tm_abs.rb +104 -0
  6. data/lib/typed/model/tm_array_literal.rb +25 -0
  7. data/lib/typed/model/tm_boolean.rb +15 -0
  8. data/lib/typed/model/tm_boolean_operator.rb +34 -0
  9. data/lib/typed/model/tm_break.rb +24 -0
  10. data/lib/typed/model/tm_case_when.rb +38 -0
  11. data/lib/typed/model/tm_class.rb +63 -0
  12. data/lib/typed/model/tm_const.rb +29 -0
  13. data/lib/typed/model/tm_defined.rb +19 -0
  14. data/lib/typed/model/tm_error.rb +16 -0
  15. data/lib/typed/model/tm_float.rb +15 -0
  16. data/lib/typed/model/tm_for.rb +42 -0
  17. data/lib/typed/model/tm_fun.rb +165 -0
  18. data/lib/typed/model/tm_global_var.rb +22 -0
  19. data/lib/typed/model/tm_global_var_assignment.rb +20 -0
  20. data/lib/typed/model/tm_hash_literal.rb +32 -0
  21. data/lib/typed/model/tm_if_else.rb +24 -0
  22. data/lib/typed/model/tm_instance_var.rb +23 -0
  23. data/lib/typed/model/tm_instance_var_assignment.rb +32 -0
  24. data/lib/typed/model/tm_int.rb +15 -0
  25. data/lib/typed/model/tm_local_var_asgn.rb +35 -0
  26. data/lib/typed/model/tm_mass_asgn.rb +60 -0
  27. data/lib/typed/model/tm_mlhs.rb +87 -0
  28. data/lib/typed/model/tm_module.rb +51 -0
  29. data/lib/typed/model/tm_next.rb +24 -0
  30. data/lib/typed/model/tm_nil.rb +14 -0
  31. data/lib/typed/model/tm_range_literal.rb +30 -0
  32. data/lib/typed/model/tm_regexp.rb +27 -0
  33. data/lib/typed/model/tm_rescue.rb +27 -0
  34. data/lib/typed/model/tm_return.rb +24 -0
  35. data/lib/typed/model/tm_s_class.rb +30 -0
  36. data/lib/typed/model/tm_self.rb +22 -0
  37. data/lib/typed/model/tm_send.rb +300 -0
  38. data/lib/typed/model/tm_sequencing.rb +53 -0
  39. data/lib/typed/model/tm_string.rb +15 -0
  40. data/lib/typed/model/tm_string_interpolation.rb +21 -0
  41. data/lib/typed/model/tm_super.rb +27 -0
  42. data/lib/typed/model/tm_symbol.rb +15 -0
  43. data/lib/typed/model/tm_symbol_interpolation.rb +21 -0
  44. data/lib/typed/model/tm_try.rb +29 -0
  45. data/lib/typed/model/tm_var.rb +28 -0
  46. data/lib/typed/model/tm_while.rb +43 -0
  47. data/lib/typed/model.rb +48 -0
  48. data/lib/typed/prelude.rb +939 -0
  49. data/lib/typed/prelude_existential_registry.bin +0 -0
  50. data/lib/typed/prelude_generic_registry.bin +0 -0
  51. data/lib/typed/prelude_registry.bin +0 -0
  52. data/lib/typed/runtime/ast_parser.rb +589 -0
  53. data/lib/typed/runtime/method_signature_processor.rb +72 -0
  54. data/lib/typed/runtime/normalization/validations.rb +47 -0
  55. data/lib/typed/runtime/normalization.rb +196 -0
  56. data/lib/typed/runtime/parser_context.rb +36 -0
  57. data/lib/typed/runtime/type_parser.rb +215 -0
  58. data/lib/typed/runtime/type_registry.rb +170 -0
  59. data/lib/typed/runtime/type_signature_processor.rb +34 -0
  60. data/lib/typed/runtime.rb +33 -0
  61. data/lib/typed/type_signature/parser.rb +240 -0
  62. data/lib/typed/types/polymorphism/existential_type_variable.rb +13 -0
  63. data/lib/typed/types/polymorphism/generic_comparisons.rb +134 -0
  64. data/lib/typed/types/polymorphism/generic_variables.rb +24 -0
  65. data/lib/typed/types/polymorphism/type_variable.rb +138 -0
  66. data/lib/typed/types/polymorphism/type_variable_register.rb +298 -0
  67. data/lib/typed/types/polymorphism/unification.rb +579 -0
  68. data/lib/typed/types/ty_boolean.rb +15 -0
  69. data/lib/typed/types/ty_dynamic.rb +39 -0
  70. data/lib/typed/types/ty_either.rb +168 -0
  71. data/lib/typed/types/ty_error.rb +18 -0
  72. data/lib/typed/types/ty_existential_type.rb +22 -0
  73. data/lib/typed/types/ty_function.rb +144 -0
  74. data/lib/typed/types/ty_generic_function.rb +115 -0
  75. data/lib/typed/types/ty_generic_object.rb +180 -0
  76. data/lib/typed/types/ty_generic_singleton_object.rb +238 -0
  77. data/lib/typed/types/ty_object.rb +256 -0
  78. data/lib/typed/types/ty_singleton_object.rb +78 -0
  79. data/lib/typed/types/ty_stack_jump.rb +44 -0
  80. data/lib/typed/types/ty_top_level_object.rb +38 -0
  81. data/lib/typed/types.rb +60 -0
  82. data/lib/typed/typing_context.rb +206 -0
  83. data/lib/typed/version.rb +3 -0
  84. data/lib/typed.rb +161 -0
  85. data/spec/lib/ast_parser_spec.rb +101 -0
  86. data/spec/lib/examples/animals.rb +44 -0
  87. data/spec/lib/examples/counter.rb +16 -0
  88. data/spec/lib/examples/if.rb +31 -0
  89. data/spec/lib/language_spec.rb +36 -0
  90. data/spec/lib/model/tm_abs_spec.rb +66 -0
  91. data/spec/lib/model/tm_array_literal_spec.rb +36 -0
  92. data/spec/lib/model/tm_case_when_spec.rb +39 -0
  93. data/spec/lib/model/tm_class_spec.rb +67 -0
  94. data/spec/lib/model/tm_defined_spec.rb +10 -0
  95. data/spec/lib/model/tm_for_spec.rb +150 -0
  96. data/spec/lib/model/tm_fun_spec.rb +11 -0
  97. data/spec/lib/model/tm_hash_literal_spec.rb +40 -0
  98. data/spec/lib/model/tm_mass_asgn_spec.rb +104 -0
  99. data/spec/lib/model/tm_module_spec.rb +42 -0
  100. data/spec/lib/model/tm_regexp_spec.rb +9 -0
  101. data/spec/lib/model/tm_return_spec.rb +47 -0
  102. data/spec/lib/model/tm_s_class_spec.rb +27 -0
  103. data/spec/lib/model/tm_self_spec.rb +19 -0
  104. data/spec/lib/model/tm_string_interpolation_spec.rb +10 -0
  105. data/spec/lib/model/tm_symbol_interpolation_spec.rb +10 -0
  106. data/spec/lib/model/tm_symbol_spec.rb +9 -0
  107. data/spec/lib/model/tm_while_spec.rb +141 -0
  108. data/spec/lib/polymorphism/type_variable_spec.rb +14 -0
  109. data/spec/lib/polymorphism/unification_spec.rb +328 -0
  110. data/spec/lib/prelude/array_spec.rb +263 -0
  111. data/spec/lib/prelude/class_spec.rb +12 -0
  112. data/spec/lib/prelude/enumerable_spec.rb +278 -0
  113. data/spec/lib/prelude/enumerator_spec.rb +101 -0
  114. data/spec/lib/prelude/hash_spec.rb +361 -0
  115. data/spec/lib/prelude/kernel_spec.rb +23 -0
  116. data/spec/lib/prelude/object_spec.rb +22 -0
  117. data/spec/lib/prelude/pair_spec.rb +16 -0
  118. data/spec/lib/prelude/showable_spec.rb +31 -0
  119. data/spec/lib/prelude/string_spec.rb +98 -0
  120. data/spec/lib/runtime/normalization_spec.rb +29 -0
  121. data/spec/lib/runtime/validations_spec.rb +56 -0
  122. data/spec/lib/runtime_spec.rb +503 -0
  123. data/spec/lib/type_signature/parser_spec.rb +239 -0
  124. data/spec/lib/types/comparisons_spec.rb +35 -0
  125. data/spec/lib/types/polymorphism/generic_comparisons_spec.rb +492 -0
  126. data/spec/lib/types/polymorphism/type_variable_register_spec.rb +128 -0
  127. data/spec/lib/types/ty_dynamic_spec.rb +103 -0
  128. data/spec/lib/types/ty_either_spec.rb +288 -0
  129. data/spec/lib/types/ty_error_spec.rb +18 -0
  130. data/spec/lib/types/ty_generic_object_spec.rb +78 -0
  131. data/spec/lib/types/ty_generic_singleton_object_spec.rb +288 -0
  132. data/spec/lib/types/typing_context_spec.rb +86 -0
  133. data/spec/lib/types_spec.rb +174 -0
  134. data/spec/lib/typing/boolean_asgn_spec.rb +134 -0
  135. data/spec/lib/typing/break_spec.rb +79 -0
  136. data/spec/lib/typing/generics_spec.rb +191 -0
  137. data/spec/lib/typing/instance_vars_spec.rb +103 -0
  138. data/spec/lib/typing/next_spec.rb +29 -0
  139. data/spec/lib/typing/op_asgn_spec.rb +104 -0
  140. data/spec/lib/typing/overriden_methods_spec.rb +31 -0
  141. data/spec/lib/typing/subtyping_spec.rb +112 -0
  142. data/spec/lib/typing/tm_boolean_operator_spec.rb +100 -0
  143. data/spec/lib/typing/tm_boolean_spec.rb +61 -0
  144. data/spec/lib/typing/tm_const_spec.rb +28 -0
  145. data/spec/lib/typing/tm_defined_spec.rb +12 -0
  146. data/spec/lib/typing/tm_fun_spec.rb +347 -0
  147. data/spec/lib/typing/tm_global_var_spec.rb +33 -0
  148. data/spec/lib/typing/tm_if_else_spec.rb +104 -0
  149. data/spec/lib/typing/tm_ignore_spec.rb +24 -0
  150. data/spec/lib/typing/tm_instance_vars_spec.rb +117 -0
  151. data/spec/lib/typing/tm_local_var_asgn_spec.rb +134 -0
  152. data/spec/lib/typing/tm_mlhs_spec.rb +164 -0
  153. data/spec/lib/typing/tm_module_spec.rb +89 -0
  154. data/spec/lib/typing/tm_raise_spec.rb +31 -0
  155. data/spec/lib/typing/tm_range_literal_spec.rb +25 -0
  156. data/spec/lib/typing/tm_regexp_spec.rb +14 -0
  157. data/spec/lib/typing/tm_return_spec.rb +45 -0
  158. data/spec/lib/typing/tm_send_casting_spec.rb +26 -0
  159. data/spec/lib/typing/tm_send_class_methods_spec.rb +42 -0
  160. data/spec/lib/typing/tm_send_generic_apply_spec.rb +103 -0
  161. data/spec/lib/typing/tm_send_generic_methods_spec.rb +77 -0
  162. data/spec/lib/typing/tm_send_initialize_spec.rb +68 -0
  163. data/spec/lib/typing/tm_send_lambda_spec.rb +135 -0
  164. data/spec/lib/typing/tm_send_spec.rb +217 -0
  165. data/spec/lib/typing/tm_send_yield_block_spec.rb +308 -0
  166. data/spec/lib/typing/tm_sequencing_spec.rb +174 -0
  167. data/spec/lib/typing/tm_string_interpolation_spec.rb +19 -0
  168. data/spec/lib/typing/tm_super_spec.rb +63 -0
  169. data/spec/lib/typing/tm_symbol_interpolation_spec.rb +19 -0
  170. data/spec/lib/typing/tm_symbol_spec.rb +14 -0
  171. data/spec/lib/typing/tm_try_spec.rb +73 -0
  172. data/spec/spec_helper.rb +140 -0
  173. metadata +216 -0
@@ -0,0 +1,939 @@
1
+ require 'continuation'
2
+
3
+ module Showable; end
4
+
5
+ class Symbol
6
+ include Showable
7
+ end
8
+
9
+ class BasicObject
10
+ ts '#initialize / -> unit'
11
+ ts '#! / -> Boolean'
12
+ ts '#!= / BasicObject -> Boolean'
13
+ ts '#== / BasicObject -> Boolean'
14
+ ts '#__id__ / -> Integer'
15
+ ts '#__send__ / BasicObject -> BasicObject... -> BasicObject'
16
+ ts '#equal? / BasicObject -> Boolean'
17
+ ts '#instance_eval / String -> String -> Integer -> &(BasicObject -> unit) -> BasicObject'
18
+ ts '#method_missing / Symbol -> BasicObject... -> BasicObject'
19
+ ts '#singleton_method_added / Symbol -> unit'
20
+ ts '#singleton_method_removed / Symbol -> unit'
21
+ ts '#singleton_method_undefined / Symbol -> unit'
22
+ ts '#ts / String -> unit'
23
+ ts '#cast / BasicObject -> BasicObject -> BasicObject'
24
+ end
25
+
26
+ class Object
27
+ ts '#!~ / Object -> Boolean'
28
+ ts '#<=> / Object -> Integer'
29
+ ts '#=== / Object -> Boolean'
30
+ ts '#=~ / Object -> unit'
31
+ ts '#class / -> Class'
32
+ ts '#clone / -> Object'
33
+ # ts '#define_singleton_method / '
34
+ ts '#display / -> unit'
35
+ ts '#display / IO -> unit'
36
+ ts '#dup / -> Object'
37
+ # diff no block vs block
38
+ ts '#enum_for / -> Enumerator[Object]'
39
+ ts '#enum_for / Symbol -> Enumerator[Object]'
40
+ ts '#enum_for / Symbol -> Object... -> Enumerator[Object]'
41
+ ts '#eql? / Object -> Boolean'
42
+ ts '#extend / Module -> Object'
43
+ ts '#freeze / -> Object'
44
+ ts '#frozen? / -> Boolean'
45
+ ts '#hash / -> Integer'
46
+ ts '#inspect / -> String'
47
+ ts '#instance_of? / Class -> Boolean'
48
+ ts '#instance_variable_defined? / Showable -> Boolean'
49
+ ts '#instance_variable_get / Showable -> Boolean'
50
+ ts '#instance_variable_set / Showable -> Object -> Boolean'
51
+ ts '#instance_variables / -> Array[Symbol]'
52
+ ts '#is_a? / Class -> Boolean'
53
+ ts '#itself / -> Object'
54
+ ts '#kind_of? / Class -> Boolean'
55
+ ts '#method / Symbol -> Method'
56
+ ts '#methods / -> Array[Symbol]'
57
+ ts '#methods / Boolean -> Array[Symbol]'
58
+ ts '#nil? / -> Boolean'
59
+ ts '#object_id / -> Integer'
60
+ ts '#private_methods / -> Array[Symbol]'
61
+ ts '#private_methods / Boolean -> Array[Symbol]'
62
+ ts '#protected_methods / -> Array[Symbol]'
63
+ ts '#protected_methods / Boolean -> Array[Symbol]'
64
+ ts '#public_method / Symbol -> Method'
65
+ ts '#public_methods / -> Array[Symbol]'
66
+ ts '#public_methods / Boolean -> Array[Symbol]'
67
+ ts '#public_send / Showable -> Object... -> Object'
68
+ ts '#remove_instance_variable / Symbol -> Object'
69
+ ts '#respond_to? / Showable -> Boolean'
70
+ ts '#respond_to? / Showable -> Boolean -> Boolean'
71
+ ts '#respond_to_missing? / Showable -> Boolean -> Boolean'
72
+ ts '#send / Showable -> Object... -> Object'
73
+ ts '#singleton_class / -> Class'
74
+ ts '#singleton_method / Symbol -> Object'
75
+ ts '#singleton_methods / Boolean -> Array[Method]'
76
+ ts '#taint / -> Object'
77
+ ts '#tainted? / -> Boolean'
78
+ ts '#tap / &(Object -> unit) -> Object'
79
+ # diff no block vs block
80
+ ts '#to_enum / -> Enumerator[Object]'
81
+ ts '#to_enum / Symbol -> Enumerator[Object]'
82
+ ts '#to_enum / Symbol -> Object... -> Enumerator[Object]'
83
+ ts '#to_s / -> String'
84
+ ts '#trust / -> Object'
85
+ ts '#untaint / -> Object'
86
+ ts '#untrust / -> Object'
87
+ ts '#untrusted? / -> Boolean'
88
+ end
89
+
90
+ module Kernel
91
+ ts '#Array[E] / Range[E] -> Array[E]'
92
+ ts '#Complex / Object -> Complex'
93
+ ts '#Complex / Integer -> Integer -> Complex'
94
+ ts '#Float / Object -> Float'
95
+ ts '#Hash / Object -> Float'
96
+ ts '#Integer / Object -> Integer'
97
+ ts '#Integer / Object -> Integer -> Integer'
98
+ ts '#Rational / Numeric -> Rational'
99
+ ts '#Rational / Numeric -> Numeric -> Rational'
100
+ ts '#String / Object -> String'
101
+ ts '#__callee__ / -> Symbol'
102
+ ts '#__dir__ / -> String'
103
+ ts '#__method__ / -> Symbol'
104
+ ts '#` / String -> Object'
105
+ ts '#abort / -> unit'
106
+ ts '#abort / String -> unit'
107
+ ts '.abort / -> unit'
108
+ ts '.abort / String -> unit'
109
+ ts '#at_exit / &(-> unit) -> Proc'
110
+ ts '#autoload / Showable -> String -> unit'
111
+ ts '#autoload? / Showable -> String'
112
+ ts '#binding / -> Binding'
113
+ ts '#block_given? / -> Boolean'
114
+ ts '#callcc / &(Continuation -> Object) -> Object'
115
+ ts '#caller / Range -> Array[String]'
116
+ ts '#caller / Integer -> Integer -> Array[String]'
117
+ ts '#caller_locations / Range[Integer] -> Array[String]'
118
+ ts '#caller_locations / Integer -> Integer -> Array[String]'
119
+ # ts '#catch / -> unit'
120
+ # ts '#chomp / String -> String'
121
+ # ts '#chop / String -> String'
122
+ ts '#eval / String -> Object'
123
+ ts '#eval / String -> Binding -> Object'
124
+ ts '#eval / String -> Binding -> String -> Object'
125
+ ts '#eval / String -> Binding -> String -> Integer -> Object'
126
+ ts '#exec / Object... -> String'
127
+ ts '#exit / -> unit'
128
+ ts '#exit / Boolean -> unit'
129
+ ts '#exit! / -> unit'
130
+ ts '#exit! / Boolean -> unit'
131
+ ts '#fail / -> unit'
132
+ ts '#fail / Exception -> unit'
133
+ ts '#fail / Exception -> String -> unit'
134
+ ts '#fail / Exception -> String -> Array[Object] -> unit'
135
+ ts '#fork / &(-> unit)-> Integer'
136
+ ts '#format / String -> Array[Object] -> String'
137
+ ts '#gets / -> String'
138
+ ts '#gets / Object -> String'
139
+ ts '#gets / String -> Integer -> String'
140
+ ts '#global_variables / -> Array[Symbol]'
141
+ # ts '#gsub / Object -> String'
142
+ ts '#iterator? / -> Boolean'
143
+ # ts '#lambda / (Object... -> unit) -> Proc'
144
+ ts '#load / String -> Boolean'
145
+ ts '#load / String -> Boolean -> Boolean'
146
+ ts '#local_variables / -> Array[Symbol]'
147
+ ts '#loop / -> Enumerator[Object]'
148
+ ts '#loop / &( -> unit) -> unit'
149
+ ts '#open / String -> IO'
150
+ ts '#open / String -> &(IO -> unit) -> unit'
151
+ ts '#open / String -> Object... -> IO'
152
+ ts '#open / String -> Object... -> &(IO -> unit) -> unit'
153
+ ts '#p / -> unit'
154
+ ts '#p / Object -> Object'
155
+ ts '#p / Object... -> Array[Object]'
156
+ ts '#print / Object... -> unit'
157
+ ts '#printf / String -> Object... -> unit'
158
+ #ts '#printf / IO -> String -> Object... -> unit'
159
+ # ts '#proc / '
160
+ ts '#putc / Integer -> Integer'
161
+ ts '#puts / Object -> Object... -> unit'
162
+ ts '#raise / -> unit'
163
+ ts '#raise / Exception -> unit'
164
+ ts '#raise / Exception -> String -> unit'
165
+ ts '#raise / Exception -> String -> Array[Object] -> unit'
166
+ ts '#rand / -> Float'
167
+ ts '#rand[E < Numeric] / [E] -> [E]'
168
+ ts '#readline / Object -> String'
169
+ ts '#readline / String -> Integer -> String'
170
+ ts '#readlines / Object -> String'
171
+ ts '#readlines / String -> Integer -> String'
172
+ ts '#require / String -> Boolean'
173
+ ts '#require_relative / String -> Boolean'
174
+ ts '#select / Array[IO] -> Array[IO]'
175
+ ts '#select / Array[IO] -> Array[IO] -> Array[IO]'
176
+ ts '#select / Array[IO] -> Array[IO] -> Array[IO] -> Array[IO]'
177
+ ts '#select / Array[IO] -> Array[IO] -> Array[IO] -> Integer -> Array[IO] '
178
+ # set_trace_func
179
+ ts '#sleep / -> Integer'
180
+ ts '#sleep / Integer -> Integer'
181
+ # spawn
182
+ ts '#sprintf / String -> Object... -> String'
183
+ ts '#srand / -> Bignum'
184
+ ts '#srand / -> Bignum -> Bignum'
185
+ # sub
186
+ ts '#syscall / Integer -> Object... -> Integer'
187
+ # system
188
+ ts '#test / String -> Object... -> Object'
189
+ # throw
190
+ # trace_var
191
+ # trap
192
+ # untrace_var
193
+ ts '#warn / String -> unit'
194
+ ts '#warn / String -> String... -> unit'
195
+ end
196
+
197
+ class Class
198
+ ts '#initialize / -> Class'
199
+ ts '#initialize / Class -> Class'
200
+ ts '#allocate / -> Object'
201
+ end
202
+
203
+ class Module
204
+ ts '#include / Module... -> Class'
205
+ end
206
+
207
+ ts 'type Enumerable[T]'
208
+ module Enumerable
209
+ ts '#all? / &([T] -> Boolean) -> Boolean'
210
+ ts '#any? / &([T] -> Boolean) -> Boolean'
211
+ ts '#chunk / &([T] -> Boolean) -> Enumerator[Pair[Boolean][Array[T]]]'
212
+ ts '#chunk / Object -> &([T] -> Object -> Boolean) -> Enumerator[Pair[Boolean][Array[T]]]'
213
+ ts '#collect[E] / &([T] -> [E]) -> Array[E]'
214
+ # ts '#collect_concat / '
215
+ ts '#count / &([T] -> Boolean) -> Integer'
216
+ ts '#cycle / &([T] -> unit) -> unit'
217
+ ts '#detect / -> Enumerator[T]'
218
+ ts '#detect / &([T] -> Boolean) -> [T]'
219
+ ts '#detect / [T] -> Enumerator[T]'
220
+ ts '#detect / [T] -> &([T] -> Boolean) -> [T]'
221
+ ts '#drop / Integer -> Array[T]'
222
+ ts '#drop_while / &([T] -> Boolean) -> Array[T]'
223
+ ts '#each_cons / Integer -> &(Array[T] -> unit) -> unit'
224
+ ts '#each_cons / Integer -> Enumerator[Array[T]]'
225
+ ts '#each_entry / &([T] -> unit) -> Enumerator[T]'
226
+ ts '#each_entry / -> Enumerator[T]'
227
+ ts '#each_slice / Integer -> &(Array[T] -> unit) -> unit'
228
+ ts '#each_slice / Integer -> Enumerator[Array[T]]'
229
+ ts '#each_with_index / -> Enumerator[Pair[T][Integer]]'
230
+ ts '#each_with_index / &([T] -> Integer -> unit) -> Object'
231
+ ts '#each_with_object[E] / [E] -> &([T] -> [E] -> unit) -> [E]'
232
+ ts '#each_with_object[E] / [E] -> Enumerator[Pair[T][E]]'
233
+ ts '#entries / -> Array[T]'
234
+ # find == detect
235
+ ts '#find / -> Enumerator[T]'
236
+ ts '#find / &([T] -> Boolean) -> [T]'
237
+ ts '#find / [T] -> Enumerator[T]'
238
+ ts '#find / [T] -> &([T] -> Boolean) -> [T]'
239
+ ts '#find_all / -> Enumerator[T]'
240
+ ts '#find_all / &([T] -> Boolean) -> Array[T]'
241
+ ts '#find_index / &([T] -> Boolean) -> Integer'
242
+ ts '#find_index / [T] -> Integer'
243
+ ts '#first / -> [T]'
244
+ ts '#first / Integer-> Array[T]'
245
+ # ts '#flat_map / '
246
+ ts '#grep / Regexp -> Array[T]'
247
+ ts '#grep[E] / Regexp -> &([T] -> [E]) -> Array[E]'
248
+ ts '#group_by[E] / &([T] -> [E]) -> Hash[E][Array[T]]'
249
+ ts '#group_by / -> Enumerator[T]'
250
+ ts '#include? / [T] -> Boolean'
251
+ ts '#inject[E] / [E] -> Symbol -> [E]'
252
+ ts '#inject[E] / [E] -> &(Pair[E][T] -> [E]) -> [E]'
253
+ ts '#inject / &(Pair[T][T] -> [T]) -> [T]'
254
+ ts '#lazy / -> Enumerator[T]'
255
+ ts '#map[E] / &([T] -> [E]) -> Array[E]'
256
+ ts '#max / -> [T]'
257
+ ts '#max / &(Pair[T][T] -> Integer) -> [T]'
258
+ ts '#max / Integer -> Array[T]'
259
+ ts '#max / Integer -> &(Pair[T][T] -> Integer) -> Array[T]'
260
+ ts '#max_by / &([T] -> Object) -> [T]'
261
+ ts '#max_by / Integer -> &([T] -> Object) -> Array[T]'
262
+ ts '#max_by / -> Enumerator[T]'
263
+ ts '#max_by / Integer -> Enumerator[T]'
264
+ ts '#member? / [T] -> Boolean'
265
+ ts '#min / -> [T]'
266
+ ts '#min / &(Pair[T][T] -> Integer) -> [T]'
267
+ ts '#min / Integer -> Array[T]'
268
+ ts '#min / Integer -> &(Pair[T][T] -> Integer) -> Array[T]'
269
+ ts '#min_by / &([T] -> Object) -> [T]'
270
+ ts '#min_by / Integer -> &([T] -> Object) -> Array[T]'
271
+ ts '#min_by / -> Enumerator[T]'
272
+ ts '#min_by / Integer -> Enumerator[T]'
273
+ ts '#minmax / -> Pair[T][T]'
274
+ ts '#minmax / &(Pair[T][T] -> Integer) -> Pair[T][T]'
275
+ ts '#minmax_by / &([T] -> Object) -> Pair[T][T]'
276
+ ts '#minmax_by / -> Enumerator[T]'
277
+ ts '#none? / &([T] -> Boolean) -> Boolean'
278
+ ts '#one? / &([T] -> Boolean) -> Boolean'
279
+ ts '#partition / &([T] -> Boolean) -> Pair[Array[T]][Array[T]]'
280
+ ts '#reduce[E] / [E] -> Symbol -> [E]'
281
+ ts '#reduce[E] / [E] -> &(Pair[E][T] -> [E]) -> [E]'
282
+ ts '#reduce / &(Pair[T][T] -> [T]) -> [T]'
283
+ ts '#reject / &([T] -> Boolean) -> Array[T]'
284
+ ts '#reverse_each / Object... -> Enumerator[T]'
285
+ ts '#reverse_each / Object... -> &([T] -> unit) -> Enumerator[T]'
286
+ ts '#select / &([T] -> Boolean) -> Array[T]'
287
+ # ts '#slice_after / '
288
+ # ts '#slice_before / '
289
+ # ts '#slice_when / '
290
+ ts '#sort / &([T] -> [T] -> Integer) -> Array[T]'
291
+ ts '#sort_by[E < Comparable] / &([T] -> [E]) -> Array[T]'
292
+ ts '#sort_by / -> Enumerator[T]'
293
+ ts '#take / Integer -> Array[T]'
294
+ ts '#take_while / -> Enumerator[T]'
295
+ ts '#take_while / &([T] -> Boolean) -> Array[T]'
296
+ ts '#to_a / Object... -> Array[T]'
297
+ # ts '#to_h / Object... -> Hash'
298
+ ts '#zip / Array[T]... -> Array[Array[T]]'
299
+ ts '#zip / Array[T]... -> &(Array[T] -> unit) -> unit'
300
+ end
301
+
302
+ ts 'type Enumerator[T]'
303
+ class Enumerator
304
+ ts '#initialize / &(Enumerator::Yielder[T] -> unit) -> Enumerator[T]'
305
+ ts '#initialize / Object -> &(Enumerator::Yielder[T] -> unit) -> Enumerator[T]'
306
+ ts '#initialize / Object -> Symbol -> Enumerator[T]'
307
+ ts '#initialize / Object -> Symbol -> Object... -> Enumerator[T]'
308
+ ts '#each / -> Enumerator[T]'
309
+ ts '#each / &([T] -> unit) -> Object'
310
+ ts '#each_with_index / -> Enumerator[Pair[T][Integer]]'
311
+ ts '#each_with_index / &([T] -> Integer -> unit) -> Object'
312
+ ts '#each_with_object[E] / [E] -> &([T] -> [E] -> unit) -> [E]'
313
+ ts '#each_with_object[E] / [E] -> Enumerator[Pair[T][E]]'
314
+ ts '#feed / [T] -> unit'
315
+ ts '#next / -> [T]'
316
+ ts '#next_values / -> Array[T]'
317
+ ts '#peek / -> [T]'
318
+ ts '#peek_values / -> Array[T]'
319
+ ts '#rewind / ->Enumerator[T]'
320
+ ts '#size / -> Integer'
321
+ ts '#with_index / &([T] -> Integer -> unit) -> Object'
322
+ ts '#with_index / -> Enumerator[Pair[T][Integer]]'
323
+ ts '#with_index / Integer -> &([T] -> Integer -> unit) -> Object'
324
+ ts '#with_index / Integer -> Enumerator[Pair[T][Integer]]'
325
+ ts '#with_object[E] / [E] -> &([T] -> [E] -> unit) -> [E]'
326
+ ts '#with_object[E] / [E] -> Enumerator[Pair[T][E]]'
327
+ end
328
+
329
+ ts 'type Enumerator::Yielder[T]'
330
+ class Enumerator::Yielder
331
+ ts '#<< / [T] -> unit'
332
+ ts '#yield / [T] -> unit'
333
+ end
334
+
335
+ ts 'type Array[T]'
336
+ class Array
337
+ ts '.[] / [T]... -> Array[T]'
338
+ ts '#initialize / Integer -> Array[T]'
339
+ ts '#initialize / Integer -> [T] -> Array[T]'
340
+ ts '#& / Array[T] -> Array[T]'
341
+ ts '#* / Integer -> Array[T]'
342
+ ts '#+ / Array[T] -> Array[T]'
343
+ ts '#- / Array[T] -> Array[T]'
344
+ ts '#<< / [T] -> Array[T]'
345
+ ts '#<=> / Array[T] -> Integer'
346
+ ts '#== / Array[T] -> Array[T]'
347
+ ts '#at / Integer -> [T]'
348
+ # Should we split this into #[] and #slice ?
349
+ ts '#[] / Object -> Object'
350
+ ts '#[] / Integer -> Integer -> Array[T]'
351
+ ts '#assoc / Object -> Array[T]'
352
+ ts '#bsearch / &([T] -> Boolean) -> [T]'
353
+ ts '#clear / -> Array[T]'
354
+ ts '#collect![E] / &([T] -> [E]) -> Array[E]'
355
+ ts '#combination / Integer -> Array[Array[T]]'
356
+ ts '#compact / -> Array[T]'
357
+ ts '#compact! / -> Array[T]'
358
+ ts '#concat / Array[T] -> Array[T]'
359
+ ts '#count / [T] -> Integer'
360
+ ts '#cycle / Integer -> &([T] -> unit) -> unit'
361
+ ts '#delete / [T] -> &(-> [T]) -> [T]'
362
+ ts '#delete_at / Integer -> [T]'
363
+ ts '#delete_if / &([T] -> Boolean) -> Array[T]'
364
+ ts '#each / &([T] -> unit) -> Array[T]'
365
+ ts '#each / -> Enumerator[T]'
366
+ ts '#each_index / &([Integer] -> unit) -> Array[T]'
367
+ ts '#empty? / -> Boolean'
368
+ ts '#eql? / Array[?] -> Boolean'
369
+ ts '#fetch / Integer -> &(Integer ->[T]) -> [T]'
370
+ ts '#fetch / Integer -> [T] -> [T]'
371
+ # diff no block vs block
372
+ ts '#fill / [T] -> Array[T]'
373
+ ts '#fill / [T] -> Integer -> Array[T]'
374
+ ts '#fill / [T] -> Integer -> Integer -> Array[T]'
375
+ ts '#flatten / -> Array[Object]'
376
+ ts '#flatten / Integer -> Array[Object]'
377
+ ts '#flatten! / -> Array[Object]'
378
+ ts '#flatten! / Integer -> Array[Object]'
379
+ ts '#frozen? / -> Boolean'
380
+ ts '#hash / -> Integer'
381
+ ts '#include? / [T] -> Boolean'
382
+ # diff no block vs block
383
+ ts '#index / &([T] -> Boolean) -> Integer'
384
+ ts '#index / [T] -> Integer'
385
+ ts '#initialize_copy / Array[T] -> Array[T]'
386
+ ts '#insert / Integer -> [T] -> [T]... -> Array[T]'
387
+ ts '#inspect / -> String'
388
+ ts '#join / -> String'
389
+ ts '#join / String -> String'
390
+ ts '#keep_if / &([T] -> Boolean) -> Array[T]'
391
+ ts '#last / -> [T]'
392
+ ts '#last / Integer -> Array[T]'
393
+ ts '#map![E] / &([T] -> [E]) -> Array[E]'
394
+ ts '#length / -> Integer'
395
+ ts '#pack / String -> String'
396
+ # diff no block vs block
397
+ ts '#permutation / -> Array[Array[T]]'
398
+ ts '#permutation / Integer -> Array[Array[T]]'
399
+ ts '#pop / -> [T]'
400
+ ts '#pop / Integer -> Array[T]'
401
+ ts '#product / Array[T]... -> Array[Array[T]]'
402
+ ts '#push / [T]... -> Array[T]'
403
+ # ts '#rassoc / '
404
+ ts '#reject! / &([T] -> Boolean) -> Array[T]'
405
+ ts '#repeated_combination / Integer -> Array[Array[T]]'
406
+ ts '#repeated_permutation / Integer -> Array[Array[T]]'
407
+ ts '#replace / Array[T] -> Array[T]'
408
+ ts '#reverse / -> Array[T]'
409
+ ts '#reverse! / -> Array[T]'
410
+ ts '#reverse_each / &([T] -> unit) -> Array[T]'
411
+ ts '#rindex / &([T] -> Boolean) -> Integer'
412
+ ts '#rindex / [T] -> Integer'
413
+ ts '#rotate / -> Array[T]'
414
+ ts '#rotate / Integer -> Array[T]'
415
+ ts '#rotate! / -> Array[T]'
416
+ ts '#rotate! / Integer -> Array[T]'
417
+ ts '#sample / -> Array[T]'
418
+ ts '#sample / Integer -> Array[T]'
419
+ ts '#select! / &([T] -> Boolean) -> Array[T]'
420
+ ts '#shift / -> [T]'
421
+ ts '#shift / Integer -> Array[T]'
422
+ ts '#shuffle / -> Array[T]'
423
+ ts '#shuffle! / -> Array[T]'
424
+ ts '#size / -> Integer'
425
+ ts '#slice / Object -> Object'
426
+ ts '#slice / Integer -> Integer -> Array[T]'
427
+ ts '#slice! / Object -> Object'
428
+ ts '#slice! / Integer -> Integer -> Array[T]'
429
+ ts '#sort! / &([T] -> [T] -> Integer) -> Array[T]'
430
+ ts '#sort_by! / &([T] -> Object) -> Array[T]'
431
+ ts '#take / Integer -> Array[T]'
432
+ ts '#take_while / &([T] -> Boolean) -> Array[T]'
433
+ ts '#to_a / -> Array[T]'
434
+ ts '#to_ary / -> Array[T]'
435
+ ts '#to_h / -> Hash[T][T]'
436
+ ts '#to_s / -> String'
437
+ # ts '#transpose'
438
+ ts '#uniq / &([T] -> Object) -> Array[T]'
439
+ ts '#uniq! / &([T] -> Object) -> Array[T]'
440
+ ts '#unshift / [T]... -> Array[T]'
441
+ ts '#values_at / Integer... -> Array[T]'
442
+ ts '#zip / Array[T]... -> Array[Array[T]]'
443
+ ts '#| / Array[T] -> Array[T]'
444
+ end
445
+
446
+ ts 'type Pair[S][T] super Array[Object]'
447
+ class Pair < Array
448
+ ts '.of[S][T] / [S] -> [T] -> Pair[S][T]'
449
+ ts_ignore
450
+ def self.of(f,s)
451
+ Pair.new([f,s])
452
+ end
453
+
454
+ ts '#first / -> [S]'
455
+
456
+ ts '#second / -> [T]'
457
+ def second
458
+ cast(at(1), '[T]')
459
+ end
460
+ end
461
+
462
+ ts 'type Hash[S][T] super Enumerable[Pair[S][T]]'
463
+ class Hash
464
+ # ts '#map[E] / &(Pair[S][T] -> [E]) -> Array[E]'
465
+
466
+ ts '.[] / Object... -> Hash[S][T]'
467
+ ts '.try_convert / Object -> Hash[S][T]'
468
+ ts '#initialize / -> Hash[S][T]'
469
+ ts '#initialize / &(Hash[S][T] -> [S] -> unit) -> Hash[S][T]'
470
+ ts '#initialize / [T] -> Hash[S][T]'
471
+ #==
472
+ # []
473
+ ts '#[]= / [S] -> [T] -> [T]'
474
+ ts '#any? / &([S] -> [T] -> Boolean) -> Boolean'
475
+ ts '#assoc / [S] -> Pair[S][T]'
476
+ unless (instance_method(:untyped_assoc) rescue false)
477
+ alias_method :untyped_assoc, :assoc
478
+ def assoc(k)
479
+ res = untyped_assoc(k)
480
+ return res if res.nil?
481
+ Pair.('[S][T]').new(res)
482
+ end
483
+ end
484
+ ts '#clear / -> Hash[S][T]'
485
+ ts '#compare_by_identity / -> Hash[S][T]'
486
+ ts '#compare_by_identity? / -> Boolean'
487
+ ts '#default / -> [T]'
488
+ ts '#default / [S] -> [T]'
489
+ ts '#default= / [T] -> [T]'
490
+ # ts '#default_proc / -> (Hash[S][T] -> [S] -> [K])'
491
+ # default_proc=
492
+ ts '#delete / [S] -> &([S] -> [T]) -> [T]'
493
+ ts '#delete_if / &([S] -> [T] -> Boolean) -> Hash[S][T]'
494
+ ts '#each / &([S] -> [T] -> unit) -> Hash[S][T]'
495
+ ts '#each_key / -> Enumerator[Pair[S][T]]' # TODO: make this generic, do for other functions as well
496
+ ts '#each_key / &([S] -> unit) -> Hash[S][T]'
497
+ ts '#each_pair / &([S] -> [T] -> unit) -> Hash[S][T]'
498
+ ts '#each_value / &([T] -> unit) -> Hash[S][T]'
499
+ ts '#empty? / -> Boolean'
500
+ #ts '#eql? / Hash[?][?] -> Boolean' -> from Object
501
+ ts '#fetch / [S] -> &([S] -> [T]) -> [T]'
502
+ ts '#fetch / [S] -> [T] -> [T]'
503
+ ts '#flatten / -> Array[Object]'
504
+ ts '#flatten / Integer -> Array[Object]'
505
+ ts '#has_key? / [S] -> Boolean'
506
+ ts '#has_value? / [T] -> Boolean'
507
+ ts '#hash / -> Fixnum'
508
+ ts '#include? / [S] -> Boolean'
509
+ ts '#invert / -> Hash[T][S]'
510
+ ts '#keep_if / &([S] -> [T] -> Boolean) -> Hash[S][T]'
511
+ ts '#key / [T] -> [S]'
512
+ ts '#key? / [S] -> Boolean'
513
+ ts '#keys / -> Array[S]'
514
+ ts '#length / -> Fixnum'
515
+ ts '#member? / [S] -> Boolean'
516
+ ts '#merge / Hash[S][T] -> Hash[S][T]'
517
+ ts '#merge / Hash[S][T] -> &([S] -> [T] -> [T] -> [T]) -> Hash[S][T]'
518
+ ts '#merge! / Hash[S][T] -> Hash[S][T]'
519
+ ts '#merge! / Hash[S][T] -> &([S] -> [T] -> [T] -> [T]) -> Hash[S][T]'
520
+ ts '#rassoc / [T] -> Pair[S][T]'
521
+ unless (instance_method(:untyped_rassoc) rescue false)
522
+ alias_method :untyped_rassoc, :rassoc
523
+ def rassoc(k)
524
+ res = untyped_rassoc(k)
525
+ return res if res.nil?
526
+ Pair.('[S][T]').new(res)
527
+ end
528
+ end
529
+ ts '#rehash / -> Hash[S][T]'
530
+ ts '#reject / &([S] -> [T] -> Boolean) -> Hash[S][T]'
531
+ ts '#reject! / &([S] -> [T] -> Boolean) -> Hash[S][T]'
532
+ ts '#replace / Hash[S][T] -> Hash[S][T]'
533
+ ts '#select / &([S] -> [T] -> Boolean) -> Hash[S][T]'
534
+ ts '#select! / &([S] -> [T] -> Boolean) -> Hash[S][T]'
535
+ ts '#shift / -> Pair[S][T]'
536
+ unless (instance_method(:untyped_shift) rescue false)
537
+ alias_method :untyped_shift, :shift
538
+ def shift
539
+ res = untyped_shift
540
+ return res if res.nil?
541
+ Pair.('[S][T]').new(res)
542
+ end
543
+ end
544
+ ts '#size / -> Fixnum'
545
+ ts '#store / [S] -> [T] -> [T]'
546
+ ts '#to_a / -> Array[Pair[S][T]]'
547
+ ts '#to_h / -> Hash[S][T]'
548
+ ts '#to_hash / -> Hash[S][T]'
549
+ ts '#update / Hash[S][T] -> Hash[S][T]'
550
+ ts '#update / Hash[S][T] -> &([S] -> [T] -> [T] -> [T]) -> Hash[S][T]'
551
+ ts '#value? / [T] -> Boolean'
552
+ ts '#values / -> Array[T]'
553
+ ts '#values_at / [S]... -> Array[T]'
554
+ end
555
+
556
+ class String
557
+
558
+ include Showable
559
+
560
+ ts '#initialize / -> String'
561
+ ts '#initialize / String -> String'
562
+ ts '#% / Object -> String'
563
+ ts '#* / Integer -> String'
564
+ ts '#+ / String -> String'
565
+ ts '#<< / Object -> String'
566
+ ts '#<=> / String -> Integer'
567
+ ts '#== / Object -> Boolean'
568
+ ts '#=== / Object -> Boolean'
569
+ ts '#=~ / Object -> Integer'
570
+ ts '#[] / Object -> String'
571
+ ts '#[] / Object -> Object -> String'
572
+ ts '#ascii_only? / -> Boolean'
573
+ ts '#b / -> String'
574
+ ts '#bytes / -> Array[Integer]'
575
+ ts '#bytesize / -> Integer'
576
+ ts '#byteslice / Object -> String'
577
+ ts '#byteslice / Integer -> Integer -> String'
578
+ ts '#capitalize / -> String'
579
+ ts '#capitalize! / -> String'
580
+ ts '#casecmp / String -> Integer'
581
+ ts '#center / Integer -> String'
582
+ ts '#center / Integer -> String -> String'
583
+ ts '#chars / -> Array[String]'
584
+ ts '#chomp / -> String'
585
+ ts '#chomp / String -> String'
586
+ ts '#chomp! / -> String'
587
+ ts '#chomp! / String -> String'
588
+ ts '#chop / -> String'
589
+ ts '#chop! / -> String'
590
+ ts '#chr / -> String'
591
+ ts '#clear / -> String'
592
+ ts '#codepoints / -> Array[Integer]'
593
+ ts '#concat / Object -> String'
594
+ ts '#count / String... -> Fixnum'
595
+ ts '#crypt / String -> String'
596
+ ts '#delete / String... -> String'
597
+ ts '#delete! / String... -> String'
598
+ ts '#downcase / -> String'
599
+ ts '#downcase! / -> String'
600
+ ts '#dump / -> String'
601
+ ts '#each_byte / &(Fixnum -> unit) -> String'
602
+ ts '#each_byte / -> Enumerator[Fixnum]'
603
+ ts '#each_char / &(String -> unit) -> String'
604
+ ts '#each_char / -> Enumerator[String]'
605
+ ts '#each_codepoint / &(Integer -> unit) -> String'
606
+ ts '#each_codepoint / -> Enumerator[Integer]'
607
+ ts '#each_line / &(String -> unit) -> String'
608
+ ts '#each_line / -> Enumerator[String]'
609
+ ts '#each_line / String -> &(String -> unit) -> String'
610
+ ts '#each_line / String -> Enumerator[String]'
611
+ ts '#empty? / -> Boolean'
612
+ ts '#encode / Object... -> String'
613
+ ts '#encode! / Object -> Object... -> String'
614
+ ts '#encoding / -> Encoding'
615
+ ts '#end_with? / String... -> Boolean'
616
+ ts '#eql? / String -> Boolean'
617
+ ts '#force_encoding / Encoding -> String'
618
+ ts '#getbyte / Integer -> Integer'
619
+ ts '#gsub / Regexp -> Enumerator[String]'
620
+ ts '#gsub / Regexp -> &(String -> String) -> String'
621
+ ts '#gsub / Regexp -> Object -> String'
622
+ ts '#gsub! / Regexp -> Enumerator[String]'
623
+ ts '#gsub! / Regexp -> &(String -> String) -> String'
624
+ ts '#gsub! / Regexp -> Object -> String'
625
+ ts '#hash / -> Fixnum'
626
+ ts '#hex / -> Integer'
627
+ ts '#include? / String -> Boolean'
628
+ ts '#index / Object -> Fixnum'
629
+ ts '#index / Object -> Integer -> Fixnum'
630
+ ts '#insert / Integer -> String -> String'
631
+ ts '#inspect / -> String'
632
+ ts '#intern / -> Symbol'
633
+ ts '#length / -> Integer'
634
+ ts '#lines / -> Array[String]'
635
+ ts '#lines / String -> Array[String]'
636
+ ts '#ljust / Integer -> String'
637
+ ts '#ljust / Integer -> String -> String'
638
+ ts '#lstrip / -> String'
639
+ ts '#lstrip! / -> String'
640
+ ts '#match / Regexp -> MatchData'
641
+ ts '#match / Regexp -> Integer -> MatchData'
642
+ ts '#next / -> String'
643
+ ts '#next! / -> String'
644
+ ts '#oct / -> Integer'
645
+ ts '#ord / -> Integer'
646
+ ts '#partition / Object -> Array[String]'
647
+ ts '#prepend / String -> String'
648
+ ts '#replace / String -> String'
649
+ ts '#reverse / -> String'
650
+ ts '#reverse! / -> String'
651
+ ts '#rindex / Object -> Fixnum'
652
+ ts '#rindex / Object -> Integer -> Fixnum'
653
+ ts '#rjust / Integer -> String'
654
+ ts '#rjust / Integer -> String -> String'
655
+ ts '#rpartition / Object -> Array[String]'
656
+ ts '#rstrip / -> String'
657
+ ts '#rstrip! / -> String'
658
+ ts '#scan / Regexp -> Array[String]'
659
+ ts '#scan / Regexp -> &(String... -> unit) -> String'
660
+ ts '#scrub / -> String'
661
+ ts '#scrub / &(String -> String) -> String'
662
+ ts '#scrub / String -> String'
663
+ ts '#scrub! / -> String'
664
+ ts '#scrub! / &(String -> String) -> String'
665
+ ts '#scrub! / String -> String'
666
+ ts '#setbyte / Integer -> Integer -> Integer'
667
+ ts '#size / -> Integer'
668
+ ts '#slice / Object -> String'
669
+ ts '#slice / Object -> Object -> String'
670
+ ts '#slice! / Object -> String'
671
+ ts '#slice! / Object -> Object -> String'
672
+ ts '#split / Object -> Array[String]'
673
+ ts '#split / Object -> Integer -> Array[String]'
674
+ ts '#squeeze / String... -> String'
675
+ ts '#squeeze! / String... -> String'
676
+ ts '#start_with? / String -> Boolean'
677
+ ts '#strip / -> String'
678
+ ts '#strip! / -> String'
679
+ ts '#sub / Regexp -> Enumerator[String]'
680
+ ts '#sub / Regexp -> &(String -> String) -> String'
681
+ ts '#sub / Regexp -> Object -> String'
682
+ ts '#sub! / Regexp -> Enumerator[String]'
683
+ ts '#sub! / Regexp -> &(String -> String) -> String'
684
+ ts '#sub! / Regexp -> Object -> String'
685
+ ts '#succ / -> String'
686
+ ts '#succ! / -> String'
687
+ ts '#sum / -> Integer'
688
+ ts '#sum / Integer -> Integer'
689
+ ts '#swapcase / -> String'
690
+ ts '#swapcase! / -> String'
691
+ ts '#to_c / -> Complex'
692
+ ts '#to_f / -> Float'
693
+ ts '#to_i / -> Integer'
694
+ ts '#to_i / Integer -> Integer'
695
+ ts '#to_r / -> Rational'
696
+ ts '#to_s / -> String'
697
+ ts '#to_str / -> String'
698
+ ts '#to_sym / -> Symbol'
699
+ ts '#tr / String -> String -> String'
700
+ ts '#tr! / String -> String -> String'
701
+ ts '#tr_s / String -> String -> String'
702
+ ts '#tr_s! / String -> String -> String'
703
+ ts '#unpack / String -> String'
704
+ ts '#upcase / -> String'
705
+ ts '#upcase! / -> String'
706
+ ts '#upto / String -> &(String -> unit) -> String'
707
+ ts '#upto / String -> Enumerator[String]'
708
+ ts '#upto / String -> Boolean -> &(String -> unit) -> String'
709
+ ts '#upto / String -> Boolean -> Enumerator[String]'
710
+ ts '#valid_encoding? / -> Boolean'
711
+ end
712
+
713
+ ts 'type Range[T]'
714
+ class Range
715
+ ts '#initialize / [T] -> [T] -> Range[T]'
716
+ ts '#initialize / [T] -> [T] -> Boolean -> Range[T]'
717
+ ts '#== / Range[T] -> Boolean'
718
+ ts '#=== / Range[T] -> Boolean'
719
+ ts '#begin / -> [T]'
720
+ ts '#bsearch / &([T] -> Boolean) -> [T]'
721
+ ts '#cover? / [T] -> Boolean'
722
+ ts '#each / -> Enumerator[T]'
723
+ ts '#each / &([T] -> unit) -> Object'
724
+ ts '#end / -> [T]'
725
+ ts '#eql? / Range[T] -> Boolean'
726
+ ts '#exclude_end? / -> Boolean'
727
+ ts '#first / -> [T]'
728
+ ts '#first / Integer -> Array[T]'
729
+ ts '#hash / -> Fixnum'
730
+ ts '#include? / [T] -> Boolean'
731
+ ts '#inspect / -> String'
732
+ ts '#last / -> [T]'
733
+ ts '#last / Integer -> Array[T]'
734
+ ts '#max / -> [T]'
735
+ ts '#max / &(Pair[T][T] -> Integer) -> [T]'
736
+ ts '#max / Integer -> Array[T]'
737
+ ts '#max / Integer -> &(Pair[T][T] -> Integer) -> Array[T]'
738
+ ts '#member? / [T] -> Boolean'
739
+ ts '#min / -> [T]'
740
+ ts '#min / &(Pair[T][T] -> Integer) -> [T]'
741
+ ts '#min / Integer -> Array[T]'
742
+ ts '#min / Integer -> &(Pair[T][T] -> Integer) -> Array[T]'
743
+ ts '#size / -> Integer'
744
+ ts '#step / &([T] -> unit) -> Range[T]'
745
+ ts '#step / -> Enumerator[T]'
746
+ ts '#step / Integer -> &([T] -> unit) -> Range[T]'
747
+ ts '#step / Integer -> Enumerator[T]'
748
+ ts '#to_s / -> String'
749
+ end
750
+
751
+ class Numeric
752
+ ts '#% / Numeric -> Float'
753
+ ts '#+@ / -> Numeric'
754
+ ts '#-@ / -> Numeric'
755
+ ts '#<=> / Numeric -> Integer'
756
+ ts '#abs / -> Numeric'
757
+ ts '#abs2 / -> Float'
758
+ ts '#angle / -> Float'
759
+ ts '#arg / -> Float'
760
+ ts '#ceil / -> Integer'
761
+ # ts '#coerce
762
+ ts '#conj / -> Numeric'
763
+ ts '#conjugate / -> Numeric'
764
+ ts '#denominator / -> Integer'
765
+ ts '#div / Numeric -> Integer'
766
+ ts '#divmod / Numeric -> Array[Numeric]'
767
+ ts '#eql? / Numeric -> Boolean'
768
+ ts '#fdiv / Numeric -> Float'
769
+ ts '#floor / -> Integer'
770
+ ts '#i / -> Complex'
771
+ ts '#imag / -> Integer'
772
+ ts '#imaginary / -> Integer'
773
+ #ts '#initialize_copy /
774
+ ts '#integer? /-> Boolean'
775
+ ts '#magnitude / -> Numeric'
776
+ ts '#modulo / Numeric -> Array[Numeric]'
777
+ ts '#nonzero? / -> Numeric'
778
+ ts '#numerator / -> Integer'
779
+ ts '#phase / -> Float'
780
+ ts '#polar / -> Array[Numeric]'
781
+ ts '#quo / Numeric -> Numeric'
782
+ ts '#real / -> Numeric'
783
+ ts '#real? / -> Boolean'
784
+ ts '#rect / -> Array[Numeric]'
785
+ ts '#rectangular / -> Array[Numeric]'
786
+ ts '#remainder / Numeric -> Float'
787
+ ts '#round / -> Numeric'
788
+ ts '#round / Integer -> Numeric'
789
+ #ts '#singleton_method_added'
790
+ #ts '#step
791
+ ts '#to_c / -> Complex'
792
+ ts '#to_int / -> Integer'
793
+ ts '#truncate / -> Integer'
794
+ ts '#zero? / -> Boolean'
795
+ end
796
+
797
+ class Integer
798
+ ts '#chr / -> String'
799
+ ts '#chr / Encoding -> String'
800
+ ts '#downto / Integer -> Enumerator[Integer]'
801
+ ts '#downto / Integer -> &(Integer -> unit) -> Integer'
802
+ ts '#even? / -> Boolean'
803
+ ts '#gcd / Integer -> Integer'
804
+ ts '#gcdlcm / Integer -> Array[Integer]'
805
+ ts '#lcm / Integer -> Integer'
806
+ ts '#next / -> Integer'
807
+ ts '#numerator / -> Integer'
808
+ ts '#odd? / -> Boolean'
809
+ ts '#ord / -> Boolean'
810
+ ts '#pred / -> Integer'
811
+ ts '#rationalize / -> Rational'
812
+ ts '#rationalize / Object -> Rational'
813
+ ts '#round / -> Float'
814
+ ts '#round / Integer -> Float'
815
+ ts '#succ / -> Integer'
816
+ ts '#times / &(Integer -> unit) -> Integer'
817
+ ts '#times / -> Enumerator[Integer]'
818
+ ts '#to_i / -> Integer'
819
+ ts '#to_r / -> Rational'
820
+ ts '#upto / Integer -> Enumerator[Integer]'
821
+ ts '#upto / Integer -> &(Integer -> unit) -> Integer'
822
+
823
+ [:+, :-, :*, :/, :**, :&, :|, :^, :[], :<<, :>>].each do |method|
824
+ ts "##{method} / Integer -> Integer"
825
+ define_method(method){ |_| fail StandardError.new("Error invoking abstract method Integer##{method}") }
826
+ end
827
+ [:~, :size, :bit_length].each do |method|
828
+ ts "##{method} / -> Integer"
829
+ define_method(method){ fail StandardError.new("Error invoking abstract method Integer##{method}") }
830
+ end
831
+ end
832
+
833
+ class Float
834
+ ts '#+@ / -> Float'
835
+ ts '#-@ / -> Float'
836
+ ts '#< / Float -> Boolean'
837
+ ts '#<= / Float -> Boolean'
838
+ ts '#> / Float -> Boolean'
839
+ ts '#>= / Float -> Boolean'
840
+ ts '#abs / -> Float'
841
+ ts '#coerce / Numeric -> Array[Float]'
842
+ ts '#fdiv / Numeric -> Float'
843
+ ts '#finite? / -> Boolean'
844
+ ts '#floor / -> Integer'
845
+ ts '#hash / -> Integer'
846
+ ts '#infinite? / -> Boolean'
847
+ ts '#inspect / -> String'
848
+ ts '#magnitude / -> Float'
849
+ ts '#modulo / Numeric -> Float'
850
+ ts '#nan? / -> Boolean'
851
+ ts '#next_float / -> Float'
852
+ ts '#numerator / -> Integer'
853
+ ts '#phase / -> Float'
854
+ ts '#prev_float / -> Float'
855
+ ts '#quo / Numeric -> Float'
856
+ ts '#rationalize / -> Rational'
857
+ ts '#rationalize / Object -> Rational'
858
+ ts '#round / -> Float'
859
+ ts '#round / Integer -> Float'
860
+ ts '#to_f / -> Float'
861
+ ts '#to_i / -> Integer'
862
+ ts '#to_int / -> Integer'
863
+ ts '#to_r / -> Rational'
864
+ ts '#to_s / -> String'
865
+ ts '#truncate / -> Integer'
866
+ ts '#zero? / -> Boolean'
867
+
868
+ [:+, :-, :*, :/, :**].each do |method|
869
+ ts "##{method} / Float -> Float"
870
+ end
871
+ end
872
+
873
+
874
+ class Regexp
875
+ ts '.compile / Object -> unit'
876
+ ts '.compile / Object -> Object -> unit'
877
+ ts '.compile / Object -> Object -> Object -> unit'
878
+ ts '.escape / String -> String'
879
+ ts '.last_match / -> MatchData'
880
+ ts '.quote / String -> String'
881
+ ts '.try_convert / Object -> Regexp'
882
+ ts '.union / Array[Regexp] -> Regexp'
883
+ ts '.union / Regexp... -> Regexp'
884
+ ts '#initialize / Object -> unit'
885
+ ts '#initialize / Object -> Object -> unit'
886
+ ts '#initialize / Object -> Object -> Object -> unit'
887
+ ts '#== / Regexp -> Boolean'
888
+ ts '#=== / String -> Boolean'
889
+ ts '#=~ / String -> Integer'
890
+ ts '#casefold? / -> Boolean'
891
+ ts '#encoding / -> Encoding'
892
+ ts '#eql? / Regexp -> Boolean'
893
+ ts '#fixed_encoding? / -> Boolean'
894
+ ts '#hash / -> Fixnum'
895
+ ts '#inspect / -> String'
896
+ ts '#match / String -> MatchData'
897
+ ts '#match / String -> Integer -> MatchData'
898
+ ts '#named_captures / -> Hash[String][Array[Integer]]'
899
+ ts '#names / -> Array[String]'
900
+ ts '#options / -> Fixnum'
901
+ ts '#source / -> String'
902
+ ts '#to_s / -> String'
903
+ ts '#~ / -> Integer'
904
+ end
905
+
906
+ class MatchData
907
+ ts '#== / MatchData -> Boolean'
908
+ ts '#[] / Object -> Object'
909
+ ts '#[] / Integer -> Integer -> Array[String]'
910
+ ts '#begin / Object -> Integer'
911
+ ts '#captures / -> Array[String]'
912
+ ts '#end / Object -> Array[String]'
913
+ ts '#eql? / MatchData -> Boolean'
914
+ ts '#hash / -> Integer'
915
+ ts '#inspect / -> String'
916
+ ts '#length / -> Integer'
917
+ ts '#names / -> Array[String]'
918
+ ts '#offset / Object -> Array[Integer]'
919
+ ts '#post_match / -> String'
920
+ ts '#pre_match / -> String'
921
+ ts '#regexp / -> Regexp'
922
+ ts '#size / -> Integer'
923
+ ts '#string / -> String'
924
+ ts '#to_a / -> Array[String]'
925
+ ts '#to_s / -> String'
926
+ ts '#values_at / Integer... -> Array[String]'
927
+ end
928
+
929
+ ts 'type Comparable[T]'
930
+ module Comparable
931
+ ts '#<=> / [T] -> Integer'
932
+ def <=>(_); fail StandardError.new("Error invoking abstract method Comparable#<=>"); end
933
+ ts '#< / [T] -> Boolean'
934
+ ts '#<= / [T] -> Boolean'
935
+ ts '#== / [T] -> Boolean'
936
+ ts '#> / [T] -> Boolean'
937
+ ts '#>= / [T] -> Boolean'
938
+ ts '#between? / [T] -> [T] -> Boolean'
939
+ end