rdl 2.0.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +13 -0
- data/CHANGES.md +35 -0
- data/README.md +153 -116
- data/bin/rdl_query +1 -1
- data/extras/type_tests/typetests.rb +905 -0
- data/lib/rdl.rb +0 -1
- data/lib/rdl/boot.rb +108 -77
- data/lib/rdl/boot_rails.rb +2 -8
- data/lib/rdl/config.rb +44 -17
- data/lib/rdl/contracts/flat.rb +1 -1
- data/lib/rdl/info.rb +3 -3
- data/lib/rdl/query.rb +11 -11
- data/lib/rdl/typecheck.rb +399 -136
- data/lib/rdl/types/finite_hash.rb +3 -2
- data/lib/rdl/types/generic.rb +7 -6
- data/lib/rdl/types/intersection.rb +3 -2
- data/lib/rdl/types/lexer.rex +2 -3
- data/lib/rdl/types/lexer.rex.rb +1 -4
- data/lib/rdl/types/method.rb +7 -6
- data/lib/rdl/types/nominal.rb +10 -1
- data/lib/rdl/types/parser.racc +7 -8
- data/lib/rdl/types/parser.tab.rb +108 -109
- data/lib/rdl/types/structural.rb +1 -0
- data/lib/rdl/types/tuple.rb +2 -2
- data/lib/rdl/types/type.rb +8 -8
- data/lib/rdl/types/type_inferencer.rb +1 -1
- data/lib/rdl/types/union.rb +2 -1
- data/lib/rdl/util.rb +28 -3
- data/lib/rdl/wrap.rb +216 -165
- data/lib/rdl_disable.rb +22 -15
- data/lib/types/core.rb +2 -4
- data/lib/types/core/_aliases.rb +14 -0
- data/lib/types/core/abbrev.rb +3 -0
- data/lib/types/core/array.rb +139 -0
- data/lib/types/core/base64.rb +8 -0
- data/lib/types/core/basic_object.rb +12 -0
- data/lib/types/core/benchmark.rb +9 -0
- data/lib/types/core/bigdecimal.rb +223 -0
- data/lib/types/core/bigmath.rb +10 -0
- data/lib/types/core/bignum.rb +214 -0
- data/lib/types/core/class.rb +15 -0
- data/lib/types/core/complex.rb +123 -0
- data/lib/types/core/coverage.rb +4 -0
- data/lib/types/core/csv.rb +3 -0
- data/lib/types/core/date.rb +4 -0
- data/lib/types/core/dir.rb +37 -0
- data/lib/types/core/encoding.rb +21 -0
- data/lib/types/core/enumerable.rb +96 -0
- data/lib/types/core/enumerator.rb +24 -0
- data/lib/types/core/exception.rb +15 -0
- data/lib/types/core/file.rb +125 -0
- data/lib/types/core/fileutils.rb +4 -0
- data/lib/types/core/fixnum.rb +213 -0
- data/lib/types/core/float.rb +199 -0
- data/lib/types/core/gem.rb +19 -0
- data/lib/types/core/hash.rb +72 -0
- data/lib/types/core/integer.rb +194 -0
- data/lib/types/core/io.rb +101 -0
- data/lib/types/core/kernel.rb +89 -0
- data/lib/types/core/marshal.rb +3 -0
- data/lib/types/core/matchdata.rb +24 -0
- data/lib/types/core/math.rb +50 -0
- data/lib/types/core/module.rb +81 -0
- data/lib/types/core/nil.rb +11 -0
- data/lib/types/core/numeric.rb +56 -0
- data/lib/types/core/object.rb +73 -0
- data/lib/types/core/pathname.rb +104 -0
- data/lib/types/core/proc.rb +12 -0
- data/lib/types/core/process.rb +110 -0
- data/lib/types/core/random.rb +13 -0
- data/lib/types/core/range.rb +37 -0
- data/lib/types/core/rational.rb +207 -0
- data/lib/types/core/regexp.rb +28 -0
- data/lib/types/core/set.rb +56 -0
- data/lib/types/core/string.rb +140 -0
- data/lib/types/core/strscan.rb +6 -0
- data/lib/types/core/symbol.rb +27 -0
- data/lib/types/core/time.rb +66 -0
- data/lib/types/core/uri.rb +18 -0
- data/lib/types/core/yaml.rb +3 -0
- data/lib/types/devise.rb +1 -0
- data/lib/types/devise/controller_helpers.rb +3 -0
- data/lib/types/devise/parameter_sanitizer.rb +2 -0
- data/lib/types/pundit.rb +2 -0
- data/lib/types/rails/_helpers.rb +50 -0
- data/lib/types/rails/abstract_controller/translation.rb +2 -0
- data/lib/types/rails/action_controller/base.rb +3 -0
- data/lib/types/rails/action_controller/instrumentation.rb +6 -0
- data/lib/types/rails/action_controller/metal.rb +3 -0
- data/lib/types/rails/action_controller/mime_responds.rb +13 -0
- data/lib/types/rails/action_controller/parameters.rb +3 -0
- data/lib/types/{rails-5.x → rails}/action_controller/strong_parameters.rb +4 -8
- data/lib/types/rails/action_dispatch/flashhash.rb +8 -0
- data/lib/types/rails/action_dispatch/routing.rb +10 -0
- data/lib/types/rails/action_mailer/base.rb +2 -0
- data/lib/types/rails/action_mailer/message_delivery.rb +2 -0
- data/lib/types/rails/action_view/helpers_sanitizehelper.rb +2 -0
- data/lib/types/rails/action_view/helpers_urlhelper.rb +5 -0
- data/lib/types/rails/active_model/errors.rb +14 -0
- data/lib/types/rails/active_model/validations.rb +2 -0
- data/lib/types/rails/active_record/associations.rb +208 -0
- data/lib/types/rails/active_record/base.rb +2 -0
- data/lib/types/rails/active_record/core.rb +2 -0
- data/lib/types/rails/active_record/finder_methods.rb +2 -0
- data/lib/types/rails/active_record/model_schema.rb +37 -0
- data/lib/types/rails/active_record/relation.rb +11 -0
- data/lib/types/rails/active_record/schema_types.rb +51 -0
- data/lib/types/rails/active_record/validations.rb +2 -0
- data/lib/types/rails/active_support/base.rb +2 -0
- data/lib/types/rails/active_support/logger.rb +3 -0
- data/lib/types/rails/active_support/tagged_logging.rb +2 -0
- data/lib/types/rails/active_support/time_with_zone.rb +13 -0
- data/lib/types/rails/active_support/time_zone.rb +2 -0
- data/lib/types/rails/fixnum.rb +2 -0
- data/lib/types/rails/integer.rb +2 -0
- data/lib/types/rails/rack/request.rb +2 -0
- data/lib/types/rails/string.rb +3 -0
- data/lib/types/rails/time.rb +1 -0
- data/rdl.gemspec +2 -2
- data/test/disabled_test_rdoc.rb +8 -8
- data/test/test_alias.rb +1 -0
- data/test/test_dsl.rb +4 -4
- data/test/test_generic.rb +45 -38
- data/test/test_intersection.rb +10 -10
- data/test/test_le.rb +103 -102
- data/test/test_member.rb +33 -33
- data/test/test_parser.rb +101 -96
- data/test/test_query.rb +84 -84
- data/test/test_rdl.rb +87 -52
- data/test/test_rdl_type.rb +26 -9
- data/test/test_type_contract.rb +32 -31
- data/test/test_typecheck.rb +802 -436
- data/test/test_types.rb +39 -39
- data/test/test_wrap.rb +3 -2
- metadata +91 -120
- data/extras/type_tests/%.rb +0 -171
- data/extras/type_tests/&.rb +0 -159
- data/extras/type_tests/**.rb +0 -222
- data/extras/type_tests/*.rb +0 -177
- data/extras/type_tests/+.rb +0 -170
- data/extras/type_tests/-.rb +0 -171
- data/extras/type_tests/1scomp.rb +0 -157
- data/extras/type_tests/<.rb +0 -170
- data/extras/type_tests/<<.rb +0 -159
- data/extras/type_tests/>>.rb +0 -159
- data/extras/type_tests/[].rb +0 -163
- data/extras/type_tests/^.rb +0 -159
- data/extras/type_tests/abs.rb +0 -155
- data/extras/type_tests/abs2.rb +0 -164
- data/extras/type_tests/angle.rb +0 -157
- data/extras/type_tests/arg.rb +0 -157
- data/extras/type_tests/bit_length.rb +0 -157
- data/extras/type_tests/ceil.rb +0 -157
- data/extras/type_tests/ceilRational.rb +0 -160
- data/extras/type_tests/conj.rb +0 -158
- data/extras/type_tests/defwhere.rb +0 -86
- data/extras/type_tests/denominator.rb +0 -157
- data/extras/type_tests/div.rb +0 -172
- data/extras/type_tests/divslash.rb +0 -179
- data/extras/type_tests/even?.rb +0 -157
- data/extras/type_tests/fdiv.rb +0 -244
- data/extras/type_tests/finite?.rb +0 -157
- data/extras/type_tests/floor.rb +0 -157
- data/extras/type_tests/floorRational.rb +0 -161
- data/extras/type_tests/hash.rb +0 -157
- data/extras/type_tests/imag.rb +0 -158
- data/extras/type_tests/infinite?.rb +0 -157
- data/extras/type_tests/modulo.rb +0 -171
- data/extras/type_tests/nan?.rb +0 -157
- data/extras/type_tests/neg.rb +0 -155
- data/extras/type_tests/next.rb +0 -157
- data/extras/type_tests/next_float.rb +0 -157
- data/extras/type_tests/numerator.rb +0 -157
- data/extras/type_tests/phase.rb +0 -157
- data/extras/type_tests/prev_float.rb +0 -157
- data/extras/type_tests/quo.rb +0 -179
- data/extras/type_tests/rationalize.rb +0 -157
- data/extras/type_tests/rationalizeArg.rb +0 -198
- data/extras/type_tests/real.rb +0 -157
- data/extras/type_tests/real?.rb +0 -157
- data/extras/type_tests/round.rb +0 -157
- data/extras/type_tests/roundArg.rb +0 -169
- data/extras/type_tests/size.rb +0 -157
- data/extras/type_tests/to_c.rb +0 -157
- data/extras/type_tests/to_f.rb +0 -155
- data/extras/type_tests/to_i.rb +0 -157
- data/extras/type_tests/to_r.rb +0 -157
- data/extras/type_tests/to_s.rb +0 -157
- data/extras/type_tests/truncate.rb +0 -157
- data/extras/type_tests/truncateArg.rb +0 -166
- data/extras/type_tests/type tests +0 -1
- data/extras/type_tests/zero?.rb +0 -155
- data/extras/type_tests/|.rb +0 -159
- data/lib/types/core-ruby-2.x/_aliases.rb +0 -15
- data/lib/types/core-ruby-2.x/abbrev.rb +0 -5
- data/lib/types/core-ruby-2.x/array.rb +0 -137
- data/lib/types/core-ruby-2.x/base64.rb +0 -10
- data/lib/types/core-ruby-2.x/basic_object.rb +0 -14
- data/lib/types/core-ruby-2.x/benchmark.rb +0 -11
- data/lib/types/core-ruby-2.x/bigdecimal.rb +0 -224
- data/lib/types/core-ruby-2.x/bigmath.rb +0 -12
- data/lib/types/core-ruby-2.x/bignum.rb +0 -214
- data/lib/types/core-ruby-2.x/class.rb +0 -17
- data/lib/types/core-ruby-2.x/complex.rb +0 -124
- data/lib/types/core-ruby-2.x/coverage.rb +0 -6
- data/lib/types/core-ruby-2.x/csv.rb +0 -5
- data/lib/types/core-ruby-2.x/date.rb +0 -6
- data/lib/types/core-ruby-2.x/dir.rb +0 -38
- data/lib/types/core-ruby-2.x/encoding.rb +0 -23
- data/lib/types/core-ruby-2.x/enumerable.rb +0 -98
- data/lib/types/core-ruby-2.x/enumerator.rb +0 -26
- data/lib/types/core-ruby-2.x/exception.rb +0 -17
- data/lib/types/core-ruby-2.x/file.rb +0 -126
- data/lib/types/core-ruby-2.x/fileutils.rb +0 -6
- data/lib/types/core-ruby-2.x/fixnum.rb +0 -213
- data/lib/types/core-ruby-2.x/float.rb +0 -199
- data/lib/types/core-ruby-2.x/gem.rb +0 -247
- data/lib/types/core-ruby-2.x/hash.rb +0 -72
- data/lib/types/core-ruby-2.x/integer.rb +0 -197
- data/lib/types/core-ruby-2.x/io.rb +0 -103
- data/lib/types/core-ruby-2.x/kernel.rb +0 -90
- data/lib/types/core-ruby-2.x/marshal.rb +0 -5
- data/lib/types/core-ruby-2.x/matchdata.rb +0 -26
- data/lib/types/core-ruby-2.x/math.rb +0 -53
- data/lib/types/core-ruby-2.x/module.rb +0 -83
- data/lib/types/core-ruby-2.x/nil.rb +0 -12
- data/lib/types/core-ruby-2.x/numeric.rb +0 -56
- data/lib/types/core-ruby-2.x/object.rb +0 -75
- data/lib/types/core-ruby-2.x/pathname.rb +0 -106
- data/lib/types/core-ruby-2.x/proc.rb +0 -16
- data/lib/types/core-ruby-2.x/process.rb +0 -127
- data/lib/types/core-ruby-2.x/random.rb +0 -17
- data/lib/types/core-ruby-2.x/range.rb +0 -39
- data/lib/types/core-ruby-2.x/rational.rb +0 -209
- data/lib/types/core-ruby-2.x/regexp.rb +0 -30
- data/lib/types/core-ruby-2.x/set.rb +0 -58
- data/lib/types/core-ruby-2.x/string.rb +0 -143
- data/lib/types/core-ruby-2.x/strscan.rb +0 -7
- data/lib/types/core-ruby-2.x/symbol.rb +0 -29
- data/lib/types/core-ruby-2.x/time.rb +0 -68
- data/lib/types/core-ruby-2.x/uri.rb +0 -20
- data/lib/types/core-ruby-2.x/yaml.rb +0 -5
- data/lib/types/rails-5.x/_helpers.rb +0 -52
- data/lib/types/rails-5.x/action_controller/mime_responds.rb +0 -11
- data/lib/types/rails-5.x/action_dispatch/routing.rb +0 -10
- data/lib/types/rails-5.x/active_model/errors.rb +0 -15
- data/lib/types/rails-5.x/active_model/validations.rb +0 -5
- data/lib/types/rails-5.x/active_record/associations.rb +0 -190
- data/lib/types/rails-5.x/active_record/core.rb +0 -3
- data/lib/types/rails-5.x/active_record/model_schema.rb +0 -39
- data/lib/types/rails-5.x/fixnum.rb +0 -3
data/lib/rdl_disable.rb
CHANGED
@@ -1,25 +1,13 @@
|
|
1
1
|
# Defines RDL methods that do nothing
|
2
2
|
|
3
|
-
module RDL
|
4
|
-
|
5
|
-
def RDL.config(*args); end
|
3
|
+
module RDL
|
4
|
+
end
|
6
5
|
|
7
|
-
|
6
|
+
module RDL::Annotate
|
8
7
|
def pre(*args); end
|
9
8
|
def post(*args); end
|
10
9
|
def type(*args); end
|
11
10
|
def var_type(*args); end
|
12
|
-
def rdl_alias(*args); end
|
13
|
-
def type_params(*args); end
|
14
|
-
def rdl_nowrap(*args); end
|
15
|
-
def instantaite!(*args); self; end
|
16
|
-
def deinstantaite!(*args); self; end
|
17
|
-
def type_cast(*args); self; end
|
18
|
-
def type_alias(*args); end
|
19
|
-
def rdl_do_typecheck(*args); end
|
20
|
-
def rdl_note_type(*args); end
|
21
|
-
def rdl_remove_type(*args); end
|
22
|
-
|
23
11
|
def attr_accessor_type(*args)
|
24
12
|
args.each_slice(2) { |name, typ| attr_accessor name }
|
25
13
|
nil
|
@@ -36,4 +24,23 @@ class Object
|
|
36
24
|
args.each_slice(2) { |name, typ| attr_writer name }
|
37
25
|
nil
|
38
26
|
end
|
27
|
+
|
28
|
+
def rdl_alias(*args); end
|
29
|
+
def type_params(*args); end
|
30
|
+
end
|
31
|
+
|
32
|
+
module RDL
|
33
|
+
extend RDL::Annotate
|
34
|
+
def self.type_alias(*args); end
|
35
|
+
def self.nowrap(*args); end
|
36
|
+
def self.do_typecheck(*args); end
|
37
|
+
def self.at(*args); end
|
38
|
+
def self.note_type(*args); end
|
39
|
+
def self.remove_type(*args); end
|
40
|
+
def self.instantaite!(*args); self; end
|
41
|
+
def self.deinstantaite!(*args); self; end
|
42
|
+
def self.type_cast(*args); self; end
|
43
|
+
def self.query(*args); end
|
39
44
|
end
|
45
|
+
|
46
|
+
def RDL.config(*args); end
|
data/lib/types/core.rb
CHANGED
@@ -1,4 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require_relative "core-ruby-#{dir}/_aliases.rb" # load type aliases first
|
4
|
-
Dir[File.dirname(__FILE__) + "/core-ruby-#{dir}/**/*.rb"].each { |f| require f }
|
1
|
+
require_relative "core/_aliases.rb" # load type aliases first
|
2
|
+
Dir[File.dirname(__FILE__) + "/core/**/*.rb"].each { |f| require f }
|
@@ -0,0 +1,14 @@
|
|
1
|
+
if defined? BigDecimal
|
2
|
+
RDL.type_alias '%real', 'Integer or Float or Rational or BigDecimal'
|
3
|
+
RDL.type_alias '%numeric', 'Integer or Float or Rational or BigDecimal or Complex'
|
4
|
+
else
|
5
|
+
RDL.type_alias '%real', 'Integer or Float or Rational'
|
6
|
+
RDL.type_alias '%numeric', 'Integer or Float or Rational'
|
7
|
+
end
|
8
|
+
RDL.type_alias '%string', '[to_str: () -> String]'
|
9
|
+
if defined? Pathname
|
10
|
+
RDL.type_alias '%path', '%string or Pathname'
|
11
|
+
else
|
12
|
+
RDL.type_alias '%path', '%string'
|
13
|
+
end
|
14
|
+
RDL.type_alias '%open_args', '{external_encoding: ?String, internal_encoding: ?String, encoding: ?String, textmode: ?%any, binmode: ?%any, autoclose: ?%any, mode: ?String}'
|
@@ -0,0 +1,139 @@
|
|
1
|
+
RDL.nowrap :Array
|
2
|
+
|
3
|
+
RDL.type_params :Array, [:t], :all?
|
4
|
+
|
5
|
+
RDL.type :Array, :<<, '(t) -> Array<t>'
|
6
|
+
RDL.type :Array, :[], '(Range<Integer>) -> Array<t>'
|
7
|
+
RDL.type :Array, :[], '(Integer or Float) -> t'
|
8
|
+
RDL.type :Array, :[], '(Integer, Integer) -> Array<t>'
|
9
|
+
RDL.type :Array, :&, '(Array<u>) -> Array<t>'
|
10
|
+
RDL.type :Array, :*, '(Integer) -> Array<t>'
|
11
|
+
RDL.type :Array, :*, '(String) -> String'
|
12
|
+
RDL.type :Array, :+, '(Enumerable<u>) -> Array<u or t>'
|
13
|
+
RDL.type :Array, :+, '(Array<u>) -> Array<u or t>'
|
14
|
+
RDL.type :Array, :-, '(Array<u>) -> Array<u or t>'
|
15
|
+
RDL.type :Array, :slice, '(Range<Integer>) -> Array<t>'
|
16
|
+
RDL.type :Array, :slice, '(Integer) -> t'
|
17
|
+
RDL.type :Array, :slice, '(Integer, Integer) -> Array<t>'
|
18
|
+
RDL.type :Array, :[]=, '(Integer, t) -> t'
|
19
|
+
RDL.type :Array, :[]=, '(Integer, Integer, t) -> t'
|
20
|
+
# RDL.type :Array, :[]=, '(Integer, Integer, Array<t>) -> Array<t>'
|
21
|
+
# RDL.type :Array, :[]=, '(Range, Array<t>) -> Array<t>'
|
22
|
+
RDL.type :Array, :[]=, '(Range<Integer>, t) -> t'
|
23
|
+
RDL.type :Array, :assoc, '(t) -> Array<t>'
|
24
|
+
RDL.type :Array, :at, '(Integer) -> t'
|
25
|
+
RDL.type :Array, :clear, '() -> Array<t>'
|
26
|
+
RDL.type :Array, :map, '() {(t) -> u} -> Array<u>'
|
27
|
+
RDL.type :Array, :map, '() -> Enumerator<t>'
|
28
|
+
RDL.type :Array, :map!, '() {(t) -> u} -> Array<u>'
|
29
|
+
RDL.type :Array, :map!, '() -> Enumerator<t>'
|
30
|
+
RDL.type :Array, :collect, '() { (t) -> u } -> Array<u>'
|
31
|
+
RDL.type :Array, :collect, '() -> Enumerator<t>'
|
32
|
+
RDL.type :Array, :combination, '(Integer) { (Array<t>) -> %any } -> Array<t>'
|
33
|
+
RDL.type :Array, :combination, '(Integer) -> Enumerator<t>'
|
34
|
+
RDL.type :Array, :push, '(*t) -> Array<t>'
|
35
|
+
RDL.type :Array, :compact, '() -> Array<t>'
|
36
|
+
RDL.type :Array, :compact!, '() -> Array<t>'
|
37
|
+
RDL.type :Array, :concat, '(Array<t>) -> Array<t>'
|
38
|
+
RDL.type :Array, :count, '() -> Integer'
|
39
|
+
RDL.type :Array, :count, '(t) -> Integer'
|
40
|
+
RDL.type :Array, :count, '() { (t) -> %bool } -> Integer'
|
41
|
+
RDL.type :Array, :cycle, '(?Integer) { (t) -> %any } -> %any'
|
42
|
+
RDL.type :Array, :cycle, '(?Integer) -> Enumerator<t>'
|
43
|
+
RDL.type :Array, :delete, '(u) -> t'
|
44
|
+
RDL.type :Array, :delete, '(u) { () -> v } -> t or v'
|
45
|
+
RDL.type :Array, :delete_at, '(Integer) -> Array<t>'
|
46
|
+
RDL.type :Array, :delete_if, '() { (t) -> %bool } -> Array<t>'
|
47
|
+
RDL.type :Array, :delete_if, '() -> Enumerator<t>'
|
48
|
+
RDL.type :Array, :drop, '(Integer) -> Array<t>'
|
49
|
+
RDL.type :Array, :drop_while, '() { (t) -> %bool } -> Array<t>'
|
50
|
+
RDL.type :Array, :drop_while, '() -> Enumerator<t>'
|
51
|
+
RDL.type :Array, :each, '() -> Enumerator<t>'
|
52
|
+
RDL.type :Array, :each, '() { (t) -> %any } -> Array<t>'
|
53
|
+
RDL.type :Array, :each_index, '() { (Integer) -> %any } -> Array<t>'
|
54
|
+
RDL.type :Array, :each_index, '() -> Enumerator<t>'
|
55
|
+
RDL.type :Array, :empty?, '() -> %bool'
|
56
|
+
RDL.type :Array, :fetch, '(Integer) -> t'
|
57
|
+
RDL.type :Array, :fetch, '(Integer, u) -> u'
|
58
|
+
RDL.type :Array, :fetch, '(Integer) { (Integer) -> u } -> t or u'
|
59
|
+
RDL.type :Array, :fill, '(t) -> Array<t>'
|
60
|
+
RDL.type :Array, :fill, '(t, Integer, ?Integer) -> Array<t>'
|
61
|
+
RDL.type :Array, :fill, '(t, Range<Integer>) -> Array<t>'
|
62
|
+
RDL.type :Array, :fill, '() { (Integer) -> t } -> Array<t>'
|
63
|
+
RDL.type :Array, :fill, '(Integer, ?Integer) { (Integer) -> t } -> Array<t>'
|
64
|
+
RDL.type :Array, :fill, '(Range<Integer>) { (Integer) -> t } -> Array<t>'
|
65
|
+
RDL.type :Array, :flatten, '() -> Array<%any>' # Can't give a more precise RDL.type
|
66
|
+
RDL.type :Array, :index, '(u) -> Integer'
|
67
|
+
RDL.type :Array, :index, '() { (t) -> %bool } -> Integer'
|
68
|
+
RDL.type :Array, :index, '() -> Enumerator<t>'
|
69
|
+
RDL.type :Array, :first, '() -> t'
|
70
|
+
RDL.type :Array, :first, '(Integer) -> Array<t>'
|
71
|
+
RDL.type :Array, :include?, '(u) -> %bool'
|
72
|
+
RDL.type :Array, :initialize, '() -> self'
|
73
|
+
RDL.type :Array, :initialize, '(Integer) -> self'
|
74
|
+
RDL.type :Array, :initialize, '(Integer, t) -> self<t>'
|
75
|
+
RDL.type :Array, :insert, '(Integer, *t) -> Array<t>'
|
76
|
+
RDL.type :Array, :inspect, '() -> String'
|
77
|
+
RDL.type :Array, :join, '(?String) -> String'
|
78
|
+
RDL.type :Array, :keep_if, '() { (t) -> %bool } -> Array<t>'
|
79
|
+
RDL.type :Array, :last, '() -> t'
|
80
|
+
RDL.type :Array, :last, '(Integer) -> Array<t>'
|
81
|
+
RDL.type :Array, :member, '(u) -> %bool'
|
82
|
+
RDL.type :Array, :length, '() -> Integer'
|
83
|
+
RDL.type :Array, :permutation, '(?Integer) -> Enumerator<t>'
|
84
|
+
RDL.type :Array, :permutation, '(?Integer) { (Array<t>) -> %any } -> Array<t>'
|
85
|
+
RDL.type :Array, :pop, '(Integer) -> Array<t>'
|
86
|
+
RDL.type :Array, :pop, '() -> t'
|
87
|
+
RDL.type :Array, :product, '(*Array<u>) -> Array<Array<t or u>>'
|
88
|
+
RDL.type :Array, :rassoc, '(u) -> t'
|
89
|
+
RDL.type :Array, :reject, '() { (t) -> %bool } -> Array<t>'
|
90
|
+
RDL.type :Array, :reject, '() -> Enumerator<t>'
|
91
|
+
RDL.type :Array, :reject!, '() { (t) -> %bool } -> Array<t>'
|
92
|
+
RDL.type :Array, :reject!, '() -> Enumerator<t>'
|
93
|
+
RDL.type :Array, :repeated_combination, '(Integer) { (Array<t>) -> %any } -> Array<t>'
|
94
|
+
RDL.type :Array, :repeated_combination, '(Integer) -> Enumerator<t>'
|
95
|
+
RDL.type :Array, :repeated_permutation, '(Integer) { (Array<t>) -> %any } -> Array<t>'
|
96
|
+
RDL.type :Array, :repeated_permutation, '(Integer) -> Enumerator<t>'
|
97
|
+
RDL.type :Array, :reverse, '() -> Array<t>'
|
98
|
+
RDL.type :Array, :reverse!, '() -> Array<t>'
|
99
|
+
RDL.type :Array, :reverse_each, '() { (t) -> %any } -> Array<t>'
|
100
|
+
RDL.type :Array, :reverse_each, '() -> Enumerator<t>'
|
101
|
+
RDL.type :Array, :rindex, '(u) -> t'
|
102
|
+
RDL.type :Array, :rindex, '() { (t) -> %bool } -> Integer'
|
103
|
+
RDL.type :Array, :rindex, '() -> Enumerator<t>'
|
104
|
+
RDL.type :Array, :rotate, '(?Integer) -> Array<t>'
|
105
|
+
RDL.type :Array, :rotate!, '(?Integer) -> Array<t>'
|
106
|
+
RDL.type :Array, :sample, '() -> t'
|
107
|
+
RDL.type :Array, :sample, '(Integer) -> Array<t>'
|
108
|
+
RDL.type :Array, :select, '() { (t) -> %bool } -> Array<t>'
|
109
|
+
RDL.type :Array, :select, '() -> Enumerator<t>'
|
110
|
+
RDL.type :Array, :select!, '() { (t) -> %bool } -> Array<t>'
|
111
|
+
RDL.type :Array, :select!, '() -> Enumerator<t>'
|
112
|
+
RDL.type :Array, :shift, '() -> t'
|
113
|
+
RDL.type :Array, :shift, '(Integer) -> Array<t>'
|
114
|
+
RDL.type :Array, :shuffle, '() -> Array<t>'
|
115
|
+
RDL.type :Array, :shuffle!, '() -> Array<t>'
|
116
|
+
RDL.rdl_alias :Array, :size, :length
|
117
|
+
RDL.rdl_alias :Array, :slice, :[]
|
118
|
+
RDL.type :Array, :slice!, '(Range<Integer>) -> Array<t>'
|
119
|
+
RDL.type :Array, :slice!, '(Integer, Integer) -> Array<t>'
|
120
|
+
RDL.type :Array, :slice!, '(Integer or Float) -> t'
|
121
|
+
RDL.type :Array, :sort, '() -> Array<t>'
|
122
|
+
RDL.type :Array, :sort, '() { (t,t) -> Integer } -> Array<t>'
|
123
|
+
RDL.type :Array, :sort!, '() -> Array<t>'
|
124
|
+
RDL.type :Array, :sort!, '() { (t,t) -> Integer } -> Array<t>'
|
125
|
+
RDL.type :Array, :sort_by!, '() { (t) -> u } -> Array<t>'
|
126
|
+
RDL.type :Array, :sort_by!, '() -> Enumerator<t>'
|
127
|
+
RDL.type :Array, :take, '(Integer) -> Array<t>'
|
128
|
+
RDL.type :Array, :take_while, '() { (t) ->%bool } -> Array<t>'
|
129
|
+
RDL.type :Array, :take_while, '() -> Enumerator<t>'
|
130
|
+
RDL.type :Array, :to_a, '() -> Array<t>'
|
131
|
+
RDL.type :Array, :to_ary, '() -> Array<t>'
|
132
|
+
RDL.rdl_alias :Array, :to_s, :inspect
|
133
|
+
RDL.type :Array, :transpose, '() -> Array<t>'
|
134
|
+
RDL.type :Array, :uniq, '() -> Array<t>'
|
135
|
+
RDL.type :Array, :uniq!, '() -> Array<t>'
|
136
|
+
RDL.type :Array, :unshift, '(*t) -> Array<t>'
|
137
|
+
RDL.type :Array, :values_at, '(*Range<Integer> or Integer) -> Array<t>'
|
138
|
+
RDL.type :Array, :zip, '(*Array<u>) -> Array<Array<t or u>>'
|
139
|
+
RDL.type :Array, :|, '(Array<u>) -> Array<t or u>'
|
@@ -0,0 +1,8 @@
|
|
1
|
+
RDL.nowrap :Base64
|
2
|
+
|
3
|
+
RDL.type :Base64, 'self.decode64', '(String) -> String'
|
4
|
+
RDL.type :Base64, 'self.encode64', '(String) -> String'
|
5
|
+
RDL.type :Base64, 'self.strict_decode64', '(String) -> String'
|
6
|
+
RDL.type :Base64, 'self.strict_encode64', '(String) -> String'
|
7
|
+
RDL.type :Base64, 'self.urlsafe_decode64', '(String) -> String'
|
8
|
+
RDL.type :Base64, 'self.urlsafe_encode64', '(String) -> String'
|
@@ -0,0 +1,12 @@
|
|
1
|
+
RDL.nowrap :BasicObject
|
2
|
+
|
3
|
+
RDL.type :BasicObject, :==, '(%any other) -> %bool'
|
4
|
+
RDL.type :BasicObject, :equal?, '(%any other) -> %bool'
|
5
|
+
RDL.type :BasicObject, :!, '() -> %bool'
|
6
|
+
RDL.type :BasicObject, :!=, '(%any other) -> %bool'
|
7
|
+
RDL.type :BasicObject, :instance_eval, '(String, ?String filename, ?Integer lineno) -> %any'
|
8
|
+
RDL.type :BasicObject, :instance_eval, '() { () -> %any } -> %any'
|
9
|
+
RDL.type :BasicObject, :instance_exec, '(*%any args) { (*%any) -> %any } -> %any'
|
10
|
+
RDL.type :BasicObject, :__send__, '(Symbol, *%any) -> %any obj'
|
11
|
+
RDL.rdl_alias :BasicObject, :__id__, :object_id
|
12
|
+
RDL.type :BasicObject, :object_id, '() -> Integer'
|
@@ -0,0 +1,9 @@
|
|
1
|
+
RDL.nowrap :Benchmark
|
2
|
+
|
3
|
+
RDL.type :Benchmark, 'self.benchmark', '(String, ?Integer, ?String, *String) -> Array<Benchmark::Tms>'
|
4
|
+
RDL.type :Benchmark, 'self.bm', '(?Integer, *String) { (Benchmark::Process) -> nil} -> Array<Benchmark::Tms>'
|
5
|
+
# RDL.type :Benchmark, 'self.benchmark', '(Caption: String, Label_Width: ?Integer, Format: ?String, Labels: *String) -> Benchmark::Tms'
|
6
|
+
# RDL.type :Benchmark, 'self.bm', '(Label_Width: ?Integer, Labels: *String) { (Benchmark::Process) -> nil} -> Array<Benchmark::Tms>'
|
7
|
+
RDL.type :Benchmark, 'self.bmbm', '(?Integer label_width) { (Benchmark::Process) -> nil} -> Array<Benchmark::Tms>'
|
8
|
+
RDL.type :Benchmark, 'self.measure', '(?String label) -> Benchmark::Tms'
|
9
|
+
RDL.type :Benchmark, 'self.realtime', '() {(*%any) -> %any} -> Integer'
|
@@ -0,0 +1,223 @@
|
|
1
|
+
RDL.nowrap :BigDecimal
|
2
|
+
|
3
|
+
RDL.type :BigDecimal, :%, '(%numeric) -> BigDecimal'
|
4
|
+
RDL.pre(:BigDecimal, :%) { |x| x!=0&&(if x.is_a?(Float) then x!=Float::INFINITY && !x.nan? else true end)}
|
5
|
+
|
6
|
+
RDL.type :BigDecimal, :+, '(Integer) -> BigDecimal'
|
7
|
+
RDL.type :BigDecimal, :+, '(Float x {{ !x.infinite? && !x.nan? }}) -> BigDecimal'
|
8
|
+
RDL.type :BigDecimal, :+, '(Rational) -> BigDecimal'
|
9
|
+
RDL.type :BigDecimal, :+, '(BigDecimal) -> BigDecimal'
|
10
|
+
RDL.type :BigDecimal, :+, '(Complex) -> Complex'
|
11
|
+
RDL.pre(:BigDecimal, :+) { |x| if x.real.is_a?(Float) then x.real!=Float::INFINITY && !(x.real.nan?) else true end}
|
12
|
+
|
13
|
+
RDL.type :BigDecimal, :-, '(Integer) -> BigDecimal'
|
14
|
+
RDL.type :BigDecimal, :-, '(Float x {{ !x.infinite? && !x.nan? }}) -> BigDecimal'
|
15
|
+
RDL.type :BigDecimal, :-, '(Rational) -> BigDecimal'
|
16
|
+
RDL.type :BigDecimal, :-, '(BigDecimal) -> BigDecimal'
|
17
|
+
RDL.type :BigDecimal, :-, '(Complex) -> Complex'
|
18
|
+
RDL.pre(:BigDecimal, :-) { |x| if x.real.is_a?(Float) then x.real!=Float::INFINITY && !(x.real.nan?) else true end}
|
19
|
+
|
20
|
+
RDL.type :BigDecimal, :-@, '() -> BigDecimal'
|
21
|
+
|
22
|
+
RDL.type :BigDecimal, :+@, '() -> BigDecimal'
|
23
|
+
|
24
|
+
RDL.type :BigDecimal, :*, '(Integer) -> BigDecimal'
|
25
|
+
RDL.type :BigDecimal, :*, '(Float x {{ !x.infinite? && !x.nan? }}) -> BigDecimal'
|
26
|
+
RDL.type :BigDecimal, :*, '(Rational) -> BigDecimal'
|
27
|
+
RDL.type :BigDecimal, :*, '(BigDecimal) -> BigDecimal'
|
28
|
+
RDL.type :BigDecimal, :*, '(Complex) -> Complex'
|
29
|
+
RDL.pre(:BigDecimal, :*) { |x| 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}
|
30
|
+
|
31
|
+
RDL.type :BigDecimal, :**, '(Integer) -> BigDecimal'
|
32
|
+
RDL.type :BigDecimal, :**, '(Float) -> BigDecimal'
|
33
|
+
RDL.pre(:BigDecimal, :**) { |x| x!=Float::INFINITY && !x.nan? && if(self<0) then x<=-1||x>=0 else true end}
|
34
|
+
RDL.type :BigDecimal, :**, '(Rational) -> BigDecimal'
|
35
|
+
RDL.pre(:BigDecimal, :**) { |x| if(self<0) then x<=-1||x>=0 else true end}
|
36
|
+
RDL.type :BigDecimal, :**, '(BigDecimal) -> BigDecimal'
|
37
|
+
RDL.pre(:BigDecimal, :**) { |x| x!=BigDecimal::INFINITY && if(self<0) then x<=-1||x>=0 else true end}
|
38
|
+
|
39
|
+
RDL.type :BigDecimal, :/, '(Integer x {{ x!=0 }}) -> BigDecimal'
|
40
|
+
RDL.type :BigDecimal, :/, '(Float x {{ x!=0 && !x.infinite? && !x.nan? }}) -> BigDecimal'
|
41
|
+
RDL.type :BigDecimal, :/, '(Rational x {{ x!=0 }}) -> BigDecimal'
|
42
|
+
RDL.type :BigDecimal, :/, '(BigDecimal x {{ x!=0 }}) -> BigDecimal'
|
43
|
+
RDL.type :BigDecimal, :/, '(Complex x {{ x!=0 }}) -> Complex'
|
44
|
+
RDL.pre(:BigDecimal, :/) { |x| if x.real.is_a?(Float) then x.real!=Float::INFINITY && !(x.real.nan?) else true end && if x.imaginary.is_a?(Float) then x.imaginary!=Float::INFINITY && !(x.imaginary.nan?) else true end && if (x.real.is_a?(Rational)) then !x.imaginary.nan? else true end}
|
45
|
+
|
46
|
+
RDL.type :BigDecimal, :<, '(Integer) -> %bool'
|
47
|
+
RDL.type :BigDecimal, :<, '(Float x {{ !x.nan? && !x.infinite? }}) -> %bool'
|
48
|
+
RDL.type :BigDecimal, :<, '(Rational) -> %bool'
|
49
|
+
RDL.type :BigDecimal, :<, '(BigDecimal) -> %bool'
|
50
|
+
|
51
|
+
RDL.type :BigDecimal, :<=, '(Integer) -> %bool'
|
52
|
+
RDL.type :BigDecimal, :<=, '(Float x {{ !x.nan? && !x.infinite }}) -> %bool'
|
53
|
+
RDL.type :BigDecimal, :<=, '(Rational) -> %bool'
|
54
|
+
RDL.type :BigDecimal, :<=, '(BigDecimal) -> %bool'
|
55
|
+
|
56
|
+
RDL.type :BigDecimal, :>, '(Integer) -> %bool'
|
57
|
+
RDL.type :BigDecimal, :>, '(Float x {{ !x.nan? && !x.infinite? }}) -> %bool'
|
58
|
+
RDL.type :BigDecimal, :>, '(Rational) -> %bool'
|
59
|
+
RDL.type :BigDecimal, :>, '(BigDecimal) -> %bool'
|
60
|
+
|
61
|
+
RDL.type :BigDecimal, :>=, '(Integer) -> %bool'
|
62
|
+
RDL.type :BigDecimal, :>=, '(Float x {{ !x.nan? && !x.infinite? }}) -> %bool'
|
63
|
+
RDL.type :BigDecimal, :>=, '(Rational) -> %bool'
|
64
|
+
RDL.type :BigDecimal, :>=, '(BigDecimal) -> %bool'
|
65
|
+
|
66
|
+
RDL.type :BigDecimal, :==, '(Object) -> %bool'
|
67
|
+
RDL.pre(:BigDecimal, :==) { |x| if (x.is_a?(Float)) then (!x.nan? && x!=Float::INFINITY) else true end}
|
68
|
+
|
69
|
+
RDL.type :BigDecimal, :===, '(Object) -> %bool'
|
70
|
+
RDL.pre(:BigDecimal, :===) { |x| if (x.is_a?(Float)) then (!x.nan? && x!=Float::INFINITY) else true end}
|
71
|
+
|
72
|
+
RDL.type :BigDecimal, :<=>, '(Integer) -> Object'
|
73
|
+
RDL.post(:BigDecimal, :<=>) { |r,x| r == -1 || r==0 || r==1}
|
74
|
+
RDL.type :BigDecimal, :<=>, '(Float) -> Object'
|
75
|
+
RDL.pre(:BigDecimal, :<=>) { |x| !x.nan? && x!=Float::INFINITY}
|
76
|
+
RDL.post(:BigDecimal, :<=>) { |r,x| r == -1 || r==0 || r==1}
|
77
|
+
RDL.type :BigDecimal, :<=>, '(Rational) -> Object'
|
78
|
+
RDL.post(:BigDecimal, :<=>) { |r,x| r == -1 || r==0 || r==1}
|
79
|
+
RDL.type :BigDecimal, :<=>, '(BigDecimal) -> Object'
|
80
|
+
RDL.post(:BigDecimal, :<=>) { |r,x| r == -1 || r==0 || r==1}
|
81
|
+
|
82
|
+
RDL.type :BigDecimal, :abs, '() -> BigDecimal r {{ r>=0 || (if r.nan? then self.nan? end) }}'
|
83
|
+
|
84
|
+
RDL.type :BigDecimal, :abs2, '() -> BigDecimal r {{ r>=0 || (if r.nan? then self.nan? end) }}'
|
85
|
+
|
86
|
+
RDL.type :BigDecimal, :angle, '() -> %numeric'
|
87
|
+
RDL.post(:BigDecimal, :angle) { |r,x| r == 0 || r == Math::PI}
|
88
|
+
|
89
|
+
RDL.type :BigDecimal, :arg, '() -> %numeric'
|
90
|
+
RDL.post(:BigDecimal, :arg) { |r,x| r == 0 || r == Math::PI}
|
91
|
+
|
92
|
+
RDL.type :BigDecimal, :ceil, '() -> Integer'
|
93
|
+
RDL.pre(:BigDecimal, :ceil) { !self.infinite? && !self.nan?}
|
94
|
+
|
95
|
+
RDL.type :BigDecimal, :conj, '() -> BigDecimal'
|
96
|
+
RDL.type :BigDecimal, :conjugate, '() -> BigDecimal'
|
97
|
+
|
98
|
+
RDL.type :BigDecimal, :denominator, '() -> Integer'
|
99
|
+
RDL.pre(:BigDecimal, :denominator) { !self.infinite? && !self.nan?}
|
100
|
+
RDL.post(:BigDecimal, :denominator) { |r,x| r>0}
|
101
|
+
|
102
|
+
RDL.type :BigDecimal, :div, '(Integer x {{ x!=0 && !self.infinite? && !self.nan? }}) -> Integer'
|
103
|
+
RDL.type :BigDecimal, :div, '(Float x {{ x!=0 && !self.infinite? && !self.nan? && !x.infinite? && !x.nan? }}) -> Integer'
|
104
|
+
RDL.type :BigDecimal, :div, '(Rational x {{ x!=0 && !self.infinite? && !self.nan? }}) -> Integer'
|
105
|
+
RDL.type :BigDecimal, :div, '(BigDecimal x {{ x!=0 && !self.infinite? && !self.nan? && !x.infinite? && !x.nan? }}) -> Integer'
|
106
|
+
|
107
|
+
RDL.type :BigDecimal, :divmod, '(%real) -> [%real, %real]'
|
108
|
+
RDL.pre(:BigDecimal, :divmod) { |x| x!=0 && if x.is_a?(Float) then !x.nan? && x!=Float::INFINITY else true end}
|
109
|
+
|
110
|
+
RDL.type :BigDecimal, :equal?, '(Object) -> %bool'
|
111
|
+
RDL.type :BigDecimal, :eql?, '(Object) -> %bool'
|
112
|
+
|
113
|
+
RDL.type :BigDecimal, :fdiv, '(Integer) -> Float'
|
114
|
+
RDL.type :BigDecimal, :fdiv, '(Float) -> Float'
|
115
|
+
RDL.type :BigDecimal, :fdiv, '(Rational) -> Float'
|
116
|
+
RDL.type :BigDecimal, :fdiv, '(BigDecimal) -> BigDecimal'
|
117
|
+
RDL.type :BigDecimal, :fdiv, '(Complex) -> Complex'
|
118
|
+
RDL.pre(:BigDecimal, :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) 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 :BigDecimal, :finite?, '() -> %bool'
|
121
|
+
|
122
|
+
RDL.type :BigDecimal, :floor, '() -> Integer'
|
123
|
+
RDL.pre(:BigDecimal, :floor) { !self.infinite? && !self.nan?}
|
124
|
+
|
125
|
+
RDL.type :BigDecimal, :hash, '() -> Integer'
|
126
|
+
|
127
|
+
RDL.type :BigDecimal, :imag, '() -> Integer r {{ r==0 }}'
|
128
|
+
RDL.type :BigDecimal, :imaginary, '() -> Integer r {{ r==0 }}'
|
129
|
+
|
130
|
+
RDL.type :BigDecimal, :infinite?, '() -> NilClass or Integer'
|
131
|
+
|
132
|
+
RDL.type :BigDecimal, :to_s, '() -> String'
|
133
|
+
RDL.type :BigDecimal, :inspect, '() -> String'
|
134
|
+
|
135
|
+
RDL.type :BigDecimal, :magnitude, '() -> BigDecimal r {{ r>=0 }}'
|
136
|
+
|
137
|
+
RDL.type :BigDecimal, :modulo, '(%numeric) -> BigDecimal'
|
138
|
+
RDL.pre(:BigDecimal, :modulo) { |x| x!=0&&(if x.is_a?(Float) then x!=Float::INFINITY && !x.nan? else true end)}
|
139
|
+
|
140
|
+
RDL.type :BigDecimal, :nan?, '() -> %bool'
|
141
|
+
|
142
|
+
RDL.type :BigDecimal, :numerator, '() -> Integer'
|
143
|
+
RDL.pre(:BigDecimal, :numerator) { !self.infinite? && !self.nan?}
|
144
|
+
|
145
|
+
RDL.type :BigDecimal, :phase, '() -> %numeric'
|
146
|
+
|
147
|
+
RDL.type :BigDecimal, :quo, '(Integer x {{ x!=0 }}) -> BigDecimal'
|
148
|
+
RDL.type :BigDecimal, :quo, '(Float x {{ x!=0 && !x.infinite? && !x.nan?}}) -> BigDecimal'
|
149
|
+
RDL.type :BigDecimal, :quo, '(Rational x {{ x!=0 }}) -> BigDecimal'
|
150
|
+
RDL.type :BigDecimal, :quo, '(BigDecimal x {{ x!=0 }}) -> BigDecimal'
|
151
|
+
RDL.type :BigDecimal, :quo, '(Complex) -> Complex'
|
152
|
+
RDL.pre(:BigDecimal, :quo) { |x| x!=0 && if x.real.is_a?(Float) then x.real!=Float::INFINITY && !(x.real.nan?) else true end && if x.imaginary.is_a?(Float) then x.imaginary!=Float::INFINITY && !(x.imaginary.nan?) else true end && if (x.real.is_a?(Rational)) then !x.imaginary.nan? else true end}
|
153
|
+
|
154
|
+
RDL.type :BigDecimal, :real, '() -> BigDecimal'
|
155
|
+
|
156
|
+
RDL.type :BigDecimal, :real?, '() -> true'
|
157
|
+
|
158
|
+
RDL.type :BigDecimal, :round, '() -> Integer'
|
159
|
+
RDL.pre(:BigDecimal, :round) { !self.infinite? && !self.nan?}
|
160
|
+
|
161
|
+
RDL.type :BigDecimal, :round, '(Integer) -> BigDecimal' #Also, x must be in range [-2**31, 2**31].
|
162
|
+
|
163
|
+
RDL.type :BigDecimal, :to_f, '() -> Float'
|
164
|
+
RDL.pre(:BigDecimal, :to_f) { self<=Float::MAX}
|
165
|
+
|
166
|
+
RDL.type :BigDecimal, :to_i, '() -> Integer'
|
167
|
+
RDL.pre(:BigDecimal, :to_i) { !self.infinite? && !self.nan?}
|
168
|
+
RDL.type :BigDecimal, :to_int, '() -> Integer'
|
169
|
+
RDL.pre(:BigDecimal, :to_int) { !self.infinite? && !self.nan?}
|
170
|
+
|
171
|
+
RDL.type :BigDecimal, :to_r, '() -> Rational'
|
172
|
+
RDL.pre(:BigDecimal, :to_r) { !self.infinite? && !self.nan?}
|
173
|
+
|
174
|
+
RDL.type :BigDecimal, :to_c, '() -> Complex r {{ r.imaginary == 0 }}'
|
175
|
+
RDL.post(:BigDecimal, :to_c) { |r,x| r.imaginary == 0 }
|
176
|
+
|
177
|
+
RDL.type :BigDecimal, :truncate, '() -> Integer'
|
178
|
+
|
179
|
+
RDL.type :BigDecimal, :truncate, '(Integer) -> Rational' #Also, x must be in range [-2**31, 2**31].
|
180
|
+
|
181
|
+
RDL.type :BigDecimal, :zero?, '() -> %bool'
|
182
|
+
|
183
|
+
RDL.type :BigDecimal, :precs, '() -> [Integer, Integer]'
|
184
|
+
|
185
|
+
RDL.type :BigDecimal, :split, '() -> [Integer, String, Integer, Integer]'
|
186
|
+
|
187
|
+
RDL.type :BigDecimal, :remainder, '(%real) -> BigDecimal'
|
188
|
+
RDL.pre(:BigDecimal, :remainder) { |x| if x.is_a?(Float) then !x.infinite? && !x.nan? else true end}
|
189
|
+
|
190
|
+
RDL.type :BigDecimal, :fix, '() -> BigDecimal'
|
191
|
+
|
192
|
+
RDL.type :BigDecimal, :frac, '() -> BigDecimal'
|
193
|
+
|
194
|
+
RDL.type :BigDecimal, :power, '(Integer) -> BigDecimal'
|
195
|
+
RDL.type :BigDecimal, :power, '(Float) -> BigDecimal'
|
196
|
+
RDL.pre(:BigDecimal, :power) { |x| x!=Float::INFINITY && !x.nan? && if(self<0) then x<=-1||x>=0 else true end}
|
197
|
+
RDL.type :BigDecimal, :power, '(Rational) -> BigDecimal'
|
198
|
+
RDL.pre(:BigDecimal, :power) { |x| if(self<0) then x<=-1||x>=0 else true end}
|
199
|
+
RDL.type :BigDecimal, :power, '(BigDecimal) -> BigDecimal'
|
200
|
+
RDL.pre(:BigDecimal, :power) { |x| x!=BigDecimal::INFINITY && if(self<0) then x<=-1||x>=0 else true end}
|
201
|
+
|
202
|
+
RDL.type :BigDecimal, :nonzero?, '() -> Object'
|
203
|
+
|
204
|
+
RDL.type :BigDecimal, :exponent, '() -> Integer'
|
205
|
+
|
206
|
+
RDL.type :BigDecimal, :sign, '() -> Integer'
|
207
|
+
|
208
|
+
RDL.type :BigDecimal, :_dump, '() -> String'
|
209
|
+
|
210
|
+
RDL.type :BigDecimal, :sqrt, '(Integer) -> BigDecimal'
|
211
|
+
RDL.pre(:BigDecimal, :sqrt) { self>=0}
|
212
|
+
|
213
|
+
RDL.type :BigDecimal, :add, '(%real, Integer) -> BigDecimal'
|
214
|
+
RDL.pre(:BigDecimal, :add) { |x,y| if x.is_a?(Float) then !x.infinite? && !x.nan? else true end}
|
215
|
+
|
216
|
+
RDL.type :BigDecimal, :sub, '(%real, Integer) -> BigDecimal'
|
217
|
+
RDL.pre(:BigDecimal, :sub) { |x,y| if x.is_a?(Float) then !x.infinite? && !x.nan? else true end}
|
218
|
+
|
219
|
+
RDL.type :BigDecimal, :mult, '(%real, Integer) -> BigDecimal'
|
220
|
+
RDL.pre(:BigDecimal, :mult) { |x,y| if x.is_a?(Float) then !x.infinite? && !x.nan? else true end}
|
221
|
+
|
222
|
+
RDL.type :BigDecimal, :coerce, '(%real) -> [BigDecimal, BigDecimal]'
|
223
|
+
RDL.pre(:BigDecimal, :coerce) { |x| if x.is_a?(Float) then !x.nan? && !x.finite? else true end}
|