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