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,10 @@
1
+ RDL.nowrap :BigMath
2
+
3
+ RDL.type :BigMath, 'self.exp', '(Integer, Integer) -> BigDecimal'
4
+ RDL.type :BigMath, 'self.log', '(Integer, Integer) -> BigDecimal'
5
+ RDL.type :BigMath, :E, '(Integer) -> BigDecimal'
6
+ RDL.type :BigMath, :PI, '(Integer) -> BigDecimal'
7
+ RDL.type :BigMath, :atan, '(Integer, Integer) -> BigDecimal'
8
+ RDL.type :BigMath, :cos, '(Integer, Integer) -> BigDecimal'
9
+ RDL.type :BigMath, :sin, '(Integer, Integer) -> BigDecimal'
10
+ RDL.type :BigMath, :sqrt, '(Integer, Integer) -> BigDecimal'
@@ -0,0 +1,214 @@
1
+ RDL.nowrap :Bignum
2
+
3
+ RDL.type :Bignum, :%, '(Fixnum x {{ x!=0 }}) -> Fixnum', version: RDL::Globals::FIXBIG_VERSIONS
4
+ RDL.type :Bignum, :%, '(Bignum x {{ x!=0 }}) -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
5
+ RDL.type :Bignum, :%, '(Float x {{ x!=0 }}) -> Float', version: RDL::Globals::FIXBIG_VERSIONS
6
+ RDL.type :Bignum, :%, '(Rational x {{ x!=0 }}) -> Rational', version: RDL::Globals::FIXBIG_VERSIONS
7
+ RDL.type :Bignum, :%, '(BigDecimal x {{ x!=0 }}) -> BigDecimal', version: RDL::Globals::FIXBIG_VERSIONS
8
+
9
+ RDL.type :Bignum, :&, '(Integer) -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
10
+
11
+ RDL.type :Bignum, :*, '(Fixnum) -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
12
+ RDL.type :Bignum, :*, '(Bignum) -> Bignum', version: RDL::Globals::FIXBIG_VERSIONS
13
+ RDL.type :Bignum, :*, '(Float) -> Float', version: RDL::Globals::FIXBIG_VERSIONS
14
+ RDL.type :Bignum, :*, '(Rational) -> Rational', version: RDL::Globals::FIXBIG_VERSIONS
15
+ RDL.type :Bignum, :*, '(BigDecimal) -> BigDecimal', version: RDL::Globals::FIXBIG_VERSIONS
16
+ RDL.type :Bignum, :*, '(Complex) -> Complex', version: RDL::Globals::FIXBIG_VERSIONS
17
+ RDL.pre(:Bignum, :*, version: RDL::Globals::FIXBIG_VERSIONS) { |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
18
+
19
+ RDL.type :Bignum, :**, '(Integer) -> %numeric', version: RDL::Globals::FIXBIG_VERSIONS
20
+ RDL.type :Bignum, :**, '(Float) -> %numeric', version: RDL::Globals::FIXBIG_VERSIONS
21
+ RDL.type :Bignum, :**, '(Rational) -> %numeric', version: RDL::Globals::FIXBIG_VERSIONS
22
+ RDL.type :Bignum, :**, '(BigDecimal) -> BigDecimal', version: RDL::Globals::FIXBIG_VERSIONS
23
+ RDL.pre(:Bignum, :**, version: RDL::Globals::FIXBIG_VERSIONS) { |x| x!=BigDecimal::INFINITY && if self<0 then x<=-1||x>=0 else true end}
24
+ RDL.post(:Bignum, :**, version: RDL::Globals::FIXBIG_VERSIONS) { |r,x| r.real?}
25
+ RDL.type :Bignum, :**, '(Complex) -> Complex', version: RDL::Globals::FIXBIG_VERSIONS
26
+ RDL.pre(:Bignum, :**, version: RDL::Globals::FIXBIG_VERSIONS) { |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}
27
+
28
+ RDL.type :Bignum, :+, '(Integer) -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
29
+ RDL.type :Bignum, :+, '(Float) -> Float', version: RDL::Globals::FIXBIG_VERSIONS
30
+ RDL.type :Bignum, :+, '(Rational) -> Rational', version: RDL::Globals::FIXBIG_VERSIONS
31
+ RDL.type :Bignum, :+, '(BigDecimal) -> BigDecimal', version: RDL::Globals::FIXBIG_VERSIONS
32
+ RDL.type :Bignum, :+, '(Complex) -> Complex', version: RDL::Globals::FIXBIG_VERSIONS
33
+
34
+ RDL.type :Bignum, :-, '(Integer) -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
35
+ RDL.type :Bignum, :-, '(Float) -> Float', version: RDL::Globals::FIXBIG_VERSIONS
36
+ RDL.type :Bignum, :-, '(Rational) -> Rational', version: RDL::Globals::FIXBIG_VERSIONS
37
+ RDL.type :Bignum, :-, '(BigDecimal) -> BigDecimal', version: RDL::Globals::FIXBIG_VERSIONS
38
+ RDL.type :Bignum, :-, '(Complex) -> Complex', version: RDL::Globals::FIXBIG_VERSIONS
39
+
40
+ RDL.type :Bignum, :-@, '() -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
41
+
42
+ RDL.type :Bignum, :+@, '() -> Bignum', version: RDL::Globals::FIXBIG_VERSIONS
43
+
44
+ RDL.type :Bignum, :/, '(Integer x {{ x!=0 }}) -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
45
+ RDL.type :Bignum, :/, '(Float x {{ x!=0 }}) -> Float', version: RDL::Globals::FIXBIG_VERSIONS
46
+ RDL.type :Bignum, :/, '(Rational x {{ x!=0 }}) -> Rational', version: RDL::Globals::FIXBIG_VERSIONS
47
+ RDL.type :Bignum, :/, '(BigDecimal x {{ x!=0 }}) -> BigDecimal', version: RDL::Globals::FIXBIG_VERSIONS
48
+ RDL.type :Bignum, :/, '(Complex x {{ x!=0 }}) -> Complex', version: RDL::Globals::FIXBIG_VERSIONS
49
+ RDL.pre(:Bignum, :/, version: RDL::Globals::FIXBIG_VERSIONS) { |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}
50
+
51
+ RDL.type :Bignum, :<, '(Integer) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
52
+ RDL.type :Bignum, :<, '(Float) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
53
+ RDL.type :Bignum, :<, '(Rational) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
54
+ RDL.type :Bignum, :<, '(BigDecimal) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
55
+
56
+ RDL.type :Bignum, :<<, '(Fixnum) -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
57
+
58
+ RDL.type :Bignum, :<=, '(Integer) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
59
+ RDL.type :Bignum, :<=, '(Float) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
60
+ RDL.type :Bignum, :<=, '(Rational) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
61
+ RDL.type :Bignum, :<=, '(BigDecimal) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
62
+
63
+ RDL.type :Bignum, :<=>, '(Integer) -> Object', version: RDL::Globals::FIXBIG_VERSIONS
64
+ RDL.post(:Bignum, :<=>, version: RDL::Globals::FIXBIG_VERSIONS) { |r,x| r == -1 || r==0 || r==1}
65
+ RDL.type :Bignum, :<=>, '(Float) -> Object', version: RDL::Globals::FIXBIG_VERSIONS
66
+ RDL.post(:Bignum, :<=>, version: RDL::Globals::FIXBIG_VERSIONS) { |r,x| r == -1 || r==0 || r==1}
67
+ RDL.type :Bignum, :<=>, '(Rational) -> Object', version: RDL::Globals::FIXBIG_VERSIONS
68
+ RDL.post(:Bignum, :<=>, version: RDL::Globals::FIXBIG_VERSIONS) { |r,x| r == -1 || r==0 || r==1}
69
+ RDL.type :Bignum, :<=>, '(BigDecimal) -> Object', version: RDL::Globals::FIXBIG_VERSIONS
70
+ RDL.post(:Bignum, :<=>, version: RDL::Globals::FIXBIG_VERSIONS) { |r,x| r == -1 || r==0 || r==1}
71
+
72
+ RDL.type :Bignum, :==, '(Object) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
73
+
74
+ RDL.type :Bignum, :===, '(Object) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
75
+
76
+ RDL.type :Bignum, :>, '(Integer) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
77
+ RDL.type :Bignum, :>, '(Float) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
78
+ RDL.type :Bignum, :>, '(Rational) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
79
+ RDL.type :Bignum, :>, '(BigDecimal) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
80
+
81
+ RDL.type :Bignum, :>=, '(Integer) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
82
+ RDL.type :Bignum, :>=, '(Float) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
83
+ RDL.type :Bignum, :>=, '(Rational) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
84
+ RDL.type :Bignum, :>=, '(BigDecimal) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
85
+
86
+ RDL.type :Bignum, :>>, '(Integer) -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
87
+ RDL.post(:Bignum, :>>, version: RDL::Globals::FIXBIG_VERSIONS) { |r,x| r >= 0 }
88
+
89
+ RDL.type :Bignum, :[], '(Integer) -> Fixnum', version: RDL::Globals::FIXBIG_VERSIONS
90
+ RDL.post(:Bignum, :[], version: RDL::Globals::FIXBIG_VERSIONS) { |r,x| r == 0 || r==1}
91
+ RDL.type :Bignum, :[], '(Rational) -> Fixnum', version: RDL::Globals::FIXBIG_VERSIONS
92
+ RDL.post(:Bignum, :[], version: RDL::Globals::FIXBIG_VERSIONS) { |r,x| r == 0 || r==1}
93
+ RDL.type :Bignum, :[], '(Float) -> Fixnum', version: RDL::Globals::FIXBIG_VERSIONS
94
+ RDL.pre(:Bignum, :[], version: RDL::Globals::FIXBIG_VERSIONS) { |x| x!=Float::INFINITY && !x.nan? }
95
+ RDL.post(:Bignum, :[], version: RDL::Globals::FIXBIG_VERSIONS) { |r,x| r == 0 || r==1}
96
+ RDL.type :Bignum, :[], '(BigDecimal) -> Fixnum', version: RDL::Globals::FIXBIG_VERSIONS
97
+ RDL.pre(:Bignum, :[], version: RDL::Globals::FIXBIG_VERSIONS) { |x| x!=BigDecimal::INFINITY && !x.nan? }
98
+ RDL.post(:Bignum, :[], version: RDL::Globals::FIXBIG_VERSIONS) { |r,x| r == 0 || r==1}
99
+
100
+ RDL.type :Bignum, :^, '(Integer) -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
101
+
102
+ RDL.type :Bignum, :|, '(Integer) -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
103
+
104
+ RDL.type :Bignum, :~, '() -> Bignum', version: RDL::Globals::FIXBIG_VERSIONS
105
+
106
+ RDL.type :Bignum, :abs, '() -> Bignum r {{ r>=0 }}', version: RDL::Globals::FIXBIG_VERSIONS
107
+
108
+ RDL.type :Bignum, :bit_length, '() -> Integer r {{ r>=0 }}', version: RDL::Globals::FIXBIG_VERSIONS
109
+
110
+ RDL.type :Bignum, :div, '(Integer x {{ x!=0 }}) -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
111
+ RDL.type :Bignum, :div, '(Float x {{ x!=0 && !x.nan? }}) -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
112
+ RDL.type :Bignum, :div, '(Rational x {{ x!=0 }}) -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
113
+ RDL.type :Bignum, :div, '(BigDecimal x {{ x!=0 && !x.nan?}}) -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
114
+
115
+ RDL.type :Bignum, :divmod, '(%real) -> [%real, %real]', version: RDL::Globals::FIXBIG_VERSIONS
116
+ RDL.pre(:Bignum, :divmod, version: RDL::Globals::FIXBIG_VERSIONS) { |x| x!=0 && if x.is_a?(Float) then !x.nan? else true end}
117
+
118
+ RDL.type :Bignum, :even?, '() -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
119
+
120
+ RDL.type :Bignum, :fdiv, '(Integer) -> Float', version: RDL::Globals::FIXBIG_VERSIONS
121
+ RDL.type :Bignum, :fdiv, '(Float) -> Float', version: RDL::Globals::FIXBIG_VERSIONS
122
+ RDL.type :Bignum, :fdiv, '(Rational) -> Float', version: RDL::Globals::FIXBIG_VERSIONS
123
+ RDL.type :Bignum, :fdiv, '(BigDecimal) -> BigDecimal', version: RDL::Globals::FIXBIG_VERSIONS
124
+ RDL.type :Bignum, :fdiv, '(Complex) -> Complex', version: RDL::Globals::FIXBIG_VERSIONS
125
+ RDL.pre(:Bignum, :fdiv, version: RDL::Globals::FIXBIG_VERSIONS) { |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}
126
+
127
+ RDL.type :Bignum, :to_s, '() -> String', version: RDL::Globals::FIXBIG_VERSIONS
128
+ RDL.type :Bignum, :inspect, '() -> String', version: RDL::Globals::FIXBIG_VERSIONS
129
+
130
+ RDL.type :Bignum, :magnitude, '() -> Bignum', version: RDL::Globals::FIXBIG_VERSIONS
131
+ RDL.post(:Bignum, :magnitude, version: RDL::Globals::FIXBIG_VERSIONS) { |r,x| r >= 0 }
132
+
133
+ RDL.type :Bignum, :modulo, '(Fixnum x {{ x!=0 }}) -> Fixnum', version: RDL::Globals::FIXBIG_VERSIONS
134
+ RDL.type :Bignum, :modulo, '(Bignum x {{ x!=0 }}) -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
135
+ RDL.type :Bignum, :modulo, '(Float x {{ x!=0 }}) -> Float', version: RDL::Globals::FIXBIG_VERSIONS
136
+ RDL.type :Bignum, :modulo, '(Rational x {{ x!=0 }}) -> Rational', version: RDL::Globals::FIXBIG_VERSIONS
137
+ RDL.type :Bignum, :modulo, '(BigDecimal x {{ x!=0 }}) -> BigDecimal', version: RDL::Globals::FIXBIG_VERSIONS
138
+
139
+ RDL.type :Bignum, :next, '() -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
140
+
141
+ RDL.type :Bignum, :odd?, '() -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
142
+
143
+ RDL.type :Bignum, :size, '() -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
144
+
145
+ RDL.type :Bignum, :succ, '() -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
146
+
147
+ RDL.type :Bignum, :to_f, '() -> Float', version: RDL::Globals::FIXBIG_VERSIONS
148
+
149
+ RDL.type :Bignum, :zero?, '() -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
150
+
151
+ RDL.type :Bignum, :ceil, '() -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
152
+
153
+ RDL.type :Bignum, :denominator, '() -> Fixnum r {{ r==1 }}', version: RDL::Globals::FIXBIG_VERSIONS
154
+
155
+ RDL.type :Bignum, :floor, '() -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
156
+
157
+ RDL.type :Bignum, :numerator, '() -> Bignum', version: RDL::Globals::FIXBIG_VERSIONS
158
+
159
+ RDL.type :Bignum, :quo, '(Integer x {{ x!=0 }}) -> Rational', version: RDL::Globals::FIXBIG_VERSIONS
160
+ RDL.type :Bignum, :quo, '(Float x {{ x!=0 }}) -> Float', version: RDL::Globals::FIXBIG_VERSIONS
161
+ RDL.type :Bignum, :quo, '(Rational x {{ x!=0 }}) -> Rational', version: RDL::Globals::FIXBIG_VERSIONS
162
+ RDL.type :Bignum, :quo, '(BigDecimal x {{ x!=0 }}) -> BigDecimal', version: RDL::Globals::FIXBIG_VERSIONS
163
+ RDL.type :Bignum, :quo, '(Complex x {{ x!=0 }}) -> Complex', version: RDL::Globals::FIXBIG_VERSIONS
164
+ RDL.pre(:Bignum, :quo, version: RDL::Globals::FIXBIG_VERSIONS) { 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}
165
+
166
+ RDL.type :Bignum, :rationalize, '() -> Rational', version: RDL::Globals::FIXBIG_VERSIONS
167
+
168
+ RDL.type :Bignum, :rationalize, '(%numeric) -> Rational', version: RDL::Globals::FIXBIG_VERSIONS
169
+
170
+ RDL.type :Bignum, :round, '() -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
171
+
172
+ RDL.type :Bignum, :round, '(%numeric) -> %numeric', version: RDL::Globals::FIXBIG_VERSIONS
173
+ RDL.pre(:Bignum, :round, version: RDL::Globals::FIXBIG_VERSIONS) { |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].
174
+
175
+ RDL.type :Bignum, :to_i, '() -> Bignum', version: RDL::Globals::FIXBIG_VERSIONS
176
+
177
+ RDL.type :Bignum, :to_r, '() -> Rational', version: RDL::Globals::FIXBIG_VERSIONS
178
+
179
+ RDL.type :Bignum, :truncate, '() -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
180
+
181
+ RDL.type :Bignum, :angle, '() -> %numeric', version: RDL::Globals::FIXBIG_VERSIONS
182
+ RDL.post(:Bignum, :angle, version: RDL::Globals::FIXBIG_VERSIONS) { |r,x| r == 0 || r == Math::PI}
183
+
184
+ RDL.type :Bignum, :arg, '() -> %numeric', version: RDL::Globals::FIXBIG_VERSIONS
185
+ RDL.post(:Bignum, :arg, version: RDL::Globals::FIXBIG_VERSIONS) { |r,x| r == 0 || r == Math::PI}
186
+
187
+ RDL.type :Bignum, :equal?, '(Object) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
188
+ RDL.type :Bignum, :eql?, '(Object) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
189
+
190
+ RDL.type :Bignum, :hash, '() -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
191
+
192
+ RDL.type :Bignum, :phase, '() -> %numeric', version: RDL::Globals::FIXBIG_VERSIONS
193
+
194
+ RDL.type :Bignum, :abs2, '() -> Bignum r {{ r>=0 }}', version: RDL::Globals::FIXBIG_VERSIONS
195
+
196
+ RDL.type :Bignum, :conj, '() -> Bignum', version: RDL::Globals::FIXBIG_VERSIONS
197
+ RDL.type :Bignum, :conjugate, '() -> Bignum', version: RDL::Globals::FIXBIG_VERSIONS
198
+
199
+ RDL.type :Bignum, :imag, '() -> Fixnum r {{ r==0 }}', version: RDL::Globals::FIXBIG_VERSIONS
200
+ RDL.type :Bignum, :imaginary, '() -> Fixnum r {{ r==0 }}', version: RDL::Globals::FIXBIG_VERSIONS
201
+
202
+ RDL.type :Bignum, :real, '() -> Bignum', version: RDL::Globals::FIXBIG_VERSIONS
203
+
204
+ RDL.type :Bignum, :real?, '() -> true', version: RDL::Globals::FIXBIG_VERSIONS
205
+
206
+ RDL.type :Bignum, :to_c, '() -> Complex r {{ r.imaginary==0 }}', version: RDL::Globals::FIXBIG_VERSIONS
207
+
208
+ RDL.type :Bignum, :remainder, '(Fixnum x {{ x!=0 }}) -> Fixnum r {{ r>=0 }}', version: RDL::Globals::FIXBIG_VERSIONS
209
+ RDL.type :Bignum, :remainder, '(Bignum x {{ x!=0 }}) -> Fixnum r {{ r>=0 }}', version: RDL::Globals::FIXBIG_VERSIONS
210
+ RDL.type :Bignum, :remainder, '(Float x {{ x!=0 }}) -> Float', version: RDL::Globals::FIXBIG_VERSIONS
211
+ RDL.type :Bignum, :remainder, '(Rational x {{ x!=0 }}) -> Rational r {{ r>=0 }}', version: RDL::Globals::FIXBIG_VERSIONS
212
+ RDL.type :Bignum, :remainder, '(BigDecimal x {{ x!=0 }}) -> BigDecimal', version: RDL::Globals::FIXBIG_VERSIONS
213
+
214
+ RDL.type :Bignum, :coerce, '(Integer) -> [Integer, Integer]', version: RDL::Globals::FIXBIG_VERSIONS
@@ -0,0 +1,15 @@
1
+ RDL.nowrap :Class
2
+
3
+ RDL.type :Class, :allocate, '() -> %any' # Instance of class self
4
+ RDL.type :Class, :inherited, '(Class) -> %any'
5
+ #RDL.type :Class, 'initialize', '() -> '
6
+ #RDL.type :Class, 'new', '(*%any) -> %any' #Causes two other test cases to fail
7
+ RDL.type :Class, :superclass, '() -> Class or nil'
8
+
9
+ #RDL.type :Class, :class_eval, '() {() -> %any} -> %any'
10
+ #RDL.type :Class, :method_defined?, '(String or Symbol) -> %bool'
11
+ #RDL.type :Class, :define_method, '(String or Symbol) {(*%any) -> %any} -> Proc'
12
+ RDL.type :Class, :instance_methods, '(?%bool) -> Array<Symbol>'
13
+ RDL.type :Class, :class, '() -> Class'
14
+ RDL.type :Class, :superclass, '() -> Class'
15
+ RDL.type :Class, :name, '() -> String'
@@ -0,0 +1,123 @@
1
+ RDL.nowrap :Complex
2
+
3
+ RDL.type :Complex, :*, '(Integer) -> Complex'
4
+ RDL.type :Complex, :*, '(Float) -> Complex'
5
+ RDL.pre(:Complex, :*) { |x| if x.infinite?||x.nan? then !self.imaginary.is_a?(BigDecimal)&&!self.real.is_a?(BigDecimal) else true end}
6
+ RDL.type :Complex, :*, '(Rational) -> Complex'
7
+ RDL.type :Complex, :*, '(BigDecimal) -> Complex'
8
+ RDL.pre(:Complex, :*) {if x.real.is_a?(Float) then !x.real.infinite? && !x.real.nan? elsif x.imaginary.is_a?(Float) then !x.imaginary.infinite? && !x.imaginary.nan? else true end}
9
+ RDL.type :Complex, :*, '(Complex) -> Complex'
10
+ RDL.pre(:Complex, :*) { |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}
11
+
12
+ RDL.type :Complex, :**, '(Integer) -> Complex'
13
+ RDL.type :Complex, :**, '(Float) -> Complex'
14
+ RDL.type :Complex, :**, '(Rational) -> Complex'
15
+ RDL.type :Complex, :**, '(BigDecimal x {{ !x.infinite? && !x.nan? && x>=0 }}) -> Complex'
16
+ RDL.type :Complex, :**, '(Complex) -> Complex'
17
+ RDL.pre(:Complex, :**) { |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}
18
+
19
+ RDL.type :Complex, :+, '(Integer) -> Complex'
20
+ RDL.type :Complex, :+, '(Float) -> Complex'
21
+ RDL.pre(:Complex, :+) { |x| if x.infinite?||x.nan? then !self.real.is_a?(BigDecimal) else true end}
22
+ RDL.type :Complex, :+, '(Rational) -> Complex'
23
+ RDL.type :Complex, :+, '(BigDecimal) -> Complex'
24
+ RDL.pre(:Complex, :+) {if x.real.is_a?(Float) then !x.real.infinite? && !x.real.nan? else true end}
25
+ RDL.type :Complex, :+, '(Complex) -> Complex'
26
+ RDL.pre(:Complex, :+) { |x| if (x.real.is_a?(BigDecimal) && self.real.is_a?(Float)) then !(self.real.infinite?||self.real.nan?) elsif x.real.is_a?(Float)&&self.real.is_a?(BigDecimal) then !(x.real.infinite?||x.real.nan?) elsif (x.imaginary.is_a?(BigDecimal) && self.imaginary.is_a?(Float)) then !(self.imaginary.infinite?||self.imaginary.nan?) elsif x.imaginary.is_a?(Float)&&self.imaginary.is_a?(BigDecimal) then !(x.imaginary.infinite?||x.imaginary.nan?) else true end}
27
+
28
+ RDL.type :Complex, :-, '(Integer) -> Complex'
29
+ RDL.type :Complex, :-, '(Float) -> Complex'
30
+ RDL.pre(:Complex, :-) { |x| if x.infinite?||x.nan? then !self.real.is_a?(BigDecimal) else true end}
31
+ RDL.type :Complex, :-, '(Rational) -> Complex'
32
+ RDL.type :Complex, :-, '(BigDecimal) -> Complex'
33
+ RDL.pre(:Complex, :-) {if x.real.is_a?(Float) then !x.real.infinite? && !x.real.nan? else true end}
34
+ RDL.type :Complex, :-, '(Complex) -> Complex'
35
+ RDL.pre(:Complex, :-) { |x| if (x.real.is_a?(BigDecimal) && self.real.is_a?(Float)) then !(self.real.infinite?||self.real.nan?) elsif x.real.is_a?(Float)&&self.real.is_a?(BigDecimal) then !(x.real.infinite?||x.real.nan?) elsif (x.imaginary.is_a?(BigDecimal) && self.imaginary.is_a?(Float)) then !(self.imaginary.infinite?||self.imaginary.nan?) elsif x.imaginary.is_a?(Float)&&self.imaginary.is_a?(BigDecimal) then !(x.imaginary.infinite?||x.imaginary.nan?) else true end}
36
+
37
+ RDL.type :Complex, :-@, '() -> Complex'
38
+
39
+ RDL.type :Complex, :+@, '() -> Complex'
40
+
41
+ RDL.type :Complex, :/, '(Integer x {{ x!=0 }}) -> Complex'
42
+ RDL.type :Complex, :/, '(Float x {{ x!=0 }}) -> Complex'
43
+ RDL.pre(:Complex, :/) { |x| if x.infinte?||x.nan? then !self.real.is_a?(BigDecimal) && !self.imaginary.is_a?(BigDecimal) else true end}
44
+ RDL.type :Complex, :/, '(Rational x {{ x!=0 }}) -> Complex'
45
+ RDL.type :Complex, :/, '(BigDecimal x {{ x!=0 }}) -> Complex'
46
+ RDL.pre(:Complex, :/) { |x| if self.real.is_a?(Float) then !self.real.infinite? && !self.real.nan? else true end && if self.imaginary.is_a?(Float) then !self.imaginary.infinite? && !self.imaginary.nan? else true end}
47
+ RDL.type :Complex, :/, '(Complex x {{ x!=0 }}) -> Complex'
48
+ RDL.pre(:Complex, :/) { |x| if (x.real.is_a?(BigDecimal)||x.imaginary.is_a?(BigDecimal) || self.real.is_a?(BigDecimal) || self.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) && if self.real.is_a?(Float) then !self.real.infinite? && !self.real.nan? else true end && if self.imaginary.is_a?(Float) then !self.imaginary.infinite? && !self.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}
49
+
50
+ RDL.type :Complex, :==, '(Object) -> %bool'
51
+
52
+ RDL.type :Complex, :abs, '() -> %numeric r {{ r>=0 || (if ((((self.real.is_a? BigDecimal)||(self.real.is_a? Float)) && self.real.nan?) || (((self.imaginary.is_a? BigDecimal)||(self.imaginary.is_a? Float)) && self.imaginary.nan?)) then r.nan? end) }}'
53
+
54
+ RDL.type :Complex, :abs2, '() -> %numeric r {{ r>=0 || (if ((((self.real.is_a? BigDecimal)||(self.real.is_a? Float)) && self.real.nan?) || (((self.imaginary.is_a? BigDecimal)||(self.imaginary.is_a? Float)) && self.imaginary.nan?)) then r.nan? end) }}'
55
+
56
+ RDL.type :Complex, :angle, '() -> Float'
57
+
58
+ RDL.type :Complex, :arg, '() -> Float'
59
+
60
+ RDL.type :Complex, :conj, '() -> Complex'
61
+ RDL.type :Complex, :conjugate, '() -> Complex'
62
+
63
+ RDL.type :Complex, :denominator, '() -> Integer'
64
+
65
+ RDL.type :Complex, :equal?, '(Object) -> %bool'
66
+ RDL.type :Complex, :eql?, '(Object) -> %bool'
67
+
68
+ RDL.type :Complex, :fdiv, '(%numeric) -> Complex'
69
+ RDL.pre(:Complex, :fdiv) { |x| if (self.real.is_a?(Float) && (self.real.infinite? || self.real.nan?))||(self.imaginary.is_a?(Float) && (self.imaginary.infinite? || self.imaginary.nan?)) then !x.is_a?(BigDecimal) && (if x.is_a?(Complex) then !x.real.is_a?(BigDecimal) && !x.imaginary.is_a?(BigDecimal) else true end) else true end}
70
+
71
+ RDL.type :Complex, :hash, '() -> Integer'
72
+
73
+ RDL.type :Complex, :imag, '() -> %real'
74
+ RDL.type :Complex, :imaginary, '() -> %real'
75
+
76
+ RDL.type :Complex, :inspect, '() -> String'
77
+
78
+ RDL.type :Complex, :magnitude, '() -> %real'
79
+
80
+ RDL.type :Complex, :numerator, '() -> Complex'
81
+
82
+ RDL.type :Complex, :phase, '() -> Float'
83
+
84
+ RDL.type :Complex, :polar, '() -> [%real, %real]'
85
+
86
+ RDL.type :Complex, :quo, '(Integer x {{ x!=0 }}) -> Complex'
87
+ RDL.type :Complex, :quo, '(Float x {{ x!=0 }}) -> Complex'
88
+ RDL.pre(:Complex, :quo) { |x| if self.real.is_a?(BigDecimal)||self.imaginary.is_a?(BigDecimal) then !x.infinite? && !x.nan? else true end}
89
+ RDL.type :Complex, :quo, '(Rational x {{ x!=0 }}) -> Complex'
90
+ RDL.type :Complex, :quo, '(BigDecimal x {{ x!=0 }}) -> BigDecimal'
91
+ RDL.pre(:Complex, :quo) { |x| if self.real.is_a?(Float) then !self.real.infinite?&&!self.real.nan? else true end && if self.imaginary.is_a?(Float) then !self.imaginary.infinite? && !self.imaginary.nan? else true end}
92
+ RDL.type :Complex, :quo, '(Complex x {{ x!=0 }}) -> Complex'
93
+ RDL.pre(:Complex, :quo) { |x| if (x.real.is_a?(BigDecimal)||x.imaginary.is_a?(BigDecimal) || self.real.is_a?(BigDecimal) || self.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) && if self.real.is_a?(Float) then !self.real.infinite? && !self.real.nan? else true end && if self.imaginary.is_a?(Float) then !self.imaginary.infinite? && !self.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}
94
+
95
+ RDL.type :Complex, :rationalize, '() -> Rational'
96
+ RDL.pre(:Complex, :rationalize) { self.imaginary==0 && if self.real.is_a?(Float)||self.real.is_a?(BigDecimal) then !self.real.infinite? && !self.real.nan? else true end}
97
+
98
+ RDL.type :Complex, :rationalize, '(%numeric) -> Rational'
99
+ RDL.pre(:Complex, :rationalize) { |x| self.imaginary==0 && if self.real.is_a?(Float)||self.real.is_a?(Rational) then (if x.is_a?(Float)||x.is_a?(BigDecimal) then !x.infinite? && !x.nan? else true end) else true end && if self.real.is_a?(Float)||self.real.is_a?(BigDecimal) then !self.real.infinite? && !self.real.nan? else true end}
100
+
101
+ RDL.type :Complex, :real, '() -> %real'
102
+
103
+ RDL.type :Complex, :real?, '() -> false'
104
+
105
+ RDL.type :Complex, :rect, '() -> [%real, %real]'
106
+ RDL.type :Complex, :rectangular, '() -> [%real, %real]'
107
+
108
+ RDL.type :Complex, :to_c, '() -> Complex'
109
+
110
+ RDL.type :Complex, :to_f, '() -> Float'
111
+ RDL.pre(:Complex, :to_f) { self.imaginary==0}
112
+
113
+ RDL.type :Complex, :to_i, '() -> Integer'
114
+ RDL.pre(:Complex, :to_i) { self.imaginary==0 && if self.real.is_a?(Float)||self.real.is_a?(BigDecimal) then !self.real.infinite? && !self.real.nan? else true end}
115
+
116
+ RDL.type :Complex, :to_r, '() -> Rational'
117
+ RDL.pre(:Complex, :to_r) { self.imaginary==0 && if self.real.is_a?(Float)||self.real.is_a?(BigDecimal) then !self.real.infinite? && !self.real.nan? else true end}
118
+
119
+ RDL.type :Complex, :to_s, '() -> String'
120
+
121
+ RDL.type :Complex, :zero?, '() -> %bool'
122
+
123
+ RDL.type :Complex, :coerce, '(%numeric) -> [Complex, Complex]'
@@ -0,0 +1,4 @@
1
+ RDL.nowrap :Coverage
2
+
3
+ RDL.type :Coverage, 'self.start', '() -> nil'
4
+ RDL.type :Coverage, 'self.result', '() -> Hash<String,Array<Integer or nil>>'
@@ -0,0 +1,3 @@
1
+ RDL.nowrap :CSV
2
+
3
+ RDL.type :CSV, 'self.foreach', '(String or File, ?Hash<Symbol, u>) {(Array<String>) -> %any} -> NilClass'
@@ -0,0 +1,4 @@
1
+ RDL.nowrap :Date
2
+
3
+ RDL.type :Date, 'self.now', '() -> DateTime'
4
+ RDL.type :Date, :strftime, '(String) -> String'
@@ -0,0 +1,37 @@
1
+ RDL.nowrap :Dir
2
+
3
+ RDL.rdl_alias :Dir, :[], :glob
4
+
5
+ RDL.type :Dir, 'self.chdir', '(?(String or Pathname)) -> 0'
6
+ RDL.type :Dir, 'self.chdir', '(?(String or Pathname)) { (String) -> u } -> u'
7
+ RDL.type :Dir, 'self.chroot', '(String) -> 0'
8
+ RDL.type :Dir, 'self.delete', '(String) -> 0'
9
+ RDL.type :Dir, 'self.entries', '(String, ?Encoding) -> Array<String>'
10
+ RDL.type :Dir, 'self.exist?', '(String file) -> %bool'
11
+ # exists? deprecated
12
+ RDL.type :Dir, 'self.foreach', '(String dir, ?Encoding) { (String) -> %any } -> nil'
13
+ RDL.type :Dir, 'self.foreach', '(String dir, ?Encoding) -> Enumerator<String>'
14
+ RDL.type :Dir, 'self.getwd', '() -> String'
15
+ RDL.type :Dir, 'self.glob', '(String or Array<String> pattern, ?Fixum flags) -> Array<String>'
16
+ RDL.type :Dir, 'self.glob', '(String or Array<String> pattern, ?Fixum flags) { (String) -> %any} -> nil'
17
+ RDL.type :Dir, 'self.home', '(?String) -> String'
18
+ RDL.type :Dir, 'self.mkdir', '(String, ?Integer) -> 0'
19
+ RDL.type :Dir, 'self.open', '(String, ?Encoding) -> Dir'
20
+ RDL.type :Dir, 'self.open', '(String, ?Encoding) { (Dir) -> u } -> u'
21
+ RDL.type :Dir, 'self.pwd', '() -> String'
22
+ RDL.type :Dir, 'self.rmdir', '(String) -> 0'
23
+ RDL.type :Dir, 'self.unlink', '(String) -> 0'
24
+ RDL.type :Dir, :close, '() -> nil'
25
+ RDL.type :Dir, :each, '() { (String) -> %any } -> self'
26
+ RDL.type :Dir, :each, '() -> Enumerator<String>'
27
+ RDL.type :Dir, :fileno, '() -> Integer'
28
+ RDL.type :Dir, :initialize, '(String, ?Encoding) -> self'
29
+ RDL.type :Dir, :inspect, '() -> String'
30
+ RDL.type :Dir, :path, '() -> String or nil'
31
+ RDL.type :Dir, :pos, '() -> Integer'
32
+ RDL.type :Dir, :pos=, '(Integer) -> Integer'
33
+ RDL.type :Dir, :read, '() -> String or nil'
34
+ RDL.type :Dir, :rewind, '() -> self'
35
+ RDL.type :Dir, :seek, '(Integer) -> self'
36
+ RDL.type :Dir, :tell, '() -> Integer'
37
+ RDL.type :Dir, :to_path, '() -> String or nil'
@@ -0,0 +1,21 @@
1
+ RDL.nowrap :Encoding
2
+
3
+ RDL.type :Encoding, 'self.aliases', '() -> Hash<String, String>'
4
+ RDL.type :Encoding, 'self.compatible?', '(%any obj1, %any obj2) -> Encoding or nil'
5
+ RDL.type :Encoding, 'self.default_external', '() -> Encoding'
6
+ RDL.type :Encoding, 'self.default_external=', '(String) -> String'
7
+ RDL.type :Encoding, 'self.default_external=', '(Encoding) -> Encoding'
8
+ RDL.type :Encoding, 'self.default_internal', '() -> Encoding'
9
+ RDL.type :Encoding, 'self.default_internal=', '(String) -> String or nil'
10
+ RDL.type :Encoding, 'self.default_internal=', '(Encoding) -> Encoding or nil'
11
+ RDL.type :Encoding, 'self.find', '(String or Encoding) -> Encoding'
12
+ RDL.type :Encoding, 'self.list', '() -> Array<Encoding>'
13
+ RDL.type :Encoding, 'self.name_list', '() -> Array<String>'
14
+
15
+ RDL.type :Encoding, :ascii_compatible?, '() -> %bool'
16
+ RDL.type :Encoding, :dummy?, '() -> %bool'
17
+ RDL.type :Encoding, :inspect, '() -> String'
18
+ RDL.type :Encoding, :name, '() -> String'
19
+ RDL.type :Encoding, :names, '() -> Array<String>'
20
+ RDL.type :Encoding, :replicate, '(String name) -> Encoding'
21
+ RDL.rdl_alias :Encoding, :to_s, :name
@@ -0,0 +1,96 @@
1
+ RDL.nowrap :Enumerable
2
+
3
+ RDL.type_params :Enumerable, [:t], :all?
4
+
5
+ RDL.type :Enumerable, :all?, '() -> %bool'
6
+ RDL.type :Enumerable, :all?, '() { (t) -> %bool } -> %bool'
7
+ RDL.type :Enumerable, :any?, '() -> %bool'
8
+ RDL.type :Enumerable, :any?, '() { (t) -> %bool } -> %bool'
9
+ # RDL.type :Enumerable, :chunk, '(XXXX : *XXXX)' # TODO
10
+ RDL.type :Enumerable, :collect, '() { (t) -> u } -> Array<u>'
11
+ RDL.type :Enumerable, :collect, '() -> Enumerator<t>'
12
+ # RDL.type :Enumerable, :collect_concat # TODO
13
+ RDL.type :Enumerable, :count, '() -> Integer'
14
+ RDL.type :Enumerable, :count, '(%any) -> Integer'
15
+ RDL.type :Enumerable, :count, '() { (t) -> %bool } -> Integer'
16
+ RDL.type :Enumerable, :cycle, '(?Integer n) { (t) -> %any } -> nil'
17
+ RDL.type :Enumerable, :cycle, '(?Integer n) -> Enumerator<t>'
18
+ RDL.type :Enumerable, :detect, '(?Proc ifnone) { (t) -> %bool } -> t or nil' # TODO ifnone
19
+ RDL.type :Enumerable, :detect, '(?Proc ifnone) -> Enumerator<t>'
20
+ RDL.type :Enumerable, :drop, '(Integer n) -> Array<t>'
21
+ RDL.type :Enumerable, :drop_while, '() { (t) -> %bool } -> Array<t>'
22
+ RDL.type :Enumerable, :drop_while, '() -> Enumerator<t>'
23
+ RDL.type :Enumerable, :each_cons, '(Integer n) { (Array<t>) -> %any } -> nil'
24
+ RDL.type :Enumerable, :each_cons, '(Integer n) -> Enumerator<t>'
25
+ # RDL.type :Enumerable, :each_entry, '(XXXX : *XXXX)' # TODO
26
+ RDL.rdl_alias :Enumerable, :each_slice, :each_cons
27
+ RDL.type :Enumerable, :each_with_index, '() { (t, Integer) -> %any } -> Enumerable<t>' # args! note may not return self
28
+ RDL.type :Enumerable, :each_with_index, '() -> Enumerable<t>' # args! note may not return self
29
+ # RDL.type :Enumerable, :each_with_object, '(XXXX : XXXX)' #TODO
30
+ RDL.type :Enumerable, :entries, '() -> Array<t>' # TODO args?
31
+ RDL.rdl_alias :Enumerable, :find, :detect
32
+ RDL.type :Enumerable, :find_all, '() { (t) -> %bool } -> Array<t>'
33
+ RDL.type :Enumerable, :find_all, '() -> Enumerator<t>'
34
+ RDL.type :Enumerable, :find_index, '(%any value) -> Integer or nil'
35
+ RDL.type :Enumerable, :find_index, '() { (t) -> %bool } -> Integer or nil'
36
+ RDL.type :Enumerable, :find_index, '() -> Enumerator<t>'
37
+ RDL.type :Enumerable, :first, '() -> t or nil'
38
+ RDL.type :Enumerable, :first, '(Integer n) -> Array<t> or nil'
39
+ # RDL.rdl_alias :Enumerable, :flat_map, :collect_concat
40
+ RDL.type :Enumerable, :grep, '(%any) -> Array<t>'
41
+ RDL.type :Enumerable, :grep, '(%any) { (t) -> u } -> Array<u>'
42
+ RDL.type :Enumerable, :group_by, '() { (t) -> u } -> Hash<u, Array<t>>'
43
+ RDL.type :Enumerable, :group_by, '() -> Enumerator<t>'
44
+ RDL.type :Enumerable, :include?, '(%any) -> %bool'
45
+ RDL.type :Enumerable, :inject, '(any initial, Symbol) -> %any' # can't tell initial, return RDL.type; not enough info in Symbol
46
+ RDL.type :Enumerable, :inject, '(Symbol) -> %any'
47
+ RDL.type :Enumerable, :inject, '(u initial) { (u, t) -> u } -> u'
48
+ RDL.type :Enumerable, :inject, '() { (t, t) -> t } -> t' # if initial not given, first element is initial
49
+ # RDL.type :Enumerable, :lazy # TODO
50
+ RDL.rdl_alias :Enumerable, :map, :collect
51
+ RDL.type :Enumerable, :max, '() -> t'
52
+ RDL.type :Enumerable, :max, '() { (t, t) -> Integer } -> t'
53
+ RDL.type :Enumerable, :max, '(Integer) -> Array<t>'
54
+ RDL.type :Enumerable, :max, '(Integer) { (t, t) -> Integer } -> Array<t>'
55
+ RDL.type :Enumerable, :max_by, '() -> Enumerator<t>'
56
+ RDL.type :Enumerable, :max_by, '() { (t, t) -> Integer } -> t'
57
+ RDL.type :Enumerable, :max_by, '(Integer) -> Enumerator<t>'
58
+ RDL.type :Enumerable, :max_by, '(Integer) { (t, t) -> Integer } -> Array<t>'
59
+ RDL.rdl_alias :Enumerable, :member?, :include?
60
+ RDL.type :Enumerable, :min, '() -> t'
61
+ RDL.type :Enumerable, :min, '() { (t, t) -> Integer } -> t'
62
+ RDL.type :Enumerable, :min, '(Integer) -> Array<t>'
63
+ RDL.type :Enumerable, :min, '(Integer) { (t, t) -> Integer } -> Array<t>'
64
+ RDL.type :Enumerable, :min_by, '() -> Enumerator<t>'
65
+ RDL.type :Enumerable, :min_by, '() { (t, t) -> Integer } -> t'
66
+ RDL.type :Enumerable, :min_by, '(Integer) -> Enumerator<t>'
67
+ RDL.type :Enumerable, :min_by, '(Integer) { (t, t) -> Integer } -> Array<t>'
68
+ RDL.type :Enumerable, :minmax, '() -> [t, t]'
69
+ RDL.type :Enumerable, :minmax, '() { (t, t) -> Integer } -> [t, t]'
70
+ RDL.type :Enumerable, :minmax_by, '() -> [t, t]'
71
+ RDL.type :Enumerable, :minmax_by, '() { (t, t) -> Integer } -> Enumerator<t>'
72
+ RDL.type :Enumerable, :none?, '() -> %bool'
73
+ RDL.type :Enumerable, :none?, '() { (t) -> %bool } -> %bool'
74
+ RDL.type :Enumerable, :one?, '() -> %bool'
75
+ RDL.type :Enumerable, :one?, '() { (t) -> %bool } -> %bool'
76
+ RDL.type :Enumerable, :partition, '() { (t) -> %bool } -> [Array<t>, Array<t>]'
77
+ RDL.type :Enumerable, :partition, '() -> Enumerator<t>'
78
+ RDL.rdl_alias :Enumerable, :reduce, :inject
79
+ RDL.type :Enumerable, :reject, '() { (t) -> %bool } -> Array<t>'
80
+ RDL.type :Enumerable, :reject, '() -> Enumerator<t>'
81
+ RDL.type :Enumerable, :reverse_each, '() { (t) -> %any } -> Enumerator<t>' # is that really the return RDL.type? TODO args
82
+ RDL.type :Enumerable, :reverse_each, '() -> Enumerator<t>' # TODO args
83
+ RDL.rdl_alias :Enumerable, :select, :find_all
84
+ # RDL.type :Enumerable, :slice_after, '(XXXX : *XXXX)' # TODO
85
+ # RDL.type :Enumerable, :slice_before, '(XXXX : *XXXX)' # TODO
86
+ # RDL.type :Enumerable, :slice_when, '()' # TODO
87
+ RDL.type :Enumerable, :sort, '() -> Array<t>'
88
+ RDL.type :Enumerable, :sort, '() { (t, t) -> Integer } -> Array<t>'
89
+ RDL.type :Enumerable, :sort_by, '() { (t) -> %any } -> Array<t>'
90
+ RDL.type :Enumerable, :sort_by, '() -> Enumerator<t>'
91
+ RDL.type :Enumerable, :take, '(Integer n) -> Array<t> or nil'
92
+ RDL.type :Enumerable, :take_while, '() { (t) -> %bool } -> Array<t>'
93
+ RDL.type :Enumerable, :take_while, '() -> Enumerator<t>'
94
+ RDL.rdl_alias :Enumerable, :to_a, :entries
95
+ RDL.type :Enumerable, :to_h, '() -> Hash<t, t>' # TODO args?
96
+ # RDL.type :Enumerable, :zip, '(XXXX : *XXXX)' # TODO