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