rdl 2.0.0.rc4 → 2.0.0.rc5
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/README.md +56 -84
- data/lib/rdl/boot.rb +4 -0
- data/lib/rdl/boot_rails.rb +3 -1
- data/lib/rdl/contracts/flat.rb +1 -2
- data/lib/rdl/typecheck.rb +138 -27
- data/lib/rdl/types/annotated_arg.rb +8 -0
- data/lib/rdl/types/finite_hash.rb +32 -17
- data/lib/rdl/types/lexer.rex +1 -0
- data/lib/rdl/types/lexer.rex.rb +3 -0
- data/lib/rdl/types/method.rb +24 -4
- data/lib/rdl/types/optional.rb +8 -1
- data/lib/rdl/types/parser.racc +12 -9
- data/lib/rdl/types/parser.tab.rb +293 -255
- data/lib/rdl/types/type.rb +20 -11
- data/lib/rdl/types/union.rb +3 -0
- data/lib/rdl/types/vararg.rb +7 -2
- data/lib/rdl/wrap.rb +15 -2
- data/lib/types/core-ruby-2.x/proc.rb +16 -0
- data/lib/types/rails-5.x/_helpers.rb +20 -0
- data/lib/types/rails-5.x/active_model/errors.rb +15 -0
- data/lib/types/rails-5.x/active_model/validations.rb +5 -0
- data/lib/types/rails-5.x/active_record/associations.rb +190 -0
- data/lib/types/rails-5.x/active_record/core.rb +3 -0
- data/lib/types/rails-5.x/active_record/model_schema.rb +7 -10
- data/rdl.gemspec +2 -2
- data/test/test_le.rb +24 -0
- data/test/test_member.rb +24 -2
- data/test/test_parser.rb +21 -10
- data/test/test_query.rb +5 -2
- data/test/test_type_contract.rb +34 -2
- data/test/test_typecheck.rb +296 -36
- data/test/test_types.rb +8 -4
- metadata +7 -2
data/test/test_types.rb
CHANGED
@@ -170,17 +170,20 @@ class TestTypes < Minitest::Test
|
|
170
170
|
ta = VarType.new :a
|
171
171
|
tb = VarType.new :b
|
172
172
|
tc = VarType.new :c
|
173
|
+
td = VarType.new :d
|
173
174
|
thash = NominalType.new :Hash
|
174
175
|
thashAB = GenericType.new(thash, tA, tB)
|
175
176
|
thashab = GenericType.new(thash, ta, tb)
|
176
177
|
thashstringfixnum = GenericType.new(thash, tstring, tfixnum)
|
177
|
-
inst = {a: tstring, b: tfixnum}
|
178
|
+
inst = {a: tstring, b: tfixnum, d: tsyma}
|
178
179
|
ttupleAB = TupleType.new(tA, tB)
|
179
180
|
ttupleab = TupleType.new(ta, tb)
|
180
181
|
ttuplestringfixnum = TupleType.new(tstring, tfixnum)
|
181
|
-
tfinitehashaAbB = FiniteHashType.new(a: tA, b: tB)
|
182
|
-
tfinitehashaabb = FiniteHashType.new(a: ta, b: tb)
|
183
|
-
tfinitehashastringbfixnum = FiniteHashType.new(a: tstring, b: tfixnum)
|
182
|
+
tfinitehashaAbB = FiniteHashType.new({a: tA, b: tB}, nil)
|
183
|
+
tfinitehashaabb = FiniteHashType.new({a: ta, b: tb}, nil)
|
184
|
+
tfinitehashastringbfixnum = FiniteHashType.new({a: tstring, b: tfixnum}, nil)
|
185
|
+
tfinitehashaabbrd = FiniteHashType.new({a: ta, b: tb}, td)
|
186
|
+
tfinitehashastringbfixnumrsyma = FiniteHashType.new({a: tstring, b: tfixnum}, tsyma)
|
184
187
|
tmethAAB = MethodType.new([tA, tA], nil, tB)
|
185
188
|
tmethaab = MethodType.new([ta, ta], nil, tb)
|
186
189
|
tmethstringstringfixnum = MethodType.new([tstring, tstring], nil, tfixnum)
|
@@ -210,6 +213,7 @@ class TestTypes < Minitest::Test
|
|
210
213
|
assert_equal ttuplestringfixnum, ttupleab.instantiate(inst)
|
211
214
|
assert_equal tfinitehashaAbB, tfinitehashaAbB.instantiate(inst)
|
212
215
|
assert_equal tfinitehashastringbfixnum, tfinitehashaabb.instantiate(inst)
|
216
|
+
assert_equal tfinitehashastringbfixnumrsyma, tfinitehashaabbrd.instantiate(inst)
|
213
217
|
assert_equal tmethAAB, tmethAAB.instantiate(inst)
|
214
218
|
assert_equal tmethstringstringfixnum, tmethaab.instantiate(inst)
|
215
219
|
assert_equal tmethbAABn, tmethbAABn.instantiate(inst)
|
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: 2.0.0.
|
4
|
+
version: 2.0.0.rc5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeffrey S. Foster
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2016-08-
|
15
|
+
date: 2016-08-24 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: parser
|
@@ -189,6 +189,7 @@ files:
|
|
189
189
|
- lib/types/core-ruby-2.x/numeric.rb
|
190
190
|
- lib/types/core-ruby-2.x/object.rb
|
191
191
|
- lib/types/core-ruby-2.x/pathname.rb
|
192
|
+
- lib/types/core-ruby-2.x/proc.rb
|
192
193
|
- lib/types/core-ruby-2.x/process.rb
|
193
194
|
- lib/types/core-ruby-2.x/random.rb
|
194
195
|
- lib/types/core-ruby-2.x/range.rb
|
@@ -206,6 +207,10 @@ files:
|
|
206
207
|
- lib/types/rails-5.x/action_controller/mime_responds.rb
|
207
208
|
- lib/types/rails-5.x/action_controller/strong_parameters.rb
|
208
209
|
- lib/types/rails-5.x/action_dispatch/routing.rb
|
210
|
+
- lib/types/rails-5.x/active_model/errors.rb
|
211
|
+
- lib/types/rails-5.x/active_model/validations.rb
|
212
|
+
- lib/types/rails-5.x/active_record/associations.rb
|
213
|
+
- lib/types/rails-5.x/active_record/core.rb
|
209
214
|
- lib/types/rails-5.x/active_record/model_schema.rb
|
210
215
|
- lib/types/rails-5.x/fixnum.rb
|
211
216
|
- rdl.gemspec
|