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
@@ -1,199 +0,0 @@
1
- class Float < Numeric
2
- rdl_nowrap
3
-
4
- type :%, '(%integer x {{ x != 0 }}) -> Float'
5
- type :%, '(Float x {{ x != 0 }}) -> Float'
6
- type :%, '(Rational x {{ x != 0 }}) -> Float'
7
- type :%, '(BigDecimal x {{ x != 0 && !self.infinite? && !self.nan? }}) -> BigDecimal'
8
-
9
- type :*, '(%integer) -> Float'
10
- type :*, '(Float) -> Float'
11
- type :*, '(Rational) -> Float'
12
- type :*, '(BigDecimal x {{ !self.infinite? && !self.nan? }}) -> BigDecimal'
13
- type :*, '(Complex) -> Complex'
14
- pre(:*) { |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
15
-
16
- type :**, '(%integer) -> Float'
17
- type :**, '(Float) -> %numeric'
18
- type :**, '(Rational) -> %numeric'
19
- type :**, '(BigDecimal) -> BigDecimal'
20
- pre(:**) { |x| x!=BigDecimal::INFINITY && if self<0 then x<=-1||x>=0 else true end}
21
- post(:**) { |x| x.real?}
22
- type :**, '(Complex) -> Complex'
23
- pre(:**) { |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}
24
-
25
- type :+, '(%integer) -> Float'
26
- type :+, '(Float) -> Float'
27
- type :+, '(Rational) -> Float'
28
- type :+, '(BigDecimal x {{ !self.infinite? && !self.nan? }}) -> BigDecimal'
29
- type :+, '(Complex) -> Complex'
30
- pre(:+) { |x| if x.real.is_a?(BigDecimal) then self!=Float::INFINITY && !(self.nan?) else true end}
31
-
32
- type :-, '(%integer) -> Float'
33
- type :-, '(Float) -> Float'
34
- type :-, '(Rational) -> Float'
35
- type :-, '(BigDecimal x {{ !self.infinite? && !self.nan? }}) -> BigDecimal'
36
- type :-, '(Complex) -> Complex'
37
- pre(:-) { |x| if x.real.is_a?(BigDecimal) then self!=Float::INFINITY && !(self.nan?) else true end}
38
-
39
- type :-, '() -> Float'
40
-
41
- type :/, '(%integer x {{ x != 0 }}) -> Float'
42
- type :/, '(Float x {{ x != 0 }}) -> Float'
43
- type :/, '(Rational x {{ x != 0 }}) -> Float'
44
- type :/, '(BigDecimal x {{ x != 0 && !self.infinite? && !self.nan? }}) -> BigDecimal'
45
- type :/, '(Complex x {{ x != 0 }}) -> Complex'
46
- pre(:/) { |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}
47
-
48
- type :<, '(%integer) -> %bool'
49
- type :<, '(Float) -> %bool'
50
- type :<, '(Rational) -> %bool'
51
- type :<, '(BigDecimal x {{ !self.nan? && !self.infinite? }}) -> %bool'
52
-
53
- type :<=, '(%integer) -> %bool'
54
- type :<=, '(Float) -> %bool'
55
- type :<=, '(Rational) -> %bool'
56
- type :<=, '(BigDecimal x {{ !self.nan? && !self.infinite? }}) -> %bool'
57
-
58
- type :<=>, '(%integer) -> Object'
59
- post(:<=>) { |x| x == -1 || x==0 || x==1}
60
- type :<=>, '(Float) -> Object'
61
- post(:<=>) { |x| x == -1 || x==0 || x==1}
62
- type :<=>, '(Rational) -> Object'
63
- post(:<=>) { |x| x == -1 || x==0 || x==1}
64
- type :<=>, '(BigDecimal x {{ !self.infinite? && !self.nan? }}) -> Object'
65
- post(:<=>) { |x| x == -1 || x==0 || x==1}
66
-
67
- type :==, '(Object) -> %bool'
68
- pre(:==) { |x| if (x.is_a?(BigDecimal)) then (!self.nan? && self!=Float::INFINITY) else true end}
69
-
70
- type :===, '(Object) -> %bool'
71
- pre(:===) { |x| if (x.is_a?(BigDecimal)) then (!self.nan? && self!=Float::INFINITY) else true end}
72
-
73
- type :>, '(%integer) -> %bool'
74
- type :>, '(Float) -> %bool'
75
- type :>, '(Rational) -> %bool'
76
- type :>, '(BigDecimal x {{ !self.infinite? && !self.nan? }}) -> %bool'
77
-
78
- type :>=, '(%integer) -> %bool'
79
- type :>=, '(Float) -> %bool'
80
- type :>=, '(Rational) -> %bool'
81
- type :>=, '(BigDecimal x {{ !self.infinite? && !self.nan? }}) -> %bool'
82
-
83
- type :abs, '() -> Float r {{ r>=0 }}'
84
-
85
- type :abs2, '() -> Float r {{ r>=0 }}'
86
-
87
- type :div, '(%integer x {{ x != 0 && !self.infinite? && !self.nan? }}) -> %integer'
88
- type :div, '(Float x {{ x != 0 && !self.infinite? && !self.nan? }}) -> %integer'
89
- type :div, '(Rational x {{ x != 0 && !self.infinite? && !self.nan? }}) -> %integer'
90
- type :div, '(BigDecimal x {{ x != 0 && !x.nan? && !self.infinite? && !self.nan? }}) -> %integer'
91
-
92
- type :divmod, '(%real) -> [%real, %real]'
93
- pre(:divmod) { |x| x != 0 && if x.is_a?(Float) then !x.nan? else true end && self!=Float::INFINITY && !self.nan?}
94
-
95
- type :angle, '() -> %numeric'
96
- post(:angle) { |r,x| r == 0 || r == Math::PI || r == Float::NAN}
97
-
98
- type :arg, '() -> %numeric'
99
- post(:arg) { |r,x| r == 0 || r == Math::PI || r == Float::NAN}
100
-
101
- type :ceil, '() -> %integer'
102
- pre(:ceil) { !self.infinite? && !self.nan?}
103
-
104
- type :coerce, '(%real) -> [Float, Float]'
105
-
106
- type :denominator, '() -> %integer r {{ r>0 }}'
107
-
108
- type :equal?, '(Object) -> %bool'
109
-
110
- type :eql?, '(Object) -> %bool'
111
-
112
- type :fdiv, '(%integer) -> Float'
113
- type :fdiv, '(Float) -> Float'
114
- type :fdiv, '(Rational) -> Float'
115
- type :fdiv, '(BigDecimal x {{ !self.infinite? && !self.nan? }}) -> BigDecimal'
116
- type :fdiv, '(Complex) -> Complex'
117
- pre(: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}
118
-
119
- type :finite?, '() -> %bool'
120
-
121
- type :floor, '() -> %integer'
122
- pre(:ceil) { !self.infinite? && !self.nan?}
123
-
124
- type :hash, '() -> %integer'
125
-
126
- type :infinite?, '() -> Object'
127
- post(:infinite?) { |r,x| r == -1 || r == 1 || r == nil }
128
-
129
- type :to_s, '() -> String'
130
- type :inspect, '() -> String'
131
-
132
- type :magnitude, '() -> Float'
133
- post(:magnitude) { |r,x| r>=0 }
134
-
135
- type :modulo, '(%integer x {{ x != 0 }}) -> Float'
136
- type :modulo, '(Float x {{ x != 0 }}) -> Float'
137
- type :modulo, '(Rational x {{ x != 0 }}) -> Float'
138
- type :modulo, '(BigDecimal x {{ x != 0 && !self.infinite? && !self.nan? }}) -> BigDecimal'
139
-
140
- type :nan?, '() -> %bool'
141
-
142
- type :next_float, '() -> Float'
143
-
144
- type :numerator, '() -> %integer'
145
-
146
- type :phase, '() -> %numeric'
147
- post(:phase) { |r,x| r == 0 || r == Math::PI || r == Float::NAN}
148
-
149
- type :prev_float, '() -> Float'
150
-
151
- type :quo, '(%integer x {{ x != 0 }}) -> Float'
152
- type :quo, '(Float x {{ x != 0 }}) -> Float'
153
- type :quo, '(Rational x {{ x != 0 }}) -> Float'
154
- type :quo, '(BigDecimal x {{ x != 0 && !self.infinite? && !self.nan? }}) -> BigDecimal'
155
- type :quo, '(Complex x {{ x != 0 }}) -> Complex'
156
- pre(: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}
157
-
158
- type :rationalize, '() -> Rational'
159
- pre(:rationalize) { !self.infinite? && !self.nan?}
160
-
161
- type :rationalize, '(%numeric) -> Rational'
162
- pre(:rationalize) { |x| if x.is_a?(Float) then x!=Float::INFINITY && !x.nan? else true end}
163
-
164
- type :round, '() -> %integer'
165
- pre(:round) { !self.infinite? && !self.nan?}
166
-
167
- type :round, '(%numeric) -> %numeric'
168
- pre(: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].
169
-
170
- type :to_f, '() -> Float'
171
-
172
- type :to_i, '() -> %integer'
173
- pre(:to_i) { !self.infinite? && !self.nan?}
174
-
175
- type :to_int, '() -> %integer'
176
- pre(:to_int) { !self.infinite? && !self.nan?}
177
-
178
- type :to_r, '() -> Rational'
179
- pre(:to_r) { !self.infinite? && !self.nan?}
180
-
181
- type :truncate, '() -> %integer'
182
-
183
- type :zero?, '() -> %bool'
184
-
185
- type :conj, '() -> Float'
186
- type :conjugate, '() -> Float'
187
-
188
- type :imag, '() -> Fixnum r {{ r==0 }}'
189
- type :imaginary, '() -> Fixnum r {{ r==0 }}'
190
-
191
- type :real, '() -> Float'
192
-
193
- type :real?, '() -> true'
194
-
195
- type :to_c, '() -> Complex r {{ r.imaginary == 0 }}'
196
-
197
- type :coerce, '(%numeric) -> [Float, Float]'
198
- pre(:coerce) { |x| if x.is_a?(Complex) then x.imaginary==0 else true end}
199
- end
@@ -1,247 +0,0 @@
1
- module Gem
2
- rdl_nowrap
3
-
4
- type 'self.bin_path', '(String name, ?String exec_name, *Gem::Requirement requirements) -> String'
5
- type 'self.binary_mode', '() -> String'
6
- type 'self.bindir', '(?String install_dir) -> String'
7
- type 'self.clear_default_specs', '() -> Hash'
8
- type 'self.clear_paths', '() -> nil'
9
- type 'self.config_file', '() -> String'
10
- type 'self.configuration', '() -> Gem::ConfigFile'
11
- type 'self.configuration=', '(%any) -> %any' #returns param
12
- type 'self.datadir', '(String gem_name) -> String or nil'
13
- type 'self.default_bindir', '() -> String or nil'
14
- type 'self.default_cert_path', '() -> String or nil'
15
- type 'self.default_dir', '() -> String or nil'
16
- type 'self.default_exec_format', '() -> String or nil'
17
- type 'self.default_key_path', '() -> String or nil'
18
- type 'self.default_path', '() -> String or nil'
19
- type 'self.default_rubygems_dirs', '() -> Array<String> or nil'
20
- type 'self.default_sources', '() -> Array<String> or nil'
21
- #type 'self.deflate', '() -> String' # Anything with to_s
22
- =begin
23
- type 'self.detect_gemdeps', '() -> '
24
- type 'self.dir', '() -> '
25
- type 'self.done_installing', '() -> '
26
- type 'self.ensure_gem_subdirectories', '() -> '
27
- type 'self.find_files', '() -> '
28
- type 'self.find_unresolved_default_spec', '() -> '
29
- type 'self.finish_resolve', '() -> '
30
- type 'self.gunzip', '() -> '
31
- type 'self.gzip', '() -> '
32
- type 'self.host', '() -> '
33
- type 'self.host=', '() -> '
34
- type 'self.inflate', '() -> '
35
- type 'self.install', '() -> '
36
- type 'self.latest_rubygems_version', '() -> '
37
- type 'self.latest_spec_for', '() -> '
38
- type 'self.latest_version_for', '() -> '
39
- type 'self.load_env_plugins', '() -> '
40
- type 'self.load_path_insert_index', '() -> '
41
- type 'self.load_plugin_files', '() -> '
42
- type 'self.load_plugins', '() -> '
43
- type 'self.load_yaml', '() -> '
44
- type 'self.location_of_caller', '() -> '
45
- type 'self.marshal_version', '() -> '
46
- type 'self.needs', '() -> '
47
- type 'self.path', '() -> '
48
- type 'self.path_separator', '() -> '
49
- type 'self.paths', '() -> '
50
- type 'self.paths=', '() -> '
51
- type 'self.platforms', '() -> '
52
- type 'self.platforms=', '() -> '
53
- type 'self.post_build', '() -> '
54
- type 'self.post_install', '() -> '
55
- type 'self.post_reset', '() -> '
56
- type 'self.post_uninstall', '() -> '
57
- type 'self.pre_install', '() -> '
58
- type 'self.pre_reset', '() -> '
59
- type 'self.pre_uninstall', '() -> '
60
- type 'self.prefix', '() -> '
61
- type 'self.read_binary', '() -> '
62
- type 'self.refresh', '() -> '
63
- type 'self.register_default_spec', '() -> '
64
- type 'self.remove_unresolved_default_spec', '() -> '
65
- type 'self.ruby', '() -> '
66
- type 'self.ruby=', '() -> '
67
- type 'self.ruby_engine', '() -> '
68
- type 'self.ruby_version', '() -> '
69
- type 'self.rubygems_version', '() -> '
70
- type 'self.searcher=', '() -> '
71
- type 'self.sources', '() -> '
72
- type 'self.sources=', '() -> '
73
- type 'self.suffix_pattern', '() -> '
74
- type 'self.suffixes', '() -> '
75
- type 'self.time', '() -> '
76
- type 'self.try_activate', '() -> '
77
- type 'self.ui', '() -> '
78
- type 'self.use_paths', '() -> '
79
- type 'self.user_dir', '() -> '
80
- type 'self.user_home', '() -> '
81
- type 'self.win_platform=', '() -> '
82
- type 'self.win_platform?', '() -> '
83
- =begin
84
- class Gemspec
85
- type '<=>', '() -> '
86
- type '==', '() -> '
87
- type '_dump', '() -> '
88
- type 'activate', '() -> '
89
- type 'activate_dependencies', '() -> '
90
- type 'activated', '() -> '
91
- type 'activated=', '() -> '
92
- type 'activated?', '() -> '
93
- type 'add_bindir', '() -> '
94
- type 'add_dependency', '() -> '
95
- type 'add_dependency_with_type', '() -> '
96
- type 'add_development_dependency', '() -> '
97
- type 'add_runtime_dependency', '() -> '
98
- type 'add_self_to_load_path', '() -> '
99
- type 'author', '() -> '
100
- type 'author=', '() -> '
101
- type 'authors', '() -> '
102
- type 'authors=', '() -> '
103
- type 'autorequire', '() -> '
104
- type 'autorequire=', '() -> '
105
- type 'bin_dir', '() -> '
106
- type 'bin_file', '() -> '
107
- type 'bindir', '() -> '
108
- type 'bindir=', '() -> '
109
- type 'build_args', '() -> '
110
- type 'build_extensions', '() -> '
111
- type 'build_info_dir', '() -> '
112
- type 'build_info_file', '() -> '
113
- type 'bundled_gem_in_old_ruby?', '() -> '
114
- type 'cache_dir', '() -> '
115
- type 'cache_file', '() -> '
116
- type 'cert_chain', '() -> '
117
- type 'cert_chain=', '() -> '
118
- type 'check_version_conflict', '() -> '
119
- type 'conflicts', '() -> '
120
- type 'date', '() -> '
121
- type 'date=', '() -> '
122
- type 'default_executable', '() -> '
123
- type 'default_executable=', '() -> '
124
- type 'default_value', '() -> '
125
- type 'dependencies', '() -> '
126
- type 'dependent_gems', '() -> '
127
- type 'dependent_specs', '() -> '
128
- type 'description', '() -> '
129
- type 'description=', '() -> '
130
- type 'development_dependencies', '() -> '
131
- type 'doc_dir', '() -> '
132
- type 'email', '() -> '
133
- type 'email=', '() -> '
134
- type 'encode_with', '() -> '
135
- type 'eql?', '() -> '
136
- type 'executable', '() -> '
137
- type 'executable=', '() -> '
138
- type 'executables', '() -> '
139
- type 'executables=', '() -> '
140
- type 'extensions', '() -> '
141
- type 'extensions=', '() -> '
142
- type 'extra_rdoc_files', '() -> '
143
- type 'extra_rdoc_files=', '() -> '
144
- type 'file_name', '() -> '
145
- type 'files', '() -> '
146
- type 'files=', '() -> '
147
- type 'find_all_satisfiers', '() -> '
148
- type 'find_full_gem_path', '() -> '
149
- type 'for_cache', '() -> '
150
- type 'full_name', '() -> '
151
- type 'gem_build_complete_path', '() -> '
152
- type 'gem_dir', '() -> '
153
- type 'has_rdoc', '() -> '
154
- type 'has_rdoc=', '() -> '
155
- type 'has_rdoc?', '() -> '
156
- type 'has_test_suite?', '() -> '
157
- type 'has_unit_tests?', '() -> '
158
- type 'hash', '() -> '
159
- type 'homepage', '() -> '
160
- type 'homepage=', '() -> '
161
- type 'init_with', '() -> '
162
- type 'initialize', '() -> '
163
- type 'initialize_copy', '() -> '
164
- type 'inspect', '() -> '
165
- type 'installed_by_version', '() -> '
166
- type 'installed_by_version=', '() -> '
167
- type 'invalidate_memoized_attributes', '() -> '
168
- type 'lib_dirs_glob', '() -> '
169
- type 'lib_files', '() -> '
170
- type 'license', '() -> '
171
- type 'license=', '() -> '
172
- type 'licenses', '() -> '
173
- type 'licenses=', '() -> '
174
- type 'loaded_from=', '() -> '
175
- type 'mark_version', '() -> '
176
- type 'matches_for_glob', '() -> '
177
- type 'metadata', '() -> '
178
- type 'metadata=', '() -> '
179
- type 'method_missing', '() -> '
180
- type 'missing_extensions?', '() -> '
181
- type 'name', '() -> '
182
- type 'name=', '() -> '
183
- type 'name_tuple', '() -> '
184
- type 'normalize', '() -> '
185
- type 'original_name', '() -> '
186
- type 'original_platform', '() -> '
187
- type 'original_platform=', '() -> '
188
- type 'platform', '() -> '
189
- type 'platform=', '() -> '
190
- type 'post_install_message', '() -> '
191
- type 'post_install_message=', '() -> '
192
- type 'pretty_print', '() -> '
193
- type 'raise_if_conflicts', '() -> '
194
- type 'rdoc_options', '() -> '
195
- type 'rdoc_options=', '() -> '
196
- type 'require_path', '() -> '
197
- type 'require_path=', '() -> '
198
- type 'require_paths=', '() -> '
199
- type 'required_ruby_version', '() -> '
200
- type 'required_ruby_version=', '() -> '
201
- type 'required_rubygems_version', '() -> '
202
- type 'required_rubygems_version=', '() -> '
203
- type 'requirements', '() -> '
204
- type 'requirements=', '() -> '
205
- type 'reset_nil_attributes_to_default', '() -> '
206
- type 'respond_to_missing?', '() -> '
207
- type 'ri_dir', '() -> '
208
- type 'ruby_code', '() -> '
209
- type 'rubyforge_project', '() -> '
210
- type 'rubyforge_project=', '() -> '
211
- type 'rubygems_version', '() -> '
212
- type 'rubygems_version=', '() -> '
213
- type 'runtime_dependencies', '() -> '
214
- type 'same_attributes?', '() -> '
215
- type 'satisfies_requirement?', '() -> '
216
- type 'signing_key', '() -> '
217
- type 'signing_key=', '() -> '
218
- type 'sort_obj', '() -> '
219
- type 'source', '() -> '
220
- type 'spec_dir', '() -> '
221
- type 'spec_file', '() -> '
222
- type 'spec_name', '() -> '
223
- type 'specification_version', '() -> '
224
- type 'specification_version=', '() -> '
225
- type 'stubbed?', '() -> '
226
- type 'summary', '() -> '
227
- type 'summary=', '() -> '
228
- type 'test_file', '() -> '
229
- type 'test_file=', '() -> '
230
- type 'test_files', '() -> '
231
- type 'test_files=', '() -> '
232
- type 'to_ruby', '() -> '
233
- type 'to_ruby_for_cache', '() -> '
234
- type 'to_s', '() -> '
235
- type 'to_spec', '() -> '
236
- type 'to_yaml', '() -> '
237
- type 'traverse', '() -> '
238
- type 'validate', '() -> '
239
- type 'validate_dependencies', '() -> '
240
- type 'validate_permissions', '() -> '
241
- type 'version', '() -> '
242
- type 'version=', '() -> '
243
- type 'warning', '() -> '
244
- type 'yaml_initialize', '() -> '
245
- end
246
- =end
247
- end
@@ -1,72 +0,0 @@
1
- class Hash
2
- rdl_nowrap
3
-
4
- type_params [:k, :v], :all?
5
-
6
- type 'self.[]', '(Array<Array<u>>) -> Hash<u, u>'
7
-
8
- type :[], '(k) -> v'
9
- type :[]=, '(k, v) -> v'
10
- type :store, '(k,v) -> v'
11
-
12
- # type :assoc, '(k) -> [k, v]' # TODO
13
- type :assoc, '(k) -> Array<k or v>'
14
- type :clear, '() -> Hash<k,v>'
15
- type :compare_by_identity, '() -> Hash<k,v>'
16
- type :compare_by_identity?, '() -> %bool'
17
- type :default, '(?k) -> v'
18
- type :default, '(k) {(k) -> v} -> v'
19
- type :default=, '(v) -> v'
20
-
21
- # TODO: check on default_proc
22
- #type :default_proc, '() -> (Hash<k,v>,k) -> v'
23
- #type :default_proc=, '((Hash<k,v>,k) -> v) -> (Hash<k,v>,k) -> v'
24
-
25
- type :delete, '(k) -> v'
26
- type :delete, '(k) { (k) -> u } -> u or v'
27
- type :delete_if, '() { (k,v) -> %bool } -> Hash<k,v>'
28
- type :delete_if, '() -> Enumerator<[k, v]>'
29
- type :each, '() { (k,v) -> %any } -> Hash<k,v>'
30
- type :each, '() -> Enumerator<[k, v]>'
31
- type :each_pair, '() { (k,v) -> %any } -> Hash<k,v>'
32
- type :each_pair, '() -> Enumerator<[k, v]>'
33
- type :each_key, '() { (k) -> %any } -> Hash<k,v>'
34
- type :each_key, '() -> Enumerator<[k, v]>'
35
- type :each_value, '() { (v) -> %any } -> Hash<k,v>'
36
- type :each_value, '() -> Enumerator<[k, v]>'
37
- type :empty?, '() -> %bool'
38
- type :fetch, '(k) -> v'
39
- type :fetch, '(k,u) -> u or v'
40
- type :fetch, '(k) { (k) -> u } -> u or v'
41
- type :member?, '(t) -> %bool'
42
- type :has_key?, '(t) -> %bool'
43
- type :key?, '(t) -> %bool'
44
- type :has_value?, '(t) -> %bool'
45
- type :value?, '(t) -> %bool'
46
- type :to_s, '() -> String'
47
- type :inspect, '() -> String'
48
- type :invert, '() -> Hash<v,k>'
49
- type :keep_if, '() { (k,v) -> %bool } -> Hash<k,v>'
50
- type :keep_if, '() -> Enumerator<[k, v]>'
51
- type :key, '(t) -> k'
52
- type :keys, '() -> Array<k>'
53
- type :length, '() -> Fixnum'
54
- type :size, '() -> Fixnum'
55
- type :merge, '(Hash<a,b>) -> Hash<a or k, b or v>'
56
- type :merge, '(Hash<a,b>) { (k,v,b) -> v or b } -> Hash<a or k, b or v>'
57
- # type :rassoc, '(k) -> Tuple<k,v>'
58
- type :rassoc, '(k) -> Array<k or v>'
59
- type :rehash, '() -> Hash<k,v>'
60
- type :reject, '() -> Enumerator<[k, v]>'
61
- type :reject, '() {(k,v) -> %bool} -> Hash<k,v>'
62
- type :reject!, '() {(k,v) -> %bool} -> Hash<k,v>'
63
- type :select, '() {(k,v) -> %bool} -> Hash<k,v>'
64
- type :select!, '() {(k,v) -> %bool} -> Hash<k,v>'
65
- # type :shift, '() -> Tuple<k,v>'
66
- type :shift, '() -> Array<k or v>'
67
- # type :to_a, '() -> Array<Tuple<k,v>>'
68
- type :to_a, '() -> Array<Array<k or v>>'
69
- type :to_hash, '() -> Hash<k,v>'
70
- type :values, '() -> Array<v>'
71
- type :values_at, '(*k) -> Array<v>'
72
- end