-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a critical typing bug that allows incompatible types to be passed…
… into functions The bug affects the union type comparison operation when comparing it to other union types. It would allow types of unexpected type to be passed into a function. To remedy this situation, a new testing harness should be created that tests the validity of the type system
- Loading branch information
Showing
4 changed files
with
91 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from ..types import * | ||
|
||
|
||
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 | ||
|
||
assert a >= a | ||
assert ab >= a | ||
assert not a >= ab | ||
assert abc >= ab | ||
assert not ab >= abc |
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