-
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: type check type arguments of named types
- Loading branch information
1 parent
72a9bbf
commit 2031708
Showing
3 changed files
with
69 additions
and
0 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
29 changes: 29 additions & 0 deletions
29
...ts/resources/validation/types/checking/type parameter bounds for named 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,29 @@ | ||
package tests.validation.types.checking.typeParameterBoundsForNamedTypes | ||
|
||
class C1<T1> | ||
class C2<T1 sub Number> | ||
class C3<T1, T2 sub T1> | ||
|
||
@Pure fun f( | ||
// $TEST$ no error r"Expected type '.*' but got '.*'\." | ||
a1: C1<»Any?«>, | ||
// $TEST$ no error r"Expected type '.*' but got '.*'\." | ||
a2: C1<T1 = »Any?«>, | ||
// $TEST$ no error r"Expected type '.*' but got '.*'\." | ||
a3: C1<Unknown = »Any?«>, | ||
|
||
// $TEST$ no error r"Expected type '.*' but got '.*'\." | ||
b1: C2<»Number«>, | ||
// $TEST$ error "Expected type 'Number' but got 'String'." | ||
b2: C2<»String«>, | ||
|
||
// $TEST$ no error r"Expected type '.*' but got '.*'\." | ||
// $TEST$ no error r"Expected type '.*' but got '.*'\." | ||
c1: C3<»Number«, »Number«>, | ||
// $TEST$ no error r"Expected type '.*' but got '.*'\." | ||
// $TEST$ no error r"Expected type '.*' but got '.*'\." | ||
c2: C3<»Number«, »Int«>, | ||
// $TEST$ no error r"Expected type '.*' but got '.*'\." | ||
// $TEST$ error "Expected type 'Int' but got 'Number'." | ||
c3: C3<»Int«, »Number«>, | ||
) |