rdl 1.1.1 → 2.0.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES.md +6 -0
- data/README.md +211 -32
- data/gemfiles/Gemfile.travis +1 -1
- data/lib/rdl.rb +85 -18
- data/lib/rdl/info.rb +74 -0
- data/lib/rdl/query.rb +8 -9
- data/lib/rdl/typecheck.rb +1057 -0
- data/lib/rdl/types/annotated_arg.rb +5 -5
- data/lib/rdl/types/{nil.rb → bot.rb} +9 -13
- data/lib/rdl/types/dependent_arg.rb +5 -5
- data/lib/rdl/types/dots_query.rb +2 -0
- data/lib/rdl/types/finitehash.rb +67 -24
- data/lib/rdl/types/generic.rb +13 -21
- data/lib/rdl/types/intersection.rb +9 -8
- data/lib/rdl/types/method.rb +30 -32
- data/lib/rdl/types/nominal.rb +22 -16
- data/lib/rdl/types/optional.rb +8 -22
- data/lib/rdl/types/parser.racc +8 -3
- data/lib/rdl/types/parser.tab.rb +131 -118
- data/lib/rdl/types/singleton.rb +15 -10
- data/lib/rdl/types/structural.rb +6 -6
- data/lib/rdl/types/top.rb +6 -6
- data/lib/rdl/types/tuple.rb +56 -24
- data/lib/rdl/types/type.rb +9 -0
- data/lib/rdl/types/type_inferencer.rb +1 -1
- data/lib/rdl/types/union.rb +52 -26
- data/lib/rdl/types/var.rb +7 -6
- data/lib/rdl/types/vararg.rb +5 -6
- data/lib/rdl/types/wild_query.rb +9 -2
- data/lib/rdl/util.rb +9 -7
- data/lib/rdl/wrap.rb +90 -72
- data/lib/rdl_types.rb +2 -2
- data/rdl.gemspec +6 -8
- data/test/test_alias.rb +4 -3
- data/test/test_contract.rb +5 -4
- data/test/test_dsl.rb +2 -1
- data/test/test_generic.rb +30 -26
- data/test/test_intersection.rb +3 -3
- data/test/test_le.rb +129 -61
- data/test/test_lib_types.rb +3 -2
- data/test/test_member.rb +33 -46
- data/test/test_parser.rb +113 -116
- data/test/test_query.rb +2 -1
- data/test/test_rdl.rb +64 -6
- data/test/test_rdl_type.rb +3 -2
- data/test/test_type_contract.rb +30 -12
- data/test/test_typecheck.rb +893 -0
- data/test/test_types.rb +50 -54
- data/test/test_wrap.rb +2 -1
- data/types/ruby-2.x/_aliases.rb +13 -2
- data/types/ruby-2.x/bigdecimal.rb +60 -85
- data/types/ruby-2.x/bignum.rb +80 -119
- data/types/ruby-2.x/complex.rb +33 -40
- data/types/ruby-2.x/fixnum.rb +81 -120
- data/types/ruby-2.x/float.rb +79 -116
- data/types/ruby-2.x/integer.rb +187 -22
- data/types/ruby-2.x/nil.rb +12 -0
- data/types/ruby-2.x/numeric.rb +38 -38
- data/types/ruby-2.x/object.rb +3 -3
- data/types/ruby-2.x/random.rb +2 -0
- data/types/ruby-2.x/range.rb +20 -19
- data/types/ruby-2.x/rational.rb +40 -40
- data/types/ruby-2.x/regexp.rb +4 -4
- data/types/ruby-2.x/string.rb +15 -17
- metadata +17 -16
- data/lib/rdl/types/.#lexer.rex +0 -1
data/types/ruby-2.x/regexp.rb
CHANGED
@@ -2,8 +2,8 @@ class Regexp
|
|
2
2
|
rdl_nowrap
|
3
3
|
|
4
4
|
type 'self.escape', '(String or Symbol) -> String'
|
5
|
-
type 'self.last_match', '() -> MatchData' # Can't wrap or
|
6
|
-
type 'self.last_match', '(Fixnum) -> String'
|
5
|
+
type 'self.last_match', '() -> MatchData', wrap: false # Can't wrap or messes up MatchData
|
6
|
+
type 'self.last_match', '(Fixnum) -> String', wrap: false
|
7
7
|
type 'self.new', '(String, ?%any options, ?String kcode) -> Regexp'
|
8
8
|
type 'self.new', '(Regexp) -> Regexp'
|
9
9
|
rdl_alias 'self.compile', 'self.new'
|
@@ -12,8 +12,8 @@ class Regexp
|
|
12
12
|
type 'self.union', '(*(Regexp or String) pats) -> Regexp'
|
13
13
|
type 'self.union', '(Array<Regexp or String> pats) -> Regexp'
|
14
14
|
type :==, '(%any other) -> %bool'
|
15
|
-
|
16
|
-
|
15
|
+
type :===, '(%any other) -> %bool', wrap: false # Can't wrap this of it messes with $1, $2, etc as well!
|
16
|
+
type :=~, '(String str) -> Fixnum or nil', wrap: false # Can't wrap this or it will mess with $1, $2, etc
|
17
17
|
type :casefold?, '() -> %bool'
|
18
18
|
type :encoding, '() -> Encoding'
|
19
19
|
rdl_alias :eql?, :==
|
data/types/ruby-2.x/string.rb
CHANGED
@@ -10,7 +10,7 @@ class String
|
|
10
10
|
type :<=>, '(String other) -> Fixnum or nil ret'
|
11
11
|
type :==, '(%any) -> %bool'
|
12
12
|
type :===, '(%any) -> %bool'
|
13
|
-
|
13
|
+
type :=~, '(Object) -> Fixnum or nil', wrap: false # Wrapping this messes up $1 etc
|
14
14
|
type :[], '(Fixnum, ?Fixnum) -> String or nil'
|
15
15
|
type :[], '(Range<Fixnum> or Regexp) -> String or nil'
|
16
16
|
type :[], '(Regexp, Fixnum) -> String or nil'
|
@@ -59,15 +59,14 @@ class String
|
|
59
59
|
type :eql?, '(String) -> %bool'
|
60
60
|
type :force_encoding, '(String or Encoding) -> String'
|
61
61
|
type :getbyte, '(Fixnum) -> Fixnum or nil'
|
62
|
-
# Can't wrap these, since they mess with $1 etc
|
63
|
-
type :gsub, '(Regexp or String,
|
64
|
-
type :gsub, '(Regexp or String
|
65
|
-
type :gsub, '(Regexp or String)
|
66
|
-
type :gsub, '(Regexp or String) ->
|
67
|
-
type :gsub
|
68
|
-
type :gsub!, '(Regexp or String
|
69
|
-
type :gsub!, '(Regexp or String)
|
70
|
-
type :gsub!, '(Regexp or String) -> Enumerator'
|
62
|
+
type :gsub, '(Regexp or String, String) -> String', wrap: false # Can't wrap these, since they mess with $1 etc
|
63
|
+
type :gsub, '(Regexp or String, Hash) -> String', wrap: false
|
64
|
+
type :gsub, '(Regexp or String) {(String) -> %any } -> String', wrap: false
|
65
|
+
type :gsub, '(Regexp or String) -> Enumerator', wrap: false
|
66
|
+
type :gsub, '(Regexp or String) -> String', wrap: false
|
67
|
+
type :gsub!, '(Regexp or String, String) -> String or nil', wrap: false
|
68
|
+
type :gsub!, '(Regexp or String) {(String) -> %any } -> String or nil', wrap: false
|
69
|
+
type :gsub!, '(Regexp or String) -> Enumerator', wrap: false
|
71
70
|
type :hash, '() -> Fixnum'
|
72
71
|
type :hex, '() -> Fixnum'
|
73
72
|
type :include?, '(String) -> %bool'
|
@@ -95,8 +94,8 @@ class String
|
|
95
94
|
type :rpartition, '(String or Regexp) -> Array<String>'
|
96
95
|
type :rstrip, '() -> String'
|
97
96
|
type :rstrip!, '() -> String'
|
98
|
-
|
99
|
-
|
97
|
+
type :scan, '(Regexp or String) -> Array<String or Array<String>>', wrap: false # Can't wrap or screws up last_match
|
98
|
+
type :scan, '(Regexp or String) {(*%any) -> %any} -> Array<String or Array<String>>', wrap: false
|
100
99
|
type :scrub, '(?String) -> String'
|
101
100
|
type :scrub, '(?String) {(%any) -> %any} -> String'
|
102
101
|
type :scrub!, '(?String) -> String'
|
@@ -116,11 +115,10 @@ class String
|
|
116
115
|
type :start_with?, '(* String) -> %bool'
|
117
116
|
type :strip, '() -> String'
|
118
117
|
type :strip!, '() -> String'
|
119
|
-
# Can't wrap these, since they mess with $1 etc
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
type :sub!, '(Regexp or String) {(String) -> %any} -> String'
|
118
|
+
type :sub, '(Regexp or String, String or Hash) -> String', wrap: false # Can't wrap these, since they mess with $1 etc
|
119
|
+
type :sub, '(Regexp or String) {(String) -> %any} -> String', wrap: false
|
120
|
+
type :sub!, '(Regexp or String, String) -> String', wrap: false # TODO: Does this really not allow Hash?
|
121
|
+
type :sub!, '(Regexp or String) {(String) -> %any} -> String', wrap: false
|
124
122
|
type :succ, '() -> String'
|
125
123
|
type :sum, '(?Fixnum) -> Fixnum'
|
126
124
|
type :swapcase, '() -> String'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeffrey S. Foster
|
@@ -12,34 +12,32 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2016-
|
15
|
+
date: 2016-07-17 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
|
-
name:
|
18
|
+
name: parser
|
19
19
|
requirement: !ruby/object:Gem::Requirement
|
20
20
|
requirements:
|
21
21
|
- - "~>"
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: '
|
23
|
+
version: '2.3'
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 2.3.1.2
|
27
27
|
type: :runtime
|
28
28
|
prerelease: false
|
29
29
|
version_requirements: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.3'
|
34
34
|
- - ">="
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version:
|
36
|
+
version: 2.3.1.2
|
37
37
|
description: |
|
38
|
-
RDL is a gem that
|
39
|
-
|
40
|
-
|
41
|
-
RDL also includes extensive support for type contracts, which check the types of arguments and returns
|
42
|
-
when the method is called and when it returns, respectively.
|
38
|
+
RDL is a gem that adds types and contracts to Ruby. RDL includes extensive
|
39
|
+
support for specifying method types, which can either be enforced as
|
40
|
+
contracts or statically checked.
|
43
41
|
email:
|
44
42
|
- rdl-users@googlegroups.com
|
45
43
|
executables:
|
@@ -121,10 +119,12 @@ files:
|
|
121
119
|
- lib/rdl/contracts/flat.rb
|
122
120
|
- lib/rdl/contracts/or.rb
|
123
121
|
- lib/rdl/contracts/proc.rb
|
122
|
+
- lib/rdl/info.rb
|
124
123
|
- lib/rdl/query.rb
|
125
124
|
- lib/rdl/switch.rb
|
126
|
-
- lib/rdl/
|
125
|
+
- lib/rdl/typecheck.rb
|
127
126
|
- lib/rdl/types/annotated_arg.rb
|
127
|
+
- lib/rdl/types/bot.rb
|
128
128
|
- lib/rdl/types/dependent_arg.rb
|
129
129
|
- lib/rdl/types/dots_query.rb
|
130
130
|
- lib/rdl/types/finitehash.rb
|
@@ -133,7 +133,6 @@ files:
|
|
133
133
|
- lib/rdl/types/lexer.rex
|
134
134
|
- lib/rdl/types/lexer.rex.rb
|
135
135
|
- lib/rdl/types/method.rb
|
136
|
-
- lib/rdl/types/nil.rb
|
137
136
|
- lib/rdl/types/nominal.rb
|
138
137
|
- lib/rdl/types/optional.rb
|
139
138
|
- lib/rdl/types/parser.racc
|
@@ -168,6 +167,7 @@ files:
|
|
168
167
|
- test/test_rdl.rb
|
169
168
|
- test/test_rdl_type.rb
|
170
169
|
- test/test_type_contract.rb
|
170
|
+
- test/test_typecheck.rb
|
171
171
|
- test/test_types.rb
|
172
172
|
- test/test_wrap.rb
|
173
173
|
- types/rails-4.2.1/fixnum.rb
|
@@ -206,6 +206,7 @@ files:
|
|
206
206
|
- types/ruby-2.x/marshal.rb
|
207
207
|
- types/ruby-2.x/matchdata.rb
|
208
208
|
- types/ruby-2.x/math.rb
|
209
|
+
- types/ruby-2.x/nil.rb
|
209
210
|
- types/ruby-2.x/numeric.rb
|
210
211
|
- types/ruby-2.x/object.rb
|
211
212
|
- types/ruby-2.x/pathname.rb
|
@@ -236,9 +237,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
236
237
|
version: '0'
|
237
238
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
238
239
|
requirements:
|
239
|
-
- - "
|
240
|
+
- - ">"
|
240
241
|
- !ruby/object:Gem::Version
|
241
|
-
version:
|
242
|
+
version: 1.3.1
|
242
243
|
requirements: []
|
243
244
|
rubyforge_project:
|
244
245
|
rubygems_version: 2.5.1
|
data/lib/rdl/types/.#lexer.rex
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
milod@ubuntu.47783:1458260004
|