rdl 2.0.1 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (252) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +13 -0
  3. data/CHANGES.md +35 -0
  4. data/README.md +153 -116
  5. data/bin/rdl_query +1 -1
  6. data/extras/type_tests/typetests.rb +905 -0
  7. data/lib/rdl.rb +0 -1
  8. data/lib/rdl/boot.rb +108 -77
  9. data/lib/rdl/boot_rails.rb +2 -8
  10. data/lib/rdl/config.rb +44 -17
  11. data/lib/rdl/contracts/flat.rb +1 -1
  12. data/lib/rdl/info.rb +3 -3
  13. data/lib/rdl/query.rb +11 -11
  14. data/lib/rdl/typecheck.rb +399 -136
  15. data/lib/rdl/types/finite_hash.rb +3 -2
  16. data/lib/rdl/types/generic.rb +7 -6
  17. data/lib/rdl/types/intersection.rb +3 -2
  18. data/lib/rdl/types/lexer.rex +2 -3
  19. data/lib/rdl/types/lexer.rex.rb +1 -4
  20. data/lib/rdl/types/method.rb +7 -6
  21. data/lib/rdl/types/nominal.rb +10 -1
  22. data/lib/rdl/types/parser.racc +7 -8
  23. data/lib/rdl/types/parser.tab.rb +108 -109
  24. data/lib/rdl/types/structural.rb +1 -0
  25. data/lib/rdl/types/tuple.rb +2 -2
  26. data/lib/rdl/types/type.rb +8 -8
  27. data/lib/rdl/types/type_inferencer.rb +1 -1
  28. data/lib/rdl/types/union.rb +2 -1
  29. data/lib/rdl/util.rb +28 -3
  30. data/lib/rdl/wrap.rb +216 -165
  31. data/lib/rdl_disable.rb +22 -15
  32. data/lib/types/core.rb +2 -4
  33. data/lib/types/core/_aliases.rb +14 -0
  34. data/lib/types/core/abbrev.rb +3 -0
  35. data/lib/types/core/array.rb +139 -0
  36. data/lib/types/core/base64.rb +8 -0
  37. data/lib/types/core/basic_object.rb +12 -0
  38. data/lib/types/core/benchmark.rb +9 -0
  39. data/lib/types/core/bigdecimal.rb +223 -0
  40. data/lib/types/core/bigmath.rb +10 -0
  41. data/lib/types/core/bignum.rb +214 -0
  42. data/lib/types/core/class.rb +15 -0
  43. data/lib/types/core/complex.rb +123 -0
  44. data/lib/types/core/coverage.rb +4 -0
  45. data/lib/types/core/csv.rb +3 -0
  46. data/lib/types/core/date.rb +4 -0
  47. data/lib/types/core/dir.rb +37 -0
  48. data/lib/types/core/encoding.rb +21 -0
  49. data/lib/types/core/enumerable.rb +96 -0
  50. data/lib/types/core/enumerator.rb +24 -0
  51. data/lib/types/core/exception.rb +15 -0
  52. data/lib/types/core/file.rb +125 -0
  53. data/lib/types/core/fileutils.rb +4 -0
  54. data/lib/types/core/fixnum.rb +213 -0
  55. data/lib/types/core/float.rb +199 -0
  56. data/lib/types/core/gem.rb +19 -0
  57. data/lib/types/core/hash.rb +72 -0
  58. data/lib/types/core/integer.rb +194 -0
  59. data/lib/types/core/io.rb +101 -0
  60. data/lib/types/core/kernel.rb +89 -0
  61. data/lib/types/core/marshal.rb +3 -0
  62. data/lib/types/core/matchdata.rb +24 -0
  63. data/lib/types/core/math.rb +50 -0
  64. data/lib/types/core/module.rb +81 -0
  65. data/lib/types/core/nil.rb +11 -0
  66. data/lib/types/core/numeric.rb +56 -0
  67. data/lib/types/core/object.rb +73 -0
  68. data/lib/types/core/pathname.rb +104 -0
  69. data/lib/types/core/proc.rb +12 -0
  70. data/lib/types/core/process.rb +110 -0
  71. data/lib/types/core/random.rb +13 -0
  72. data/lib/types/core/range.rb +37 -0
  73. data/lib/types/core/rational.rb +207 -0
  74. data/lib/types/core/regexp.rb +28 -0
  75. data/lib/types/core/set.rb +56 -0
  76. data/lib/types/core/string.rb +140 -0
  77. data/lib/types/core/strscan.rb +6 -0
  78. data/lib/types/core/symbol.rb +27 -0
  79. data/lib/types/core/time.rb +66 -0
  80. data/lib/types/core/uri.rb +18 -0
  81. data/lib/types/core/yaml.rb +3 -0
  82. data/lib/types/devise.rb +1 -0
  83. data/lib/types/devise/controller_helpers.rb +3 -0
  84. data/lib/types/devise/parameter_sanitizer.rb +2 -0
  85. data/lib/types/pundit.rb +2 -0
  86. data/lib/types/rails/_helpers.rb +50 -0
  87. data/lib/types/rails/abstract_controller/translation.rb +2 -0
  88. data/lib/types/rails/action_controller/base.rb +3 -0
  89. data/lib/types/rails/action_controller/instrumentation.rb +6 -0
  90. data/lib/types/rails/action_controller/metal.rb +3 -0
  91. data/lib/types/rails/action_controller/mime_responds.rb +13 -0
  92. data/lib/types/rails/action_controller/parameters.rb +3 -0
  93. data/lib/types/{rails-5.x → rails}/action_controller/strong_parameters.rb +4 -8
  94. data/lib/types/rails/action_dispatch/flashhash.rb +8 -0
  95. data/lib/types/rails/action_dispatch/routing.rb +10 -0
  96. data/lib/types/rails/action_mailer/base.rb +2 -0
  97. data/lib/types/rails/action_mailer/message_delivery.rb +2 -0
  98. data/lib/types/rails/action_view/helpers_sanitizehelper.rb +2 -0
  99. data/lib/types/rails/action_view/helpers_urlhelper.rb +5 -0
  100. data/lib/types/rails/active_model/errors.rb +14 -0
  101. data/lib/types/rails/active_model/validations.rb +2 -0
  102. data/lib/types/rails/active_record/associations.rb +208 -0
  103. data/lib/types/rails/active_record/base.rb +2 -0
  104. data/lib/types/rails/active_record/core.rb +2 -0
  105. data/lib/types/rails/active_record/finder_methods.rb +2 -0
  106. data/lib/types/rails/active_record/model_schema.rb +37 -0
  107. data/lib/types/rails/active_record/relation.rb +11 -0
  108. data/lib/types/rails/active_record/schema_types.rb +51 -0
  109. data/lib/types/rails/active_record/validations.rb +2 -0
  110. data/lib/types/rails/active_support/base.rb +2 -0
  111. data/lib/types/rails/active_support/logger.rb +3 -0
  112. data/lib/types/rails/active_support/tagged_logging.rb +2 -0
  113. data/lib/types/rails/active_support/time_with_zone.rb +13 -0
  114. data/lib/types/rails/active_support/time_zone.rb +2 -0
  115. data/lib/types/rails/fixnum.rb +2 -0
  116. data/lib/types/rails/integer.rb +2 -0
  117. data/lib/types/rails/rack/request.rb +2 -0
  118. data/lib/types/rails/string.rb +3 -0
  119. data/lib/types/rails/time.rb +1 -0
  120. data/rdl.gemspec +2 -2
  121. data/test/disabled_test_rdoc.rb +8 -8
  122. data/test/test_alias.rb +1 -0
  123. data/test/test_dsl.rb +4 -4
  124. data/test/test_generic.rb +45 -38
  125. data/test/test_intersection.rb +10 -10
  126. data/test/test_le.rb +103 -102
  127. data/test/test_member.rb +33 -33
  128. data/test/test_parser.rb +101 -96
  129. data/test/test_query.rb +84 -84
  130. data/test/test_rdl.rb +87 -52
  131. data/test/test_rdl_type.rb +26 -9
  132. data/test/test_type_contract.rb +32 -31
  133. data/test/test_typecheck.rb +802 -436
  134. data/test/test_types.rb +39 -39
  135. data/test/test_wrap.rb +3 -2
  136. metadata +91 -120
  137. data/extras/type_tests/%.rb +0 -171
  138. data/extras/type_tests/&.rb +0 -159
  139. data/extras/type_tests/**.rb +0 -222
  140. data/extras/type_tests/*.rb +0 -177
  141. data/extras/type_tests/+.rb +0 -170
  142. data/extras/type_tests/-.rb +0 -171
  143. data/extras/type_tests/1scomp.rb +0 -157
  144. data/extras/type_tests/<.rb +0 -170
  145. data/extras/type_tests/<<.rb +0 -159
  146. data/extras/type_tests/>>.rb +0 -159
  147. data/extras/type_tests/[].rb +0 -163
  148. data/extras/type_tests/^.rb +0 -159
  149. data/extras/type_tests/abs.rb +0 -155
  150. data/extras/type_tests/abs2.rb +0 -164
  151. data/extras/type_tests/angle.rb +0 -157
  152. data/extras/type_tests/arg.rb +0 -157
  153. data/extras/type_tests/bit_length.rb +0 -157
  154. data/extras/type_tests/ceil.rb +0 -157
  155. data/extras/type_tests/ceilRational.rb +0 -160
  156. data/extras/type_tests/conj.rb +0 -158
  157. data/extras/type_tests/defwhere.rb +0 -86
  158. data/extras/type_tests/denominator.rb +0 -157
  159. data/extras/type_tests/div.rb +0 -172
  160. data/extras/type_tests/divslash.rb +0 -179
  161. data/extras/type_tests/even?.rb +0 -157
  162. data/extras/type_tests/fdiv.rb +0 -244
  163. data/extras/type_tests/finite?.rb +0 -157
  164. data/extras/type_tests/floor.rb +0 -157
  165. data/extras/type_tests/floorRational.rb +0 -161
  166. data/extras/type_tests/hash.rb +0 -157
  167. data/extras/type_tests/imag.rb +0 -158
  168. data/extras/type_tests/infinite?.rb +0 -157
  169. data/extras/type_tests/modulo.rb +0 -171
  170. data/extras/type_tests/nan?.rb +0 -157
  171. data/extras/type_tests/neg.rb +0 -155
  172. data/extras/type_tests/next.rb +0 -157
  173. data/extras/type_tests/next_float.rb +0 -157
  174. data/extras/type_tests/numerator.rb +0 -157
  175. data/extras/type_tests/phase.rb +0 -157
  176. data/extras/type_tests/prev_float.rb +0 -157
  177. data/extras/type_tests/quo.rb +0 -179
  178. data/extras/type_tests/rationalize.rb +0 -157
  179. data/extras/type_tests/rationalizeArg.rb +0 -198
  180. data/extras/type_tests/real.rb +0 -157
  181. data/extras/type_tests/real?.rb +0 -157
  182. data/extras/type_tests/round.rb +0 -157
  183. data/extras/type_tests/roundArg.rb +0 -169
  184. data/extras/type_tests/size.rb +0 -157
  185. data/extras/type_tests/to_c.rb +0 -157
  186. data/extras/type_tests/to_f.rb +0 -155
  187. data/extras/type_tests/to_i.rb +0 -157
  188. data/extras/type_tests/to_r.rb +0 -157
  189. data/extras/type_tests/to_s.rb +0 -157
  190. data/extras/type_tests/truncate.rb +0 -157
  191. data/extras/type_tests/truncateArg.rb +0 -166
  192. data/extras/type_tests/type tests +0 -1
  193. data/extras/type_tests/zero?.rb +0 -155
  194. data/extras/type_tests/|.rb +0 -159
  195. data/lib/types/core-ruby-2.x/_aliases.rb +0 -15
  196. data/lib/types/core-ruby-2.x/abbrev.rb +0 -5
  197. data/lib/types/core-ruby-2.x/array.rb +0 -137
  198. data/lib/types/core-ruby-2.x/base64.rb +0 -10
  199. data/lib/types/core-ruby-2.x/basic_object.rb +0 -14
  200. data/lib/types/core-ruby-2.x/benchmark.rb +0 -11
  201. data/lib/types/core-ruby-2.x/bigdecimal.rb +0 -224
  202. data/lib/types/core-ruby-2.x/bigmath.rb +0 -12
  203. data/lib/types/core-ruby-2.x/bignum.rb +0 -214
  204. data/lib/types/core-ruby-2.x/class.rb +0 -17
  205. data/lib/types/core-ruby-2.x/complex.rb +0 -124
  206. data/lib/types/core-ruby-2.x/coverage.rb +0 -6
  207. data/lib/types/core-ruby-2.x/csv.rb +0 -5
  208. data/lib/types/core-ruby-2.x/date.rb +0 -6
  209. data/lib/types/core-ruby-2.x/dir.rb +0 -38
  210. data/lib/types/core-ruby-2.x/encoding.rb +0 -23
  211. data/lib/types/core-ruby-2.x/enumerable.rb +0 -98
  212. data/lib/types/core-ruby-2.x/enumerator.rb +0 -26
  213. data/lib/types/core-ruby-2.x/exception.rb +0 -17
  214. data/lib/types/core-ruby-2.x/file.rb +0 -126
  215. data/lib/types/core-ruby-2.x/fileutils.rb +0 -6
  216. data/lib/types/core-ruby-2.x/fixnum.rb +0 -213
  217. data/lib/types/core-ruby-2.x/float.rb +0 -199
  218. data/lib/types/core-ruby-2.x/gem.rb +0 -247
  219. data/lib/types/core-ruby-2.x/hash.rb +0 -72
  220. data/lib/types/core-ruby-2.x/integer.rb +0 -197
  221. data/lib/types/core-ruby-2.x/io.rb +0 -103
  222. data/lib/types/core-ruby-2.x/kernel.rb +0 -90
  223. data/lib/types/core-ruby-2.x/marshal.rb +0 -5
  224. data/lib/types/core-ruby-2.x/matchdata.rb +0 -26
  225. data/lib/types/core-ruby-2.x/math.rb +0 -53
  226. data/lib/types/core-ruby-2.x/module.rb +0 -83
  227. data/lib/types/core-ruby-2.x/nil.rb +0 -12
  228. data/lib/types/core-ruby-2.x/numeric.rb +0 -56
  229. data/lib/types/core-ruby-2.x/object.rb +0 -75
  230. data/lib/types/core-ruby-2.x/pathname.rb +0 -106
  231. data/lib/types/core-ruby-2.x/proc.rb +0 -16
  232. data/lib/types/core-ruby-2.x/process.rb +0 -127
  233. data/lib/types/core-ruby-2.x/random.rb +0 -17
  234. data/lib/types/core-ruby-2.x/range.rb +0 -39
  235. data/lib/types/core-ruby-2.x/rational.rb +0 -209
  236. data/lib/types/core-ruby-2.x/regexp.rb +0 -30
  237. data/lib/types/core-ruby-2.x/set.rb +0 -58
  238. data/lib/types/core-ruby-2.x/string.rb +0 -143
  239. data/lib/types/core-ruby-2.x/strscan.rb +0 -7
  240. data/lib/types/core-ruby-2.x/symbol.rb +0 -29
  241. data/lib/types/core-ruby-2.x/time.rb +0 -68
  242. data/lib/types/core-ruby-2.x/uri.rb +0 -20
  243. data/lib/types/core-ruby-2.x/yaml.rb +0 -5
  244. data/lib/types/rails-5.x/_helpers.rb +0 -52
  245. data/lib/types/rails-5.x/action_controller/mime_responds.rb +0 -11
  246. data/lib/types/rails-5.x/action_dispatch/routing.rb +0 -10
  247. data/lib/types/rails-5.x/active_model/errors.rb +0 -15
  248. data/lib/types/rails-5.x/active_model/validations.rb +0 -5
  249. data/lib/types/rails-5.x/active_record/associations.rb +0 -190
  250. data/lib/types/rails-5.x/active_record/core.rb +0 -3
  251. data/lib/types/rails-5.x/active_record/model_schema.rb +0 -39
  252. data/lib/types/rails-5.x/fixnum.rb +0 -3
@@ -0,0 +1,19 @@
1
+ RDL.nowrap :Gem
2
+
3
+ RDL.type :Gem, 'self.bin_path', '(String name, ?String exec_name, *Gem::Requirement requirements) -> String'
4
+ RDL.type :Gem, 'self.binary_mode', '() -> String'
5
+ RDL.type :Gem, 'self.bindir', '(?String install_dir) -> String'
6
+ RDL.type :Gem, 'self.clear_default_specs', '() -> Hash'
7
+ RDL.type :Gem, 'self.clear_paths', '() -> nil'
8
+ RDL.type :Gem, 'self.config_file', '() -> String'
9
+ RDL.type :Gem, 'self.configuration', '() -> Gem::ConfigFile'
10
+ RDL.type :Gem, 'self.configuration=', '(%any) -> %any' #returns param
11
+ RDL.type :Gem, 'self.datadir', '(String gem_name) -> String or nil'
12
+ RDL.type :Gem, 'self.default_bindir', '() -> String or nil'
13
+ RDL.type :Gem, 'self.default_cert_path', '() -> String or nil'
14
+ RDL.type :Gem, 'self.default_dir', '() -> String or nil'
15
+ RDL.type :Gem, 'self.default_exec_format', '() -> String or nil'
16
+ RDL.type :Gem, 'self.default_key_path', '() -> String or nil'
17
+ RDL.type :Gem, 'self.default_path', '() -> String or nil'
18
+ RDL.type :Gem, 'self.default_rubygems_dirs', '() -> Array<String> or nil'
19
+ RDL.type :Gem, 'self.default_sources', '() -> Array<String> or nil'
@@ -0,0 +1,72 @@
1
+ RDL.nowrap :Hash
2
+
3
+ RDL.type_params :Hash, [:k, :v], :all?
4
+
5
+ RDL.type :Hash, 'self.[]', '(*u) -> Hash<u, u>' # example: Hash[1,2,3,4]
6
+ RDL.type :Hash, 'self.[]', '(Array<[a,b]>) -> Hash<a, b>'
7
+ RDL.type :Hash, 'self.[]', '([to_hash: () -> Hash<a, b>]) -> Hash<a, b>'
8
+
9
+ RDL.type :Hash, :[], '(k) -> v'
10
+ RDL.type :Hash, :[]=, '(k, v) -> v'
11
+ RDL.type :Hash, :store, '(k,v) -> v'
12
+
13
+ # RDL.type :Hash, :assoc, '(k) -> [k, v]' # TODO
14
+ RDL.type :Hash, :assoc, '(k) -> Array<k or v>'
15
+ RDL.type :Hash, :clear, '() -> Hash<k,v>'
16
+ RDL.type :Hash, :compare_by_identity, '() -> Hash<k,v>'
17
+ RDL.type :Hash, :compare_by_identity?, '() -> %bool'
18
+ RDL.type :Hash, :default, '(?k) -> v'
19
+ RDL.type :Hash, :default, '(k) {(k) -> v} -> v'
20
+ RDL.type :Hash, :default=, '(v) -> v'
21
+
22
+ # TODO: check on default_proc
23
+ # RDL.type :Hash, :default_proc, '() -> (Hash<k,v>,k) -> v'
24
+ # RDL.type :Hash, :default_proc=, '((Hash<k,v>,k) -> v) -> (Hash<k,v>,k) -> v'
25
+
26
+ RDL.type :Hash, :delete, '(k) -> v'
27
+ RDL.type :Hash, :delete, '(k) { (k) -> u } -> u or v'
28
+ RDL.type :Hash, :delete_if, '() { (k,v) -> %bool } -> Hash<k,v>'
29
+ RDL.type :Hash, :delete_if, '() -> Enumerator<[k, v]>'
30
+ RDL.type :Hash, :each, '() { (k,v) -> %any } -> Hash<k,v>'
31
+ RDL.type :Hash, :each, '() -> Enumerator<[k, v]>'
32
+ RDL.type :Hash, :each_pair, '() { (k,v) -> %any } -> Hash<k,v>'
33
+ RDL.type :Hash, :each_pair, '() -> Enumerator<[k, v]>'
34
+ RDL.type :Hash, :each_key, '() { (k) -> %any } -> Hash<k,v>'
35
+ RDL.type :Hash, :each_key, '() -> Enumerator<[k, v]>'
36
+ RDL.type :Hash, :each_value, '() { (v) -> %any } -> Hash<k,v>'
37
+ RDL.type :Hash, :each_value, '() -> Enumerator<[k, v]>'
38
+ RDL.type :Hash, :empty?, '() -> %bool'
39
+ RDL.type :Hash, :fetch, '(k) -> v'
40
+ RDL.type :Hash, :fetch, '(k,u) -> u or v'
41
+ RDL.type :Hash, :fetch, '(k) { (k) -> u } -> u or v'
42
+ RDL.type :Hash, :member?, '(t) -> %bool'
43
+ RDL.type :Hash, :has_key?, '(t) -> %bool'
44
+ RDL.type :Hash, :key?, '(t) -> %bool'
45
+ RDL.type :Hash, :has_value?, '(t) -> %bool'
46
+ RDL.type :Hash, :value?, '(t) -> %bool'
47
+ RDL.type :Hash, :to_s, '() -> String'
48
+ RDL.type :Hash, :inspect, '() -> String'
49
+ RDL.type :Hash, :invert, '() -> Hash<v,k>'
50
+ RDL.type :Hash, :keep_if, '() { (k,v) -> %bool } -> Hash<k,v>'
51
+ RDL.type :Hash, :keep_if, '() -> Enumerator<[k, v]>'
52
+ RDL.type :Hash, :key, '(t) -> k'
53
+ RDL.type :Hash, :keys, '() -> Array<k>'
54
+ RDL.type :Hash, :length, '() -> Integer'
55
+ RDL.type :Hash, :size, '() -> Integer'
56
+ RDL.type :Hash, :merge, '(Hash<a,b>) -> Hash<a or k, b or v>'
57
+ RDL.type :Hash, :merge, '(Hash<a,b>) { (k,v,b) -> v or b } -> Hash<a or k, b or v>'
58
+ # RDL.type :Hash, :rassoc, '(k) -> Tuple<k,v>'
59
+ RDL.type :Hash, :rassoc, '(k) -> Array<k or v>'
60
+ RDL.type :Hash, :rehash, '() -> Hash<k,v>'
61
+ RDL.type :Hash, :reject, '() -> Enumerator<[k, v]>'
62
+ RDL.type :Hash, :reject, '() {(k,v) -> %bool} -> Hash<k,v>'
63
+ RDL.type :Hash, :reject!, '() {(k,v) -> %bool} -> Hash<k,v>'
64
+ RDL.type :Hash, :select, '() {(k,v) -> %bool} -> Hash<k,v>'
65
+ RDL.type :Hash, :select!, '() {(k,v) -> %bool} -> Hash<k,v>'
66
+ # RDL.type :Hash, :shift, '() -> Tuple<k,v>'
67
+ RDL.type :Hash, :shift, '() -> Array<k or v>'
68
+ # RDL.type :Hash, :to_a, '() -> Array<Tuple<k,v>>'
69
+ RDL.type :Hash, :to_a, '() -> Array<Array<k or v>>'
70
+ RDL.type :Hash, :to_hash, '() -> Hash<k,v>'
71
+ RDL.type :Hash, :values, '() -> Array<v>'
72
+ RDL.type :Hash, :values_at, '(*k) -> Array<v>'
@@ -0,0 +1,194 @@
1
+ RDL.nowrap :Integer
2
+
3
+ RDL.type :Integer, :%, '(Integer x {{ x!=0 }}) -> Integer'
4
+ RDL.type :Integer, :%, '(Float x {{ x!=0 }}) -> Float'
5
+ RDL.type :Integer, :%, '(Rational x {{ x!=0 }}) -> Rational'
6
+ RDL.type :Integer, :%, '(BigDecimal x {{ x!=0 }}) -> BigDecimal'
7
+
8
+ RDL.type :Integer, :&, '(Integer) -> Integer'
9
+
10
+ RDL.type :Integer, :*, '(Integer) -> Integer'
11
+ RDL.type :Integer, :*, '(Float) -> Float'
12
+ RDL.type :Integer, :*, '(Rational) -> Rational'
13
+ RDL.type :Integer, :*, '(BigDecimal) -> BigDecimal'
14
+ RDL.type :Integer, :*, '(Complex) -> Complex'
15
+ RDL.pre(:Integer, :*) { |x| if (x.real.is_a?(BigDecimal)||x.imaginary.is_a?(BigDecimal)) then (if x.real.is_a?(Float) then (x.real!=Float::INFINITY && !(x.real.nan?)) elsif(x.imaginary.is_a?(Float)) then x.imaginary!=Float::INFINITY && !(x.imaginary.nan?) else true end) else true end} #can't have a complex with part BigDecimal, other part infinity/NAN
16
+
17
+ RDL.type :Integer, :**, '(Integer) -> %numeric'
18
+ RDL.type :Integer, :**, '(Float) -> %numeric'
19
+ RDL.type :Integer, :**, '(Rational) -> %numeric'
20
+ RDL.type :Integer, :**, '(BigDecimal) -> BigDecimal'
21
+ RDL.pre(:Integer, :**) { |x| x!=BigDecimal::INFINITY && if self<0 then x<=-1||x>=0 else true end}
22
+ RDL.post(:Integer, :**) { |r,x| r.real?}
23
+ RDL.type :Integer, :**, '(Complex) -> Complex'
24
+ RDL.pre(:Integer, :**) { |x| x!=0 && if (x.real.is_a?(BigDecimal)||x.imaginary.is_a?(BigDecimal)) then (if x.real.is_a?(Float) then (x.real!=Float::INFINITY && !(x.real.nan?)) elsif(x.imaginary.is_a?(Float)) then x.imaginary!=Float::INFINITY && !(x.imaginary.nan?) else true end) else true end}
25
+
26
+ RDL.type :Integer, :+, '(Integer) -> Integer'
27
+ RDL.type :Integer, :+, '(Float) -> Float'
28
+ RDL.type :Integer, :+, '(Rational) -> Rational'
29
+ RDL.type :Integer, :+, '(BigDecimal) -> BigDecimal'
30
+ RDL.type :Integer, :+, '(Complex) -> Complex'
31
+
32
+ RDL.type :Integer, :-, '(Integer) -> Integer'
33
+ RDL.type :Integer, :-, '(Float) -> Float'
34
+ RDL.type :Integer, :-, '(Rational) -> Rational'
35
+ RDL.type :Integer, :-, '(BigDecimal) -> BigDecimal'
36
+ RDL.type :Integer, :-, '(Complex) -> Complex'
37
+
38
+ RDL.type :Integer, :-@, '() -> Integer'
39
+
40
+ RDL.type :Integer, :+@, '() -> Integer'
41
+
42
+ RDL.type :Integer, :/, '(Integer x {{ x!=0 }}) -> Integer'
43
+ RDL.type :Integer, :/, '(Float x {{ x!=0 }}) -> Float'
44
+ RDL.type :Integer, :/, '(Rational x {{ x!=0 }}) -> Rational'
45
+ RDL.type :Integer, :/, '(BigDecimal x {{ x!=0 }}) -> BigDecimal'
46
+ RDL.type :Integer, :/, '(Complex x {{ x!=0 }}) -> Complex'
47
+ RDL.pre(:Integer, :/) { |x| x!=0 && if (x.real.is_a?(BigDecimal)||x.imaginary.is_a?(BigDecimal)) then (if x.real.is_a?(Float) then (x.real!=Float::INFINITY && !(x.real.nan?)) elsif(x.imaginary.is_a?(Float)) then x.imaginary!=Float::INFINITY && !(x.imaginary.nan?) else true end) else true end && if (x.real.is_a?(Rational) && x.imaginary.is_a?(Float)) then !x.imaginary.nan? else true end}
48
+
49
+ RDL.type :Integer, :<, '(Integer) -> %bool'
50
+ RDL.type :Integer, :<, '(Float) -> %bool'
51
+ RDL.type :Integer, :<, '(Rational) -> %bool'
52
+ RDL.type :Integer, :<, '(BigDecimal) -> %bool'
53
+
54
+ RDL.type :Integer, :<<, '(Integer) -> Integer'
55
+
56
+ RDL.type :Integer, :<=, '(Integer) -> %bool'
57
+ RDL.type :Integer, :<=, '(Float) -> %bool'
58
+ RDL.type :Integer, :<=, '(Rational) -> %bool'
59
+ RDL.type :Integer, :<=, '(BigDecimal) -> %bool'
60
+
61
+ RDL.type :Integer, :<=>, '(Integer) -> Object'
62
+ RDL.post(:Integer, :<=>) { |r,x| r == -1 || r == 0 || r == 1 }
63
+ RDL.type :Integer, :<=>, '(Float) -> Object'
64
+ RDL.post(:Integer, :<=>) { |r,x| r == -1 || r == 0 || r == 1 }
65
+ RDL.type :Integer, :<=>, '(Rational) -> Object'
66
+ RDL.post(:Integer, :<=>) { |r,x| r == -1 || r == 0 || r == 1 }
67
+ RDL.type :Integer, :<=>, '(BigDecimal) -> Object'
68
+ RDL.post(:Integer, :<=>) { |r,x| r == -1 || r == 0 || r == 1 }
69
+
70
+ RDL.type :Integer, :==, '(Object) -> %bool'
71
+
72
+ RDL.type :Integer, :===, '(Object) -> %bool'
73
+
74
+ RDL.type :Integer, :>, '(Integer) -> %bool'
75
+ RDL.type :Integer, :>, '(Float) -> %bool'
76
+ RDL.type :Integer, :>, '(Rational) -> %bool'
77
+ RDL.type :Integer, :>, '(BigDecimal) -> %bool'
78
+
79
+ RDL.type :Integer, :>=, '(Integer) -> %bool'
80
+ RDL.type :Integer, :>=, '(Float) -> %bool'
81
+ RDL.type :Integer, :>=, '(Rational) -> %bool'
82
+ RDL.type :Integer, :>=, '(BigDecimal) -> %bool'
83
+
84
+ RDL.type :Integer, :>>, '(Integer) -> Integer r {{ r >= 0 }}'
85
+
86
+ RDL.type :Integer, :[], '(Integer) -> Integer'
87
+ RDL.post(:Integer, :[]) { |r,x| r == 0 || r==1}
88
+ RDL.type :Integer, :[], '(Rational) -> Integer'
89
+ RDL.post(:Integer, :[]) { |r,x| r == 0 || r==1}
90
+ RDL.type :Integer, :[], '(Float) -> Integer'
91
+ RDL.pre(:Integer, :[]) { |x| x != Float::INFINITY && !x.nan? }
92
+ RDL.post(:Integer, :[]) { |r,x| r == 0 || r==1}
93
+ RDL.type :Integer, :[], '(BigDecimal) -> Integer'
94
+ RDL.pre(:Integer, :[]) { |x| x != BigDecimal::INFINITY && !x.nan? }
95
+ RDL.post(:Integer, :[]) { |r,x| r == 0 || r == 1 }
96
+
97
+ RDL.type :Integer, :^, '(Integer) -> Integer'
98
+
99
+ RDL.type :Integer, :|, '(Integer) -> Integer'
100
+
101
+ RDL.type :Integer, :~, '() -> Integer'
102
+
103
+ RDL.type :Integer, :abs, '() -> Integer r {{ r>=0 }}'
104
+
105
+ RDL.type :Integer, :bit_length, '() -> Integer r {{ r>=0 }}'
106
+
107
+ RDL.type :Integer, :div, '(Integer x {{ x!=0 }}) -> Integer'
108
+ RDL.type :Integer, :div, '(Float x {{ x!=0 && !x.nan? }}) -> Integer'
109
+ RDL.type :Integer, :div, '(Rational x {{ x!=0 }}) -> Integer'
110
+ RDL.type :Integer, :div, '(BigDecimal x {{ x!=0 && !x.nan? }}) -> Integer'
111
+
112
+ RDL.type :Integer, :divmod, '(%real x {{ x!=0 }}) -> [%real, %real]'
113
+ RDL.pre(:Integer, :divmod) { |x| if x.is_a?(Float) then !x.nan? else true end}
114
+
115
+ RDL.type :Integer, :fdiv, '(Integer) -> Float'
116
+ RDL.type :Integer, :fdiv, '(Float) -> Float'
117
+ RDL.type :Integer, :fdiv, '(Rational) -> Float'
118
+ RDL.type :Integer, :fdiv, '(BigDecimal) -> BigDecimal'
119
+ RDL.type :Integer, :fdiv, '(Complex) -> Complex'
120
+ RDL.pre(:Integer, :fdiv) { |x| if (x.real.is_a?(BigDecimal)||x.imaginary.is_a?(BigDecimal)) then (if x.real.is_a?(Float) then (x.real!=Float::INFINITY && !(x.real.nan?)) elsif(x.imaginary.is_a?(Float)) then x.imaginary!=Float::INFINITY && !(x.imaginary.nan?) else true end) else true end && if (x.real.is_a?(Rational) && x.imaginary.is_a?(Float)) then !x.imaginary.nan? else true end}
121
+
122
+ RDL.type :Integer, :to_s, '() -> String'
123
+ RDL.type :Integer, :inspect, '() -> String'
124
+
125
+ RDL.type :Integer, :magnitude, '() -> Integer r {{ r>=0 }}'
126
+
127
+ RDL.type :Integer, :modulo, '(Integer x {{ x!=0 }}) -> Integer'
128
+ RDL.type :Integer, :modulo, '(Float x {{ x!=0 }}) -> Float'
129
+ RDL.type :Integer, :modulo, '(Rational x {{ x!=0 }}) -> Rational'
130
+ RDL.type :Integer, :modulo, '(BigDecimal x {{ x!=0 }}) -> BigDecimal'
131
+
132
+ RDL.type :Integer, :quo, '(Integer x {{ x!=0 }}) -> Rational'
133
+ RDL.type :Integer, :quo, '(Float x {{ x!=0 }}) -> Float'
134
+ RDL.type :Integer, :quo, '(Rational x {{ x!=0 }}) -> Rational'
135
+ RDL.type :Integer, :quo, '(BigDecimal x {{ x!=0 }}) -> BigDecimal'
136
+ RDL.type :Integer, :quo, '(Complex x {{ x!=0 }}) -> Complex'
137
+ RDL.pre(:Integer, :quo) { |x| if (x.real.is_a?(BigDecimal)||x.imaginary.is_a?(BigDecimal)) then (if x.real.is_a?(Float) then (x.real!=Float::INFINITY && !(x.real.nan?)) elsif(x.imaginary.is_a?(Float)) then x.imaginary!=Float::INFINITY && !(x.imaginary.nan?) else true end) else true end && if (x.real.is_a?(Rational) && x.imaginary.is_a?(Float)) then !x.imaginary.nan? else true end}
138
+
139
+ RDL.type :Integer, :abs2, '() -> Integer r {{ r>=0 }}'
140
+ RDL.type :Integer, :angle, '() -> %numeric'
141
+ RDL.post(:Integer, :angle) { |r,x| r == 0 || r == Math::PI}
142
+ RDL.type :Integer, :arg, '() -> %numeric'
143
+ RDL.post(:Integer, :arg) { |r,x| r == 0 || r == Math::PI}
144
+ RDL.type :Integer, :equal?, '(Object) -> %bool'
145
+ RDL.type :Integer, :eql?, '(Object) -> %bool'
146
+ RDL.type :Integer, :hash, '() -> Integer'
147
+ RDL.type :Integer, :ceil, '() -> Integer'
148
+ RDL.type :Integer, :chr, '(Encoding) -> String'
149
+ RDL.type :Integer, :coerce, '(%numeric) -> [%real, %real]'
150
+ RDL.pre(:Integer, :coerce) { |x| if x.is_a?(Complex) then x.imaginary==0 else true end}
151
+ RDL.type :Integer, :conj, '() -> Integer'
152
+ RDL.type :Integer, :conjugate, '() -> Integer'
153
+ RDL.type :Integer, :denominator, '() -> Integer'
154
+ RDL.post(:Integer, :denominator) { |r,x| r == 1 }
155
+ RDL.type :Integer, :downto, '(Integer) { (Integer) -> %any } -> Integer'
156
+ RDL.type :Integer, :downto, '(Integer limit) -> Enumerator<Integer>'
157
+ RDL.type :Integer, :even?, '() -> %bool'
158
+ RDL.type :Integer, :gcd, '(Integer) -> Integer'
159
+ RDL.type :Integer, :gcdlcm, '(Integer) -> [Integer, Integer]'
160
+ RDL.type :Integer, :floor, '() -> Integer'
161
+ RDL.type :Integer, :imag, '() -> Integer r {{ r==0 }}'
162
+ RDL.type :Integer, :imaginary, '() -> Integer r {{ r==0 }}'
163
+ RDL.type :Integer, :integer?, '() -> true'
164
+ RDL.type :Integer, :lcm, '(Integer) -> Integer'
165
+ RDL.type :Integer, :next, '() -> Integer'
166
+ RDL.type :Integer, :numerator, '() -> Integer'
167
+ RDL.type :Integer, :odd?, '() -> %bool'
168
+ RDL.type :Integer, :ord, '() -> Integer'
169
+ RDL.type :Integer, :phase, '() -> %numeric'
170
+ RDL.type :Integer, :pred, '() -> Integer'
171
+ RDL.type :Integer, :rationalize, '() -> Rational'
172
+ RDL.type :Integer, :rationalize, '(%numeric) -> Rational'
173
+ RDL.type :Integer, :real, '() -> Integer'
174
+ RDL.type :Integer, :real?, '() -> true'
175
+ RDL.type :Integer, :remainder, '(Integer x {{ x!=0 }}) -> Integer r {{ r>=0 }}'
176
+ RDL.type :Integer, :remainder, '(Float x {{ x!=0 }}) -> Float'
177
+ RDL.type :Integer, :remainder, '(Rational x {{ x!=0 }}) -> Rational r {{ r>=0 }}'
178
+ RDL.type :Integer, :remainder, '(BigDecimal x {{ x!=0 }}) -> BigDecimal'
179
+ RDL.type :Integer, :round, '() -> Integer'
180
+ RDL.type :Integer, :round, '(%numeric) -> %numeric'
181
+ RDL.pre(:Integer, :round) { |x| x!=0 && if x.is_a?(Complex) then x.imaginary==0 && (if x.real.is_a?(Float)||x.real.is_a?(BigDecimal) then !x.real.infinite? && !x.real.nan? else true end) elsif x.is_a?(Float) then x!=Float::INFINITY && !x.nan? elsif x.is_a?(BigDecimal) then x!=BigDecimal::INFINITY && !x.nan? else true end} #Also, x must be in range [-2**31, 2**31].
182
+ RDL.type :Integer, :size, '() -> Integer'
183
+ RDL.type :Integer, :succ, '() -> Integer'
184
+ RDL.type :Integer, :times, '() { (Integer) -> %any } -> Integer'
185
+ RDL.type :Integer, :times, '() -> Enumerator<Integer>'
186
+ RDL.type :Integer, :to_c, '() -> Complex r {{ r.imaginary==0 }}'
187
+ RDL.type :Integer, :to_f, '() -> Float'
188
+ RDL.type :Integer, :to_i, '() -> Integer'
189
+ RDL.type :Integer, :to_int, '() -> Integer'
190
+ RDL.type :Integer, :to_r, '() -> Rational'
191
+ RDL.type :Integer, :truncate, '() -> Integer'
192
+ RDL.type :Integer, :upto, '(Integer) { (Integer) -> %any } -> Integer'
193
+ RDL.type :Integer, :upto, '(Integer) -> Enumerator<Integer>'
194
+ RDL.type :Integer, :zero?, '() -> %bool'
@@ -0,0 +1,101 @@
1
+ RDL.nowrap :IO # Do not wrap this class. Leads to mysterious errors.
2
+
3
+ RDL.type :IO, :initialize, '(Integer fd, ?Integer mode, ?Integer opt) -> self'
4
+ RDL.type :IO, 'self.binread', '(String name, ?Integer length, ?Integer offset) -> String'
5
+ RDL.type :IO, 'self.binwrite', '(String name, String, ?Integer offset, %open_args) -> Integer'
6
+ RDL.type :IO, 'self.copy_stream', '(String or IO src, String or IO dst, ?Integer copy_length, ?Integer src_offset) -> Integer'
7
+ RDL.rdl_alias :IO, 'self.for_fd', 'initialize'
8
+ RDL.type :IO, 'self.foreach', '(String name, ?String sep, ?Integer limit, %open_args) { (String) -> %any } -> nil'
9
+ RDL.type :IO, 'self.foreach', '(String name, ?String sep, ?Integer limit, %open_args) -> Enumerator<String>'
10
+ RDL.type :IO, 'self.open', '(Integer fd, ?String mode, %open_args) -> IO'
11
+ RDL.type :IO, 'self.open', '(Integer fd, ?String mode, %open_args) { (IO) -> t } -> t'
12
+ RDL.type :IO, 'self.pipe', '(?String ext_or_ext_int_enc, %open_args) -> [IO, IO]'
13
+ RDL.type :IO, 'self.pipe', '(?String ext_enc, ?String int_enc, %open_args) -> [IO, IO]'
14
+ RDL.type :IO, 'self.pipe', '(?String ext_or_ext_int_enc, %open_args) { ([IO, IO]) -> t } -> t'
15
+ RDL.type :IO, 'self.pipe', '(?String ext_enc, ?String int_enc, %open_args) { ([IO, IO]) -> t } -> t'
16
+ RDL.type :IO, 'self.popen', '(?Hash<String, String> env, String cmd, ?String mode, %open_args) -> IO'
17
+ RDL.type :IO, 'self.popen', '(?Hash<String, String> env, String cmd, ?String mode, %open_args) { (IO) -> t } -> t'
18
+ RDL.type :IO, 'self.read', '(String name, ?Integer length, ?Integer offset, %open_args) -> String'
19
+ RDL.type :IO, 'self.readlines', '(String name, ?String sep, ?Integer limit, %open_args) -> Array<String>'
20
+ RDL.type :IO, 'self.select', '(Array<IO> read_array, ?Array<IO> write_array, ?Array<IO> error_array, ?Integer timeout) -> Array<IO> or nil'
21
+ RDL.type :IO, 'self.sysopen', '(String path, ?String mode, ?String perm) -> Integer' # TODO unsure of RDL.type of perm
22
+ RDL.type :IO, 'self.try_convert', '([to_io: () -> IO]) -> IO or nil'
23
+ RDL.type :IO, 'self.write', '(String name, String, ?Integer offset, %open_args) -> Integer'
24
+ RDL.type :IO, :<<, '([to_s: () -> String]) -> self'
25
+ RDL.type :IO, :advise, '(:normal or :sequence or :random or :willneed or :dontneed or :noreuse, ?Integer offset, ?Integer len) -> nil'
26
+ RDL.type :IO, :autoclose=, '(%bool) -> %bool'
27
+ RDL.type :IO, :autoclose?, '() -> %bool'
28
+ RDL.type :IO, :binmode, '() -> self'
29
+ RDL.type :IO, :binmode?, '() -> %bool'
30
+ RDL.rdl_alias :IO, :bytes, :each_byte # deprecated
31
+ RDL.rdl_alias :IO, :chars, :each_char # deprecated
32
+ RDL.type :IO, :close, '() -> nil'
33
+ RDL.type :IO, :close_on_exec=, '(%bool) -> %bool'
34
+ RDL.type :IO, :close_on_exec?, '() -> %bool'
35
+ RDL.type :IO, :close_read, '() -> nil'
36
+ RDL.type :IO, :close_write, '() -> nil'
37
+ RDL.type :IO, :closed?, '() -> %bool'
38
+ RDL.rdl_alias :IO, :codepoints, :each_codepoint # deprecated
39
+ RDL.type :IO, :each, '(?String sep, ?Integer limit) { (String) -> %any } -> self'
40
+ RDL.type :IO, :each, '(?String sep, ?Integer limit) -> Enumerator<String>'
41
+ RDL.rdl_alias :IO, :each_line, :each
42
+ RDL.type :IO, :each_byte, '() { (Integer) -> %any } -> self'
43
+ RDL.type :IO, :each_byte, '() -> Enumerator<Integer>'
44
+ RDL.type :IO, :each_char, '() { (String) -> %any } -> self'
45
+ RDL.type :IO, :each_char, '() -> Enumerator<String>'
46
+ RDL.type :IO, :each_codepoint, '() { (Integer) -> %any } -> self'
47
+ RDL.type :IO, :each_codepoint, '() -> Enumerator<Integer>'
48
+ RDL.type :IO, :eof, '() -> %bool'
49
+ RDL.rdl_alias :IO, :eof?, :eof
50
+ RDL.type :IO, :external_enconding, '() -> Enconding'
51
+ RDL.type :IO, :fcntl, '(Integer integer_cmd, String or Integer arg) -> Integer'
52
+ RDL.type :IO, :fdatasync, '() -> 0 or nil'
53
+ RDL.type :IO, :fileno, '() -> Integer'
54
+ RDL.type :IO, :flush, '() -> self'
55
+ RDL.type :IO, :fsync, '() -> 0 or nil'
56
+ RDL.type :IO, :getbyte, '() -> Integer or nil'
57
+ RDL.type :IO, :getc, '() -> String or nil'
58
+ RDL.type :IO, :gets, '(?String sep, ?Integer limit) -> String or nil'
59
+ RDL.type :IO, :inspect, '() -> String'
60
+ RDL.type :IO, :internal_encoding, '() -> Encoding'
61
+ RDL.type :IO, :ioctl, '(Integer integer_cmd, String or Integer arg) -> Integer'
62
+ RDL.type :IO, :isatty, '() -> %bool'
63
+ RDL.type :IO, :lineno, '() -> Integer'
64
+ RDL.type :IO, :lineno=, '(Integer) -> Integer'
65
+ RDL.rdl_alias :IO, :lines, :each_line # deprecated
66
+ RDL.type :IO, :pid, '() -> Integer'
67
+ RDL.type :IO, :pos, '() -> Integer'
68
+ RDL.type :IO, :pos=, '(Integer) -> Integer'
69
+ RDL.type :IO, :print, '(*[to_s: () -> String]) -> nil'
70
+ RDL.type :IO, :printf, '(String format_string, *%any) -> nil'
71
+ RDL.type :IO, :putc, '(Numeric or String) -> %any'
72
+ RDL.type :IO, :puts, '(*[to_s: () -> String]) -> nil'
73
+ RDL.type :IO, :read, '(?Integer length, ?String outbuf) -> String or nil'
74
+ RDL.type :IO, :read_nonblock, '(Integer maxlen) -> String'
75
+ RDL.type :IO, :read_nonblock, '(Integer maxlen, String outbuf) -> String outbuf'
76
+ RDL.type :IO, :readbyte, '() -> Integer'
77
+ RDL.type :IO, :readchar, '() -> String'
78
+ RDL.type :IO, :readline, '(?String sep, ?Integer limit) -> String'
79
+ RDL.type :IO, :readlines, '(?String sep, ?Integer limit) -> Array<String>'
80
+ RDL.type :IO, :readpartial, '(Integer maxlen) -> String'
81
+ RDL.type :IO, :readpartial, '(Integer maxlen, String outbuf) -> String outbuf'
82
+ RDL.type :IO, :reopen, '(IO other_IO) -> IO'
83
+ RDL.type :IO, :reopen, '(String path, String mode_str) -> IO'
84
+ RDL.type :IO, :rewrind, '() -> 0'
85
+ RDL.type :IO, :seek, '(Integer amount, ?Integer whence) -> 0'
86
+ RDL.type :IO, :set_encoding, '(?String or Encoding ext_or_ext_int_enc) -> self'
87
+ RDL.type :IO, :set_encoding, '(?String or Encoding ext_enc, ?String or Encoding int_enc) -> self'
88
+ RDL.type :IO, :stat, '() -> File::Stat'
89
+ RDL.type :IO, :sync, '() -> %bool'
90
+ RDL.type :IO, :sync=, '(%bool) -> %bool'
91
+ RDL.type :IO, :sysread, '(Integer maxlen, String outbuf) -> String'
92
+ RDL.type :IO, :sysseek, '(Integer amount, ?Integer whence) -> Integer'
93
+ RDL.type :IO, :syswrite, '(String) -> Integer'
94
+ RDL.type :IO, :tell, '() -> Integer'
95
+ RDL.rdl_alias :IO, :to_i, :fileno
96
+ RDL.type :IO, :to_io, '() -> self'
97
+ RDL.type :IO, :tty?, '() -> %bool'
98
+ RDL.type :IO, :ungetbyte, '(String or Integer) -> nil'
99
+ RDL.type :IO, :ungetc, '(String) -> nil'
100
+ RDL.type :IO, :write, '(String) -> Integer'
101
+ RDL.type :IO, :write_nonbloc, '(String, ?Integer options) -> Integer'
@@ -0,0 +1,89 @@
1
+ RDL.nowrap :Kernel
2
+
3
+ # RDL.type :Kernel, 'self.Array', '([to_ary: () -> Array<t>]) -> Array<t>'
4
+ # RDL.type :Kernel, 'self.Array', '([to_a: () -> Array<t>]) -> Array<t>'
5
+ RDL.type :Kernel, 'self.Complex', '(Numeric x, Numeric y) -> Complex'
6
+ RDL.type :Kernel, 'self.Complex', '(String x) -> Complex'
7
+ RDL.type :Kernel, 'self.Float', '(Numeric x) -> Float'
8
+ # RDL.type :Kernel, 'self.Float', '(x : [to_f : () -> Float]) -> Float'
9
+ # RDL.type :Kernel, 'self.Hash', '(x : [to_hash : () -> Hash<k,v>]) -> Hash<k,v>'
10
+ RDL.type :Kernel, 'self.Hash', '(nil x) -> Hash<k,v>'
11
+ # RDL.type :Kernel, 'self.Hash, '(x : []) -> Hash<k,v>'
12
+ RDL.type :Kernel, 'self.Integer', '(Numeric or String arg, ?Integer base) -> Integer'
13
+ # RDL.type :Kernel, 'self.Integer', '(arg : [to_int : () -> Integer], base : ?Integer) -> Integer'
14
+ # RDL.type :Kernel, 'self.Integer', '(arg : [to_i : () -> Integer], base : ?Integer) -> Integer'
15
+ RDL.type :Kernel, 'self.Rational', '(Numeric x, Numeric y) -> Rational'
16
+ RDL.type :Kernel, 'self.Rational', '(String x) -> Rational'
17
+ # RDL.type :Kernel, 'self.String', '(arg : [to_s : () -> String]) -> String'
18
+ RDL.type :Kernel, 'self.__callee__', '() -> Symbol or nil'
19
+ RDL.type :Kernel, 'self.__dir__', '() -> String or nil'
20
+ RDL.type :Kernel, 'self.__method__', '() -> Symbol or nil'
21
+ RDL.type :Kernel, 'self.`', '(String) -> String'
22
+ RDL.type :Kernel, 'self.abort', '(?String msg) -> %bot'
23
+ RDL.type :Kernel, 'self.at_exit', '() { () -> %any} -> Proc' # TODO: Fix proc
24
+ RDL.type :Kernel, 'self.autoload', '(String or Symbol module, String filename) -> nil'
25
+ RDL.type :Kernel, 'self.autoload?', '(Symbol or String name) -> String or nil'
26
+ RDL.type :Kernel, 'self.binding', '() -> Binding'
27
+ RDL.type :Kernel, 'self.block_given?', '() -> %bool'
28
+ RDL.type :Kernel, 'self.caller', '(?Integer start, ?Integer length) -> Array<String> or nil'
29
+ RDL.type :Kernel, 'self.caller', '(Range) -> Array<String> or nil'
30
+ RDL.type :Kernel, 'self.caller_locations', '(?Integer start, ?Integer length) -> Array<String> or nil'
31
+ RDL.type :Kernel, 'self.caller_locations', '(Range) -> Array<String> or nil'
32
+ # RDL.type :Kernel, 'self.catch' # TODO
33
+ RDL.type :Kernel, 'self.eval', '(String, ?Binding, ?String filename, ?Integer lineno) -> %any'
34
+ # RDL.type :Kernel, 'self.exec' #TODO
35
+ RDL.type :Kernel, 'self.exit', '() -> %bot'
36
+ RDL.type :Kernel, 'self.exit', '(Integer or %bool status) -> %bot'
37
+ RDL.type :Kernel, 'self.exit!', '(Integer or %bool status) -> %bot'
38
+ RDL.type :Kernel, 'self.fail', '() -> %bot'
39
+ RDL.type :Kernel, 'self.fail', '(String) -> %bot'
40
+ RDL.type :Kernel, 'self.fail', '(Class, Array<String>) -> %bot'
41
+ RDL.type :Kernel, 'self.fail', '(Class, String, Array<String>) -> %bot'
42
+ # RDL.type :Kernel, 'self.fail', '(String or [exception : () -> String], ?String, ?Array<String>) -> %any'
43
+ # RDL.type :Kernel, 'self.fork' #TODO
44
+ RDL.type :Kernel, 'self.format', '(String format, *%any args) -> String'
45
+ RDL.type :Kernel, 'self.gets', '(?String, ?Integer) -> String'
46
+ RDL.type :Kernel, 'self.global_variables', '() -> Array<Symbol>'
47
+ RDL.type :Kernel, 'self.iterator?', '() -> %bool'
48
+ # RDL.type :Kernel, 'self.lambda' # TODO
49
+ RDL.type :Kernel, 'self.load', '(String filename, ?%bool) -> %bool'
50
+ RDL.type :Kernel, 'self.local_variables', '() -> Array<Symbol>'
51
+ # RDL.type :Kernel, 'self.loop' #TODO
52
+ RDL.type :Kernel, 'self.open', '(String path, ?(String or Integer) mode, ?String perm) -> IO or nil'
53
+ # RDL.type :Kernel, 'self.open', '(String path, mode : ?String, perm: ?String) {(IO) -> %any)} -> %any' # TODO: returns block value
54
+ # RDL.type :Kernel, 'self.open', '(String path, mode : ?Integer, perm: ?String) {(IO) -> %any)} -> %any' # TODO: returns block value
55
+ # RDL.type :Kernel, 'self.p', '(*[inspect : () -> String]) -> nil'
56
+ # RDL.type :Kernel, 'self.print', '(*[to_s : () -> String] -> nil'
57
+ RDL.type :Kernel, 'self.printf', '(?IO, ?String, *%any) -> nil'
58
+ RDL.type :Kernel, :proc, '() {(*%any) -> %any} -> Proc' # TODO more precise
59
+ RDL.type :Kernel, 'self.putc', '(Integer) -> Integer'
60
+ RDL.type :Kernel, 'self.puts', '(*[to_s : () -> String]) -> nil'
61
+ RDL.type :Kernel, 'self.raise', '() -> %bot'
62
+ # RDL.type :Kernel, 'self.raise', '(String or [exception : () -> String], ?String, ?Array<String>) -> %any'
63
+ # TODO: above same as fail?
64
+ RDL.type :Kernel, 'self.rand', '(Integer or Range max) -> Numeric'
65
+ RDL.type :Kernel, 'self.readline', '(?String, ?Integer) -> String'
66
+ RDL.type :Kernel, 'self.readlines', '(?String, ?Integer) -> Array<String>'
67
+ RDL.type :Kernel, 'self.require', '(String name) -> %bool'
68
+ RDL.type :Kernel, 'self.require_relative', '(String name) -> %bool'
69
+ RDL.type :Kernel, 'self.select',
70
+ '(Array<IO> read, ?Array<IO> write, ?Array<IO> error, ?Integer timeout) -> Array<String>' # TODO: return RDL.type?
71
+ # RDL.type :Kernel, 'self.set_trace_func' #TODO
72
+ RDL.type :Kernel, 'self.sleep', '(Numeric duration) -> Integer'
73
+ # RDL.type :Kernel, 'self.spawn' #TODO
74
+ RDL.rdl_alias :Kernel, :sprintf, :format # TODO: are they aliases?
75
+ RDL.type :Kernel, 'self.srand', '(Numeric number) -> Numeric'
76
+ RDL.type :Kernel, 'self.syscall', '(Integer num, *%any args) -> %any' # TODO : ?
77
+ # RDL.type :Kernel, 'self.system' # TODO
78
+ RDL.type :Kernel, 'self.test', '(String cmd, String file1, ?String file2) -> %bool or Time' # TODO: better, dependent RDL.type?
79
+ # RDL.type :Kernel, 'self.throw' # TODO
80
+ # RDL.type :Kernel, 'self.trace_var' # TODO
81
+ # RDL.type :Kernel, 'self.trap' # TODO
82
+ # RDL.type :Kernel, 'self.untrace_var' # TODO
83
+ RDL.type :Kernel, 'self.warn', '(*String msg) -> nil'
84
+ RDL.type :Kernel, :clone, '() -> self'
85
+ RDL.type :Kernel, :raise, '() -> %bot'
86
+ RDL.type :Kernel, :raise, '(String) -> %bot'
87
+ RDL.type :Kernel, :raise, '(Class, String, Array<String>) -> %bot'
88
+ RDL.type :Kernel, :send, '(String or Symbol, *%any) -> %any'
89
+ RDL.type :Kernel, :send, '(String or Symbol, *%any) { (*%any) -> %any } -> %any'