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,24 @@
1
+ RDL.nowrap :Enumerator
2
+
3
+ RDL.type_params :Enumerator, [:t], :all?
4
+
5
+ RDL.type :Enumerator, :initialize, '(?Integer) { (Array<u>) -> %any } -> self<u>'
6
+ RDL.type :Enumerator, :initialize, '(?Proc) { (Array<u>) -> %any } -> self<u>' # TODO Proc
7
+ # TODO: deprecated form of new
8
+ RDL.type :Enumerator, :each, '() { (t) -> %any } -> %any' # is there a better RDL.type?
9
+ RDL.type :Enumerator, :each, '() -> self'
10
+ # TODO: args
11
+ RDL.type :Enumerator, :each_with_index, '() { (t, Integer) -> %any } -> %any' # TODO args
12
+ RDL.type :Enumerator, :each_with_index, '() -> Enumerator<[t, Integer]>' # TODO args
13
+ RDL.type :Enumerator, :each_with_object, '(u) { (t, u) -> %any } -> %any' # TODO args
14
+ RDL.type :Enumerator, :each_with_object, '(u) -> Enumerator<[t, u]>' # TODO args
15
+ RDL.type :Enumerator, :feed, '(t) -> nil'
16
+ RDL.type :Enumerator, :inspect, '() -> String'
17
+ RDL.type :Enumerator, :next, '() -> t'
18
+ RDL.type :Enumerator, :next_values, '() -> Array<t>'
19
+ RDL.type :Enumerator, :peek, '() -> t'
20
+ RDL.type :Enumerator, :peek_values, '() -> Array<t>'
21
+ RDL.type :Enumerator, :rewrind, '() -> self'
22
+ RDL.type :Enumerator, :size, '() -> Integer or Float or nil'
23
+ RDL.rdl_alias :Enumerator, :with_index, :each_with_index
24
+ RDL.rdl_alias :Enumerator, :with_object, :each_with_object
@@ -0,0 +1,15 @@
1
+ RDL.nowrap :Exception
2
+
3
+ RDL.type :Exception, :==, '(%any) -> %bool'
4
+ RDL.type :Exception, :backtrace, '() -> Array<String>'
5
+ RDL.type :Exception, :backtrace_locations, '() -> Array<Thread::Backtrace::Location>'
6
+ RDL.type :Exception, :cause, '() -> nil' # TODO exception is proper postcondition
7
+ RDL.type :Exception, :exception, '(?String) -> Exception' # or error
8
+ # RDL.type :Exception, :initialize, '() -> '
9
+ RDL.type :Exception, :inspect, '() -> String'
10
+ RDL.type :Exception, :message, '() -> String'
11
+ # RDL.type :Exception, :method_missing, '() -> '
12
+ # RDL.type :Exception, :respond_to?, '() -> '
13
+ # RDL.type :Exception, :respond_to_missing?, '() -> '
14
+ RDL.type :Exception, :set_backtrace, '(String or Array<String>) -> Array<String>'
15
+ RDL.type :Exception, :to_s, '() -> String'
@@ -0,0 +1,125 @@
1
+ RDL.nowrap :File
2
+
3
+ RDL.type :File, 'self.absolute_path', '(String file, ?String dir) -> String abs_file'
4
+ RDL.type :File, 'self.atime', '(%path or IO file) -> Time'
5
+ RDL.type :File, 'self.basename', '(String file, ?String suffix) -> String base_name'
6
+ RDL.type :File, 'self.binread', '(String) -> String'
7
+ RDL.type :File, 'self.binread', '(String, Fixnum) -> String'
8
+ RDL.type :File, 'self.binread', '(String, Fixnum, Fixnum) -> String'
9
+ RDL.type :File, 'self.birthtime', '(%path or IO file) -> Time'
10
+ RDL.type :File, 'self.blockdev?', '(String or IO file) -> %bool'
11
+ RDL.type :File, 'self.chardev?', '(String or IO file) -> %bool'
12
+ RDL.type :File, 'self.chmod', '(Integer mode, *String files) -> Integer'
13
+ RDL.type :File, 'self.chown', '(Integer owner, Integer group, *String files) -> Integer'
14
+ RDL.type :File, 'self.ctime', '(%path or IO file) -> Time'
15
+ RDL.type :File, 'self.delete', '(*String files) -> Integer'
16
+ RDL.type :File, 'self.directory?', '(String or IO file) -> %bool'
17
+ RDL.type :File, 'self.dirname', '(String file) -> String dir'
18
+ RDL.type :File, 'self.executable?', '(String file) -> %bool'
19
+ RDL.type :File, 'self.executable_real?', '(String file) -> %bool'
20
+ RDL.type :File, 'self.exist?', '(%path or IO file) -> %bool'
21
+ # exists? deprecated
22
+ RDL.type :File, 'self.expand_path', '(%path file, ?%path dir) -> String abs_file'
23
+ RDL.type :File, 'self.extname', '(String path) -> String'
24
+ RDL.type :File, 'self.file?', '(String or IO file) -> %bool'
25
+ RDL.type :File, 'self.fnmatch', '(String pattern, String path, ?Integer flags) -> %bool'
26
+ RDL.rdl_alias :File, :fnmatch?, :fnmatch
27
+ RDL.type :File, 'self.ftype', '(String file) -> String' # TODO: return in set of strings
28
+ RDL.type :File, 'self.grpowned?', '(String or IO file) -> %bool'
29
+ RDL.type :File, 'self.identical?', '(String or IO file_1, String or IO file_2) -> %bool'
30
+ RDL.type :File, 'self.join', '(*(%path or File or Array<String>)) -> String'
31
+ RDL.type :File, 'self.lchmod', '(Integer mode, *String files) -> Integer'
32
+ RDL.type :File, 'self.lchown', '(Integer owner, Integer group, *String files) -> Integer'
33
+ RDL.type :File, 'self.link', '(String old, String new) -> 0'
34
+ RDL.type :File, 'self.lstat', '(String file) -> File::Stat'
35
+ RDL.type :File, 'self.mtime', '(%path or IO file) -> Time'
36
+ RDL.type :File, 'self.open', '(%path file, ?String file, ?String perm, ?Integer opt, mode:?String, external_encoding: ?String, internal_encoding: ?String, encoding: ?String, textmode: ?%any, binmode: ?%any, autoclose: ?%any) -> File'
37
+ RDL.type :File, 'self.open', '(%path file, ?String mode, ?String perm, ?Integer opt, mode:?String, external_encoding: ?String, internal_encoding: ?String, encoding: ?String, textmode: ?%any, binmode: ?%any, autoclose: ?%any) { (File) -> t } -> t'
38
+ RDL.type :File, 'self.owned?', '(String file) -> %bool'
39
+ RDL.type :File, 'self.path', '(String path) -> String'
40
+ RDL.type :File, 'self.pipe?', '(String file) -> %bool'
41
+ RDL.type :File, 'self.readable?', '(String file) -> %bool'
42
+ RDL.type :File, 'self.readable_real?', '(String file) -> %bool'
43
+ RDL.type :File, 'self.readlink', '(String link) -> String file'
44
+ RDL.type :File, 'self.readldirpath', '(String pathname, ?String dir) -> String real_pathname'
45
+ RDL.type :File, 'self.realpath', '(String pathname, ?String dir) -> String real_pathname'
46
+ RDL.type :File, 'self.rename', '(String old, String new) -> 0'
47
+ RDL.type :File, 'self.setgid?', '(String file) -> %bool'
48
+ RDL.type :File, 'self.setuid?', '(String file) -> %bool'
49
+ RDL.type :File, 'self.size', '(String or IO file) -> Integer'
50
+ RDL.type :File, 'self.size?', '(String or IO file) -> Integer or nil'
51
+ RDL.type :File, 'self.socket?', '(String or IO file) -> %bool'
52
+ RDL.type :File, 'self.split', '(String file) -> [String, String]'
53
+ RDL.type :File, 'self.stat', '(%path file) -> File::Stat'
54
+ RDL.type :File, 'self.sticky?', '(String file) -> %bool'
55
+ RDL.type :File, 'self.symlink', '(String old, String new) -> 0'
56
+ RDL.type :File, 'self.symlink?', '(String file) -> %bool'
57
+ RDL.type :File, 'self.truncate', '(String file, Integer) -> 0'
58
+ RDL.type :File, 'self.umask', '(?Integer) -> Integer'
59
+ RDL.rdl_alias :File, :unlink, :delete
60
+ RDL.type :File, 'self.utime', '(Time atime, Time mtime, *String files) -> Integer'
61
+ RDL.type :File, 'self.world_readable?', '(String or IO file) -> Integer or nil'
62
+ RDL.type :File, 'self.world_writable?', '(String or IO file) -> Integer or nil'
63
+ RDL.type :File, 'self.writable?', '(String file) -> Integer or nil'
64
+ RDL.type :File, 'self.writable_real?', '(String file) -> Integer or nil'
65
+ RDL.type :File, 'self.zero?', '(String or IO file) -> Integer or nil'
66
+
67
+ RDL.type :File, :atime, '() -> Time'
68
+ RDL.type :File, :birthtime, '() -> Time'
69
+ RDL.type :File, :chmod, '(Integer mode) -> 0'
70
+ RDL.type :File, :chown, '(Integer owner, Integer group) -> 0'
71
+ RDL.type :File, :ctime, '() -> Time'
72
+ RDL.type :File, :flock, '(Integer) -> 0 or %bool'
73
+ RDL.type :File, :initialize, '(String file, ?String mode, ?String perm, ?Integer opt) -> self'
74
+ RDL.type :File, :lstat, '() -> File::Stat'
75
+ RDL.type :File, :mtime, '() -> Time'
76
+ RDL.type :File, :path, '() -> String file'
77
+ RDL.type :File, :size, '() -> Integer'
78
+ RDL.rdl_alias :File, :to_path, :path
79
+ RDL.type :File, :truncate, '(Integer) -> 0'
80
+
81
+ RDL.nowrap :'File::Stat'
82
+
83
+ RDL.type :'File::Stat', :<=>, '(File::Stat other) -> -1 or 0 or 1 or nil'
84
+ RDL.type :'File::Stat', :atime, '() -> Time'
85
+ RDL.type :'File::Stat', :birthtime, '() -> Time'
86
+ RDL.type :'File::Stat', :blksize, '() -> Integer or nil'
87
+ RDL.type :'File::Stat', :blockdev?, '() -> %bool'
88
+ RDL.type :'File::Stat', :blocks, '() -> Integer or nil'
89
+ RDL.type :'File::Stat', :chardev?, '() -> %bool'
90
+ RDL.type :'File::Stat', :ctime, '() -> Time'
91
+ RDL.type :'File::Stat', :dev, '() -> Integer'
92
+ RDL.type :'File::Stat', :dev_major, '() -> Integer'
93
+ RDL.type :'File::Stat', :dev_minor, '() -> Integer'
94
+ RDL.type :'File::Stat', :directory?, '() -> %bool'
95
+ RDL.type :'File::Stat', :executable?, '() -> %bool'
96
+ RDL.type :'File::Stat', :executable_real?, '() -> %bool'
97
+ RDL.type :'File::Stat', :file?, '() -> %bool'
98
+ RDL.type :'File::Stat', :ftype, '() -> String'
99
+ RDL.type :'File::Stat', :gid, '() -> Integer'
100
+ RDL.type :'File::Stat', :grpowned?, '() -> %bool'
101
+ RDL.type :'File::Stat', :ino, '() -> Integer'
102
+ RDL.type :'File::Stat', :initialize, '(String file) -> self'
103
+ RDL.type :'File::Stat', :inspect, '() -> String'
104
+ RDL.type :'File::Stat', :mode, '() -> Integer'
105
+ RDL.type :'File::Stat', :mtime, '() -> Time'
106
+ RDL.type :'File::Stat', :nlink, '() -> Integer'
107
+ RDL.type :'File::Stat', :owned?, '() -> %bool'
108
+ RDL.type :'File::Stat', :pip?, '() -> %bool'
109
+ RDL.type :'File::Stat', :rdev, '() -> Integer or nil'
110
+ RDL.type :'File::Stat', :rdev_major, '() -> Integer'
111
+ RDL.type :'File::Stat', :rdev_minor, '() -> Integer'
112
+ RDL.type :'File::Stat', :readable?, '() -> %bool'
113
+ RDL.type :'File::Stat', :readable_real?, '() -> %bool'
114
+ RDL.type :'File::Stat', :setgid?, '() -> %bool'
115
+ RDL.type :'File::Stat', :setuid?, '() -> %bool'
116
+ RDL.type :'File::Stat', :size, '() -> Integer'
117
+ RDL.type :'File::Stat', :socket?, '() -> %bool'
118
+ RDL.type :'File::Stat', :sticky?, '() -> %bool'
119
+ RDL.type :'File::Stat', :symlink?, '() -> %bool'
120
+ RDL.type :'File::Stat', :uid, '() -> Integer'
121
+ RDL.type :'File::Stat', :world_readable?, '() -> Integer or nil'
122
+ RDL.type :'File::Stat', :world_writable?, '() -> Integer or nil'
123
+ RDL.type :'File::Stat', :writable?, '() -> %bool'
124
+ RDL.type :'File::Stat', :writable_real?, '() -> %bool'
125
+ RDL.type :'File::Stat', :zero?, '() -> %bool'
@@ -0,0 +1,4 @@
1
+ RDL.nowrap :FileUtils
2
+
3
+ RDL.type :FileUtils, 'self.cp_r', '(String or Pathname, String or Pathname, ?Hash<:preserve or :noop or :verbose or :dereference_root or :remove_destination, %bool>) -> Array<String>'
4
+ RDL.type :FileUtils, 'self.mkdir_p', '(String or Pathname, ?Hash<:mode or :noop or :verbose, %bool>) -> Array<String>'
@@ -0,0 +1,213 @@
1
+ RDL.nowrap :Fixnum
2
+
3
+ RDL.type :Fixnum, :%, '(Fixnum x {{ x!=0 }}) -> Fixnum', version: RDL::Globals::FIXBIG_VERSIONS
4
+ RDL.type :Fixnum, :%, '(Bignum x {{ x!=0 }}) -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
5
+ RDL.type :Fixnum, :%, '(Float x {{ x!=0 }}) -> Float', version: RDL::Globals::FIXBIG_VERSIONS
6
+ RDL.type :Fixnum, :%, '(Rational x {{ x!=0}}) -> Rational', version: RDL::Globals::FIXBIG_VERSIONS
7
+ RDL.type :Fixnum, :%, '(BigDecimal x {{ x!=0}}) -> BigDecimal', version: RDL::Globals::FIXBIG_VERSIONS
8
+
9
+ RDL.type :Fixnum, :&, '(Integer) -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
10
+
11
+ RDL.type :Fixnum, :*, '(Integer) -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
12
+ RDL.type :Fixnum, :*, '(Float) -> Float', version: RDL::Globals::FIXBIG_VERSIONS
13
+ RDL.type :Fixnum, :*, '(Rational) -> Rational', version: RDL::Globals::FIXBIG_VERSIONS
14
+ RDL.type :Fixnum, :*, '(BigDecimal) -> BigDecimal', version: RDL::Globals::FIXBIG_VERSIONS
15
+ RDL.type :Fixnum, :*, '(Complex) -> Complex', version: RDL::Globals::FIXBIG_VERSIONS
16
+ RDL.pre(:Fixnum, :*, 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
17
+
18
+ RDL.type :Fixnum, :**, '(Integer) -> %numeric', version: RDL::Globals::FIXBIG_VERSIONS
19
+ RDL.type :Fixnum, :**, '(Float) -> %numeric', version: RDL::Globals::FIXBIG_VERSIONS
20
+ RDL.type :Fixnum, :**, '(Rational) -> %numeric', version: RDL::Globals::FIXBIG_VERSIONS
21
+ RDL.type :Fixnum, :**, '(BigDecimal) -> BigDecimal', version: RDL::Globals::FIXBIG_VERSIONS
22
+ RDL.pre(:Fixnum, :**, version: RDL::Globals::FIXBIG_VERSIONS) { |x| x!=BigDecimal::INFINITY && if self<0 then x<=-1||x>=0 else true end}
23
+ RDL.post(:Fixnum, :**, version: RDL::Globals::FIXBIG_VERSIONS) { |r,x| r.real?}
24
+ RDL.type :Fixnum, :**, '(Complex) -> Complex', version: RDL::Globals::FIXBIG_VERSIONS
25
+ RDL.pre(:Fixnum, :**, 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}
26
+
27
+ RDL.type :Fixnum, :+, '(Integer) -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
28
+ RDL.type :Fixnum, :+, '(Float) -> Float', version: RDL::Globals::FIXBIG_VERSIONS
29
+ RDL.type :Fixnum, :+, '(Rational) -> Rational', version: RDL::Globals::FIXBIG_VERSIONS
30
+ RDL.type :Fixnum, :+, '(BigDecimal) -> BigDecimal', version: RDL::Globals::FIXBIG_VERSIONS
31
+ RDL.type :Fixnum, :+, '(Complex) -> Complex', version: RDL::Globals::FIXBIG_VERSIONS
32
+
33
+ RDL.type :Fixnum, :-, '(Integer) -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
34
+ RDL.type :Fixnum, :-, '(Float) -> Float', version: RDL::Globals::FIXBIG_VERSIONS
35
+ RDL.type :Fixnum, :-, '(Rational) -> Rational', version: RDL::Globals::FIXBIG_VERSIONS
36
+ RDL.type :Fixnum, :-, '(BigDecimal) -> BigDecimal', version: RDL::Globals::FIXBIG_VERSIONS
37
+ RDL.type :Fixnum, :-, '(Complex) -> Complex', version: RDL::Globals::FIXBIG_VERSIONS
38
+
39
+ RDL.type :Fixnum, :-@, '() -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
40
+
41
+ RDL.type :Fixnum, :+@, '() -> Fixnum', version: RDL::Globals::FIXBIG_VERSIONS
42
+
43
+ RDL.type :Fixnum, :/, '(Integer x {{ x!=0 }}) -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
44
+ RDL.type :Fixnum, :/, '(Float x {{ x!=0 }}) -> Float', version: RDL::Globals::FIXBIG_VERSIONS
45
+ RDL.type :Fixnum, :/, '(Rational x {{ x!=0 }}) -> Rational', version: RDL::Globals::FIXBIG_VERSIONS
46
+ RDL.type :Fixnum, :/, '(BigDecimal x {{ x!=0 }}) -> BigDecimal', version: RDL::Globals::FIXBIG_VERSIONS
47
+ RDL.type :Fixnum, :/, '(Complex x {{ x!=0 }}) -> Complex', version: RDL::Globals::FIXBIG_VERSIONS
48
+ RDL.pre(:Fixnum, :/, 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}
49
+
50
+ RDL.type :Fixnum, :<, '(Integer) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
51
+ RDL.type :Fixnum, :<, '(Float) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
52
+ RDL.type :Fixnum, :<, '(Rational) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
53
+ RDL.type :Fixnum, :<, '(BigDecimal) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
54
+
55
+ RDL.type :Fixnum, :<<, '(Fixnum) -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
56
+
57
+ RDL.type :Fixnum, :<=, '(Integer) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
58
+ RDL.type :Fixnum, :<=, '(Float) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
59
+ RDL.type :Fixnum, :<=, '(Rational) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
60
+ RDL.type :Fixnum, :<=, '(BigDecimal) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
61
+
62
+ RDL.type :Fixnum, :<=>, '(Integer) -> Object', version: RDL::Globals::FIXBIG_VERSIONS
63
+ RDL.post(:Fixnum, :<=>, version: RDL::Globals::FIXBIG_VERSIONS) { |r,x| r == -1 || r==0 || r==1}
64
+ RDL.type :Fixnum, :<=>, '(Float) -> Object', version: RDL::Globals::FIXBIG_VERSIONS
65
+ RDL.post(:Fixnum, :<=>, version: RDL::Globals::FIXBIG_VERSIONS) { |r,x| r == -1 || r==0 || r==1}
66
+ RDL.type :Fixnum, :<=>, '(Rational) -> Object', version: RDL::Globals::FIXBIG_VERSIONS
67
+ RDL.post(:Fixnum, :<=>, version: RDL::Globals::FIXBIG_VERSIONS) { |r,x| r == -1 || r==0 || r==1}
68
+ RDL.type :Fixnum, :<=>, '(BigDecimal) -> Object', version: RDL::Globals::FIXBIG_VERSIONS
69
+ RDL.post(:Fixnum, :<=>, version: RDL::Globals::FIXBIG_VERSIONS) { |r,x| r == -1 || r==0 || r==1}
70
+
71
+ RDL.type :Fixnum, :==, '(Object) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
72
+
73
+ RDL.type :Fixnum, :===, '(Object) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
74
+
75
+ RDL.type :Fixnum, :>, '(Integer) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
76
+ RDL.type :Fixnum, :>, '(Float) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
77
+ RDL.type :Fixnum, :>, '(Rational) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
78
+ RDL.type :Fixnum, :>, '(BigDecimal) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
79
+
80
+ RDL.type :Fixnum, :>=, '(Integer) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
81
+ RDL.type :Fixnum, :>=, '(Float) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
82
+ RDL.type :Fixnum, :>=, '(Rational) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
83
+ RDL.type :Fixnum, :>=, '(BigDecimal) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
84
+
85
+ RDL.type :Fixnum, :>>, '(Integer) -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
86
+ RDL.post(:Fixnum, :>>, version: RDL::Globals::FIXBIG_VERSIONS) { |r,x| r >= 0 }
87
+
88
+ RDL.type :Fixnum, :[], '(Integer) -> Fixnum', version: RDL::Globals::FIXBIG_VERSIONS
89
+ RDL.post(:Fixnum, :[], version: RDL::Globals::FIXBIG_VERSIONS) { |r,x| r == 0 || r==1}
90
+ RDL.type :Fixnum, :[], '(Rational) -> Fixnum', version: RDL::Globals::FIXBIG_VERSIONS
91
+ RDL.post(:Fixnum, :[], version: RDL::Globals::FIXBIG_VERSIONS) { |r,x| r == 0 || r==1}
92
+ RDL.type :Fixnum, :[], '(Float) -> Fixnum', version: RDL::Globals::FIXBIG_VERSIONS
93
+ RDL.pre(:Fixnum, :[], version: RDL::Globals::FIXBIG_VERSIONS) { |x| x!=Float::INFINITY && !x.nan? }
94
+ RDL.post(:Fixnum, :[], version: RDL::Globals::FIXBIG_VERSIONS) { |r,x| r == 0 || r==1}
95
+ RDL.type :Fixnum, :[], '(BigDecimal) -> Fixnum', version: RDL::Globals::FIXBIG_VERSIONS
96
+ RDL.pre(:Fixnum, :[], version: RDL::Globals::FIXBIG_VERSIONS) { |x| x!=BigDecimal::INFINITY && !x.nan? }
97
+ RDL.post(:Fixnum, :[], version: RDL::Globals::FIXBIG_VERSIONS) { |r,x| r == 0 || r==1}
98
+
99
+ RDL.type :Fixnum, :^, '(Integer) -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
100
+
101
+ RDL.type :Fixnum, :|, '(Integer) -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
102
+
103
+ RDL.type :Fixnum, :~, '() -> Fixnum', version: RDL::Globals::FIXBIG_VERSIONS
104
+
105
+ RDL.type :Fixnum, :abs, '() -> Integer r {{ r>=0 }}', version: RDL::Globals::FIXBIG_VERSIONS
106
+
107
+ RDL.type :Fixnum, :bit_length, '() -> Fixnum r {{ r>=0 }}', version: RDL::Globals::FIXBIG_VERSIONS
108
+
109
+ RDL.type :Fixnum, :div, '(Fixnum x {{ x!=0 }}) -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
110
+ RDL.type :Fixnum, :div, '(Bignum x {{ x!=0 }}) -> Fixnum', version: RDL::Globals::FIXBIG_VERSIONS
111
+ RDL.type :Fixnum, :div, '(Float x {{ x!=0 && !x.nan? }}) -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
112
+ RDL.type :Fixnum, :div, '(Rational x {{ x!=0 }}) -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
113
+ RDL.type :Fixnum, :div, '(BigDecimal x {{ x!=0 && !x.nan? }}) -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
114
+
115
+ RDL.type :Fixnum, :divmod, '(%real x {{ x!=0 }}) -> [%real, %real]', version: RDL::Globals::FIXBIG_VERSIONS
116
+ RDL.pre(:Fixnum, :divmod, version: RDL::Globals::FIXBIG_VERSIONS) { |x| if x.is_a?(Float) then !x.nan? else true end}
117
+
118
+ RDL.type :Fixnum, :even?, '() -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
119
+
120
+ RDL.type :Fixnum, :fdiv, '(Integer) -> Float', version: RDL::Globals::FIXBIG_VERSIONS
121
+ RDL.type :Fixnum, :fdiv, '(Float) -> Float', version: RDL::Globals::FIXBIG_VERSIONS
122
+ RDL.type :Fixnum, :fdiv, '(Rational) -> Float', version: RDL::Globals::FIXBIG_VERSIONS
123
+ RDL.type :Fixnum, :fdiv, '(BigDecimal) -> BigDecimal', version: RDL::Globals::FIXBIG_VERSIONS
124
+ RDL.type :Fixnum, :fdiv, '(Complex) -> Complex', version: RDL::Globals::FIXBIG_VERSIONS
125
+ RDL.pre(:Fixnum, :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 :Fixnum, :to_s, '() -> String', version: RDL::Globals::FIXBIG_VERSIONS
128
+ RDL.type :Fixnum, :inspect, '() -> String', version: RDL::Globals::FIXBIG_VERSIONS
129
+
130
+ RDL.type :Fixnum, :magnitude, '() -> Integer r {{ r>=0 }}', version: RDL::Globals::FIXBIG_VERSIONS
131
+
132
+ RDL.type :Fixnum, :modulo, '(Fixnum x {{ x!=0 }}) -> Fixnum', version: RDL::Globals::FIXBIG_VERSIONS
133
+ RDL.type :Fixnum, :modulo, '(Bignum x {{ x!=0 }}) -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
134
+ RDL.type :Fixnum, :modulo, '(Float x {{ x!=0 }}) -> Float', version: RDL::Globals::FIXBIG_VERSIONS
135
+ RDL.type :Fixnum, :modulo, '(Rational x {{ x!=0 }}) -> Rational', version: RDL::Globals::FIXBIG_VERSIONS
136
+ RDL.type :Fixnum, :modulo, '(BigDecimal x {{ x!=0 }}) -> BigDecimal', version: RDL::Globals::FIXBIG_VERSIONS
137
+
138
+ RDL.type :Fixnum, :next, '() -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
139
+
140
+ RDL.type :Fixnum, :odd?, '() -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
141
+
142
+ RDL.type :Fixnum, :size, '() -> Fixnum', version: RDL::Globals::FIXBIG_VERSIONS
143
+
144
+ RDL.type :Fixnum, :succ, '() -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
145
+
146
+ RDL.type :Fixnum, :to_f, '() -> Float', version: RDL::Globals::FIXBIG_VERSIONS
147
+
148
+ RDL.type :Fixnum, :zero?, '() -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
149
+
150
+ RDL.type :Fixnum, :ceil, '() -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
151
+
152
+ RDL.type :Fixnum, :denominator, '() -> Fixnum r {{ r==1 }}', version: RDL::Globals::FIXBIG_VERSIONS
153
+
154
+ RDL.type :Fixnum, :floor, '() -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
155
+ RDL.type :Fixnum, :numerator, '() -> Fixnum', version: RDL::Globals::FIXBIG_VERSIONS
156
+
157
+ RDL.type :Fixnum, :quo, '(Integer x {{ x!=0 }}) -> Rational', version: RDL::Globals::FIXBIG_VERSIONS
158
+ RDL.type :Fixnum, :quo, '(Float x {{ x!=0 }}) -> Float', version: RDL::Globals::FIXBIG_VERSIONS
159
+ RDL.type :Fixnum, :quo, '(Rational x {{ x!=0 }}) -> Rational', version: RDL::Globals::FIXBIG_VERSIONS
160
+ RDL.type :Fixnum, :quo, '(BigDecimal x {{ x!=0 }}) -> BigDecimal', version: RDL::Globals::FIXBIG_VERSIONS
161
+ RDL.type :Fixnum, :quo, '(Complex x {{ x!=0 }}) -> Complex', version: RDL::Globals::FIXBIG_VERSIONS
162
+ RDL.pre(:Fixnum, :quo, 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}
163
+
164
+ RDL.type :Fixnum, :rationalize, '() -> Rational', version: RDL::Globals::FIXBIG_VERSIONS
165
+
166
+ RDL.type :Fixnum, :rationalize, '(%numeric) -> Rational', version: RDL::Globals::FIXBIG_VERSIONS
167
+
168
+ RDL.type :Fixnum, :round, '() -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
169
+
170
+ RDL.type :Fixnum, :round, '(%numeric) -> %numeric', version: RDL::Globals::FIXBIG_VERSIONS
171
+ RDL.pre(:Fixnum, :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].
172
+
173
+ RDL.type :Fixnum, :to_i, '() -> Fixnum', version: RDL::Globals::FIXBIG_VERSIONS
174
+
175
+ RDL.type :Fixnum, :to_r, '() -> Rational', version: RDL::Globals::FIXBIG_VERSIONS
176
+
177
+ RDL.type :Fixnum, :truncate, '() -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
178
+
179
+ RDL.type :Fixnum, :angle, '() -> %numeric', version: RDL::Globals::FIXBIG_VERSIONS
180
+ RDL.post(:Fixnum, :angle, version: RDL::Globals::FIXBIG_VERSIONS) { |r,x| r == 0 || r == Math::PI}
181
+
182
+ RDL.type :Fixnum, :arg, '() -> %numeric', version: RDL::Globals::FIXBIG_VERSIONS
183
+ RDL.post(:Fixnum, :arg, version: RDL::Globals::FIXBIG_VERSIONS) { |r,x| r == 0 || r == Math::PI}
184
+
185
+ RDL.type :Fixnum, :equal?, '(Object) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
186
+ RDL.type :Fixnum, :eql?, '(Object) -> %bool', version: RDL::Globals::FIXBIG_VERSIONS
187
+
188
+ RDL.type :Fixnum, :hash, '() -> Integer', version: RDL::Globals::FIXBIG_VERSIONS
189
+
190
+ RDL.type :Fixnum, :phase, '() -> %numeric', version: RDL::Globals::FIXBIG_VERSIONS
191
+
192
+ RDL.type :Fixnum, :abs2, '() -> Integer r {{ r>=0 }}', version: RDL::Globals::FIXBIG_VERSIONS
193
+
194
+ RDL.type :Fixnum, :conj, '() -> Fixnum', version: RDL::Globals::FIXBIG_VERSIONS
195
+ RDL.type :Fixnum, :conjugate, '() -> Fixnum', version: RDL::Globals::FIXBIG_VERSIONS
196
+
197
+ RDL.type :Fixnum, :imag, '() -> Fixnum r {{ r==0 }}', version: RDL::Globals::FIXBIG_VERSIONS
198
+ RDL.type :Fixnum, :imaginary, '() -> Fixnum r {{ r==0 }}', version: RDL::Globals::FIXBIG_VERSIONS
199
+
200
+ RDL.type :Fixnum, :real, '() -> Fixnum', version: RDL::Globals::FIXBIG_VERSIONS
201
+
202
+ RDL.type :Fixnum, :real?, '() -> true', version: RDL::Globals::FIXBIG_VERSIONS
203
+
204
+ RDL.type :Fixnum, :to_c, '() -> Complex r {{ r.imaginary == 0 }}', version: RDL::Globals::FIXBIG_VERSIONS
205
+
206
+ RDL.type :Fixnum, :remainder, '(Fixnum x {{ x!=0 }}) -> Fixnum r {{ r>0 }}', version: RDL::Globals::FIXBIG_VERSIONS
207
+ RDL.type :Fixnum, :remainder, '(Bignum x {{ x!=0 }}) -> Fixnum r {{ r>0 }}', version: RDL::Globals::FIXBIG_VERSIONS
208
+ RDL.type :Fixnum, :remainder, '(Float x {{ x!=0 }}) -> Float', version: RDL::Globals::FIXBIG_VERSIONS
209
+ RDL.type :Fixnum, :remainder, '(Rational x {{ x!=0 }}) -> Rational r {{ r>0 }}', version: RDL::Globals::FIXBIG_VERSIONS
210
+ RDL.type :Fixnum, :remainder, '(BigDecimal x {{ x=0 }}) -> BigDecimal', version: RDL::Globals::FIXBIG_VERSIONS
211
+
212
+ RDL.type :Fixnum, :coerce, '(%numeric) -> [%real, %real]', version: RDL::Globals::FIXBIG_VERSIONS
213
+ RDL.pre(:Fixnum, :coerce, version: RDL::Globals::FIXBIG_VERSIONS) { |x| if x.is_a?(Complex) then x.imaginary==0 else true end}
@@ -0,0 +1,199 @@
1
+ RDL.nowrap :Float
2
+
3
+ RDL.type :Float, :%, '(Integer x {{ x != 0 }}) -> Float'
4
+ RDL.type :Float, :%, '(Float x {{ x != 0 }}) -> Float'
5
+ RDL.type :Float, :%, '(Rational x {{ x != 0 }}) -> Float'
6
+ RDL.type :Float, :%, '(BigDecimal x {{ x != 0 && !self.infinite? && !self.nan? }}) -> BigDecimal'
7
+
8
+ RDL.type :Float, :*, '(Integer) -> Float'
9
+ RDL.type :Float, :*, '(Float) -> Float'
10
+ RDL.type :Float, :*, '(Rational) -> Float'
11
+ RDL.type :Float, :*, '(BigDecimal x {{ !self.infinite? && !self.nan? }}) -> BigDecimal'
12
+ RDL.type :Float, :*, '(Complex) -> Complex'
13
+ RDL.pre(:Float, :*) { |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) && self!=Float::INFINITY && !(self.nan?) else true end} #can't have a complex with part BigDecimal, other part infinity/NAN
14
+
15
+ RDL.type :Float, :**, '(Integer) -> Float'
16
+ RDL.type :Float, :**, '(Float) -> %numeric'
17
+ RDL.type :Float, :**, '(Rational) -> %numeric'
18
+ RDL.type :Float, :**, '(BigDecimal) -> BigDecimal'
19
+ RDL.pre(:Float, :**) { |x| x!=BigDecimal::INFINITY && if self<0 then x<=-1||x>=0 else true end}
20
+ RDL.post(:Float, :**) { |x| x.real?}
21
+ RDL.type :Float, :**, '(Complex) -> Complex'
22
+ RDL.pre(:Float, :**) { |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) && self!=Float::INFINITY && !(self.nan?) else true end}
23
+
24
+ RDL.type :Float, :+, '(Integer) -> Float'
25
+ RDL.type :Float, :+, '(Float) -> Float'
26
+ RDL.type :Float, :+, '(Rational) -> Float'
27
+ RDL.type :Float, :+, '(BigDecimal x {{ !self.infinite? && !self.nan? }}) -> BigDecimal'
28
+ RDL.type :Float, :+, '(Complex) -> Complex'
29
+ RDL.pre(:Float, :+) { |x| if x.real.is_a?(BigDecimal) then self!=Float::INFINITY && !(self.nan?) else true end}
30
+
31
+ RDL.type :Float, :-, '(Integer) -> Float'
32
+ RDL.type :Float, :-, '(Float) -> Float'
33
+ RDL.type :Float, :-, '(Rational) -> Float'
34
+ RDL.type :Float, :-, '(BigDecimal x {{ !self.infinite? && !self.nan? }}) -> BigDecimal'
35
+ RDL.type :Float, :-, '(Complex) -> Complex'
36
+ RDL.pre(:Float, :-) { |x| if x.real.is_a?(BigDecimal) then self!=Float::INFINITY && !(self.nan?) else true end}
37
+
38
+ RDL.type :Float, :-@, '() -> Float'
39
+
40
+ RDL.type :Float, :+@, '() -> Float'
41
+
42
+ RDL.type :Float, :/, '(Integer x {{ x != 0 }}) -> Float'
43
+ RDL.type :Float, :/, '(Float x {{ x != 0 }}) -> Float'
44
+ RDL.type :Float, :/, '(Rational x {{ x != 0 }}) -> Float'
45
+ RDL.type :Float, :/, '(BigDecimal x {{ x != 0 && !self.infinite? && !self.nan? }}) -> BigDecimal'
46
+ RDL.type :Float, :/, '(Complex x {{ x != 0 }}) -> Complex'
47
+ RDL.pre(:Float, :/) { |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) && self!=Float::INFINITY && !(self.nan?) 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 :Float, :<, '(Integer) -> %bool'
50
+ RDL.type :Float, :<, '(Float) -> %bool'
51
+ RDL.type :Float, :<, '(Rational) -> %bool'
52
+ RDL.type :Float, :<, '(BigDecimal x {{ !self.nan? && !self.infinite? }}) -> %bool'
53
+
54
+ RDL.type :Float, :<=, '(Integer) -> %bool'
55
+ RDL.type :Float, :<=, '(Float) -> %bool'
56
+ RDL.type :Float, :<=, '(Rational) -> %bool'
57
+ RDL.type :Float, :<=, '(BigDecimal x {{ !self.nan? && !self.infinite? }}) -> %bool'
58
+
59
+ RDL.type :Float, :<=>, '(Integer) -> Object'
60
+ RDL.post(:Float, :<=>) { |x| x == -1 || x==0 || x==1}
61
+ RDL.type :Float, :<=>, '(Float) -> Object'
62
+ RDL.post(:Float, :<=>) { |x| x == -1 || x==0 || x==1}
63
+ RDL.type :Float, :<=>, '(Rational) -> Object'
64
+ RDL.post(:Float, :<=>) { |x| x == -1 || x==0 || x==1}
65
+ RDL.type :Float, :<=>, '(BigDecimal x {{ !self.infinite? && !self.nan? }}) -> Object'
66
+ RDL.post(:Float, :<=>) { |x| x == -1 || x==0 || x==1}
67
+
68
+ RDL.type :Float, :==, '(Object) -> %bool'
69
+ RDL.pre(:Float, :==) { |x| if (x.is_a?(BigDecimal)) then (!self.nan? && self!=Float::INFINITY) else true end}
70
+
71
+ RDL.type :Float, :===, '(Object) -> %bool'
72
+ RDL.pre(:Float, :===) { |x| if (x.is_a?(BigDecimal)) then (!self.nan? && self!=Float::INFINITY) else true end}
73
+
74
+ RDL.type :Float, :>, '(Integer) -> %bool'
75
+ RDL.type :Float, :>, '(Float) -> %bool'
76
+ RDL.type :Float, :>, '(Rational) -> %bool'
77
+ RDL.type :Float, :>, '(BigDecimal x {{ !self.infinite? && !self.nan? }}) -> %bool'
78
+
79
+ RDL.type :Float, :>=, '(Integer) -> %bool'
80
+ RDL.type :Float, :>=, '(Float) -> %bool'
81
+ RDL.type :Float, :>=, '(Rational) -> %bool'
82
+ RDL.type :Float, :>=, '(BigDecimal x {{ !self.infinite? && !self.nan? }}) -> %bool'
83
+
84
+ RDL.type :Float, :abs, '() -> Float r {{ r>=0 || (if self.nan? then r.nan? end) }}'
85
+
86
+ RDL.type :Float, :abs2, '() -> Float r {{ r>=0 || (if self.nan? then r.nan? end) }}'
87
+
88
+ RDL.type :Float, :div, '(Integer x {{ x != 0 && !self.infinite? && !self.nan? }}) -> Integer'
89
+ RDL.type :Float, :div, '(Float x {{ x != 0 && !self.infinite? && !self.nan? }}) -> Integer'
90
+ RDL.type :Float, :div, '(Rational x {{ x != 0 && !self.infinite? && !self.nan? }}) -> Integer'
91
+ RDL.type :Float, :div, '(BigDecimal x {{ x != 0 && !x.nan? && !self.infinite? && !self.nan? }}) -> Integer'
92
+
93
+ RDL.type :Float, :divmod, '(%real) -> [%real, %real]'
94
+ RDL.pre(:Float, :divmod) { |x| x != 0 && if x.is_a?(Float) then !x.nan? else true end && self!=Float::INFINITY && !self.nan?}
95
+
96
+ RDL.type :Float, :angle, '() -> %numeric'
97
+ RDL.post(:Float, :angle) { |r,x| r == 0 || r == Math::PI || r == Float::NAN}
98
+
99
+ RDL.type :Float, :arg, '() -> %numeric'
100
+ RDL.post(:Float, :arg) { |r,x| r == 0 || r == Math::PI || r == Float::NAN}
101
+
102
+ RDL.type :Float, :ceil, '() -> Integer'
103
+ RDL.pre(:Float, :ceil) { !self.infinite? && !self.nan?}
104
+
105
+ RDL.type :Float, :coerce, '(%real) -> [Float, Float]'
106
+
107
+ RDL.type :Float, :denominator, '() -> Integer r {{ r>0 }}'
108
+
109
+ RDL.type :Float, :equal?, '(Object) -> %bool'
110
+
111
+ RDL.type :Float, :eql?, '(Object) -> %bool'
112
+
113
+ RDL.type :Float, :fdiv, '(Integer) -> Float'
114
+ RDL.type :Float, :fdiv, '(Float) -> Float'
115
+ RDL.type :Float, :fdiv, '(Rational) -> Float'
116
+ RDL.type :Float, :fdiv, '(BigDecimal x {{ !self.infinite? && !self.nan? }}) -> BigDecimal'
117
+ RDL.type :Float, :fdiv, '(Complex) -> Complex'
118
+ RDL.pre(:Float, :fdiv) { |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) && self!=Float::INFINITY && !(self.nan?) else true end && if (x.real.is_a?(Rational) && x.imaginary.is_a?(Float)) then !x.imaginary.nan? else true end}
119
+
120
+ RDL.type :Float, :finite?, '() -> %bool'
121
+
122
+ RDL.type :Float, :floor, '() -> Integer'
123
+ RDL.pre(:Float, :ceil) { !self.infinite? && !self.nan?}
124
+
125
+ RDL.type :Float, :hash, '() -> Integer'
126
+
127
+ RDL.type :Float, :infinite?, '() -> Object'
128
+ RDL.post(:Float, :infinite?) { |r,x| r == -1 || r == 1 || r == nil }
129
+
130
+ RDL.type :Float, :to_s, '() -> String'
131
+ RDL.type :Float, :inspect, '() -> String'
132
+
133
+ RDL.type :Float, :magnitude, '() -> Float'
134
+ RDL.post(:Float, :magnitude) { |r,x| r>=0 }
135
+
136
+ RDL.type :Float, :modulo, '(Integer x {{ x != 0 }}) -> Float'
137
+ RDL.type :Float, :modulo, '(Float x {{ x != 0 }}) -> Float'
138
+ RDL.type :Float, :modulo, '(Rational x {{ x != 0 }}) -> Float'
139
+ RDL.type :Float, :modulo, '(BigDecimal x {{ x != 0 && !self.infinite? && !self.nan? }}) -> BigDecimal'
140
+
141
+ RDL.type :Float, :nan?, '() -> %bool'
142
+
143
+ RDL.type :Float, :next_float, '() -> Float'
144
+
145
+ RDL.type :Float, :numerator, '() -> Integer'
146
+
147
+ RDL.type :Float, :phase, '() -> %numeric'
148
+ RDL.post(:Float, :phase) { |r,x| r == 0 || r == Math::PI || r == Float::NAN}
149
+
150
+ RDL.type :Float, :prev_float, '() -> Float'
151
+
152
+ RDL.type :Float, :quo, '(Integer x {{ x != 0 }}) -> Float'
153
+ RDL.type :Float, :quo, '(Float x {{ x != 0 }}) -> Float'
154
+ RDL.type :Float, :quo, '(Rational x {{ x != 0 }}) -> Float'
155
+ RDL.type :Float, :quo, '(BigDecimal x {{ x != 0 && !self.infinite? && !self.nan? }}) -> BigDecimal'
156
+ RDL.type :Float, :quo, '(Complex x {{ x != 0 }}) -> Complex'
157
+ RDL.pre(:Float, :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) && self!=Float::INFINITY && !(self.nan?) else true end && if (x.real.is_a?(Rational) && x.imaginary.is_a?(Float)) then !x.imaginary.nan? else true end}
158
+
159
+ RDL.type :Float, :rationalize, '() -> Rational'
160
+ RDL.pre(:Float, :rationalize) { !self.infinite? && !self.nan?}
161
+
162
+ RDL.type :Float, :rationalize, '(%numeric) -> Rational'
163
+ RDL.pre(:Float, :rationalize) { |x| if x.is_a?(Float) then x!=Float::INFINITY && !x.nan? else true end}
164
+
165
+ RDL.type :Float, :round, '() -> Integer'
166
+ RDL.pre(:Float, :round) { !self.infinite? && !self.nan?}
167
+
168
+ RDL.type :Float, :round, '(%numeric) -> %numeric'
169
+ RDL.pre(:Float, :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].
170
+
171
+ RDL.type :Float, :to_f, '() -> Float'
172
+
173
+ RDL.type :Float, :to_i, '() -> Integer'
174
+ RDL.pre(:Float, :to_i) { !self.infinite? && !self.nan?}
175
+
176
+ RDL.type :Float, :to_int, '() -> Integer'
177
+ RDL.pre(:Float, :to_int) { !self.infinite? && !self.nan?}
178
+
179
+ RDL.type :Float, :to_r, '() -> Rational'
180
+ RDL.pre(:Float, :to_r) { !self.infinite? && !self.nan?}
181
+
182
+ RDL.type :Float, :truncate, '() -> Integer'
183
+
184
+ RDL.type :Float, :zero?, '() -> %bool'
185
+
186
+ RDL.type :Float, :conj, '() -> Float'
187
+ RDL.type :Float, :conjugate, '() -> Float'
188
+
189
+ RDL.type :Float, :imag, '() -> Integer r {{ r==0 }}'
190
+ RDL.type :Float, :imaginary, '() -> Integer r {{ r==0 }}'
191
+
192
+ RDL.type :Float, :real, '() -> Float'
193
+
194
+ RDL.type :Float, :real?, '() -> true'
195
+
196
+ RDL.type :Float, :to_c, '() -> Complex r {{ r.imaginary == 0 }}'
197
+
198
+ RDL.type :Float, :coerce, '(%numeric) -> [Float, Float]'
199
+ RDL.pre(:Float, :coerce) { |x| if x.is_a?(Complex) then x.imaginary==0 else true end}