-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve type simplification (#871)
### Summary of Changes * Merge literal types in union types (`union<literal<1>, literal<2>` becomes `literal<1, 2>`). * Unwrap type parameter substitutions in class type (`C<union<Int>>` becomes `C<Int>`).
- Loading branch information
1 parent
6035b76
commit 0daafb9
Showing
7 changed files
with
95 additions
and
12 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
18 changes: 18 additions & 0 deletions
18
...ang/tests/resources/typing/simplification/merge literal types in union types/main.sdstest
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,18 @@ | ||
package tests.typing.simplification.mergeLiteralTypesInUnionTypes | ||
|
||
class C( | ||
// $TEST$ serialization literal<1> | ||
p1: »union<literal<1, 1>, literal<1, 1>>«, | ||
|
||
// $TEST$ serialization literal<1, 2> | ||
p2: »union<literal<1, 1>, literal<1, 2>>«, | ||
|
||
// $TEST$ serialization literal<1, 2, 3> | ||
p3: »union<literal<1, 2>, literal<2, 3>>«, | ||
|
||
// $TEST$ serialization literal<1, 2, 3> | ||
p4: »union<literal<1>, literal<2>, literal<3>>«, | ||
|
||
// $TEST$ serialization union<literal<1, 2, 3>, String> | ||
p5: »union<literal<1, 1>, String, literal<2, 3>>«, | ||
) |
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
2 changes: 1 addition & 1 deletion
2
...ly null with NothingNullable/main.sdstest → ...only null with NothingOrNull/main.sdstest
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