-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #328 from OpShin/fix/merging_functions_with_type_c…
…apturing Fix/merging functions with type capturing
- Loading branch information
Showing
8 changed files
with
204 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,49 @@ | ||
from ..types import * | ||
|
||
|
||
def test_record_type_order(): | ||
A = RecordType(Record("A", "A", 0, [("foo", IntegerInstanceType)])) | ||
B = RecordType(Record("B", "B", 1, [("bar", IntegerInstanceType)])) | ||
C = RecordType(Record("C", "C", 2, [("baz", IntegerInstanceType)])) | ||
a = A | ||
b = B | ||
c = C | ||
|
||
assert a >= a | ||
assert not a >= b | ||
assert not b >= a | ||
assert not a >= c | ||
assert not c >= a | ||
assert not b >= c | ||
assert not c >= b | ||
|
||
A = RecordType(Record("A", "A", 0, [("foo", IntegerInstanceType)])) | ||
B = RecordType( | ||
Record( | ||
"B", "B", 0, [("foo", IntegerInstanceType), ("bar", IntegerInstanceType)] | ||
) | ||
) | ||
C = RecordType(Record("C", "C", 0, [("foo", InstanceType(AnyType()))])) | ||
assert not A >= B | ||
assert not C >= B | ||
assert C >= A | ||
|
||
|
||
def test_union_type_order(): | ||
A = RecordType(Record("A", "A", 0, [("foo", IntegerInstanceType)])) | ||
B = RecordType(Record("B", "B", 1, [("bar", IntegerInstanceType)])) | ||
C = RecordType(Record("C", "C", 2, [("baz", IntegerInstanceType)])) | ||
abc = UnionType([A, B, C]) | ||
ab = UnionType([A, B]) | ||
a = A | ||
c = C | ||
|
||
assert a >= a | ||
assert ab >= a | ||
assert not a >= ab | ||
assert abc >= ab | ||
assert not ab >= abc | ||
assert not c >= a | ||
assert not a >= c | ||
assert abc >= c | ||
assert not ab >= c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.