-
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: allow literal types as upper bounds of type parameters (#1102)
Closes #1081 ### Summary of Changes * Literal types can now be used as upper bounds of type parameters * Don't show an extra error if callable types or union types are used as upper bounds of type parameters. This is already checked elsewhere.
- Loading branch information
1 parent
3021166
commit c14159b
Showing
4 changed files
with
43 additions
and
38 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
31 changes: 0 additions & 31 deletions
31
.../validation/other/declarations/type parameters/upper bound must be named type/main.sdsdev
This file was deleted.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
...validation/other/declarations/type parameters/upper bound must not be unknown/main.sdsdev
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,34 @@ | ||
package tests.validation.other.declarations.typeParameters.upperBoundMustNotBeUnknown | ||
|
||
class C | ||
enum E { | ||
V | ||
} | ||
|
||
// $TEST$ no error "The upper bound of a type parameter must not have an unknown type." | ||
class MyClass1<T sub »() -> ()«> | ||
|
||
// $TEST$ no error "The upper bound of a type parameter must not have an unknown type." | ||
class MyClass2<T sub »literal<1>«> | ||
|
||
// $TEST$ no error "The upper bound of a type parameter must not have an unknown type." | ||
class MyClass3<T sub »C«> | ||
|
||
// $TEST$ no error "The upper bound of a type parameter must not have an unknown type." | ||
class MyClass4<T sub »E«> | ||
|
||
// $TEST$ no error "The upper bound of a type parameter must not have an unknown type." | ||
class MyClass5<T sub »E.V«> | ||
|
||
// $TEST$ no error "The upper bound of a type parameter must not have an unknown type." | ||
class MyClass6<T sub »union<C, E>«> | ||
|
||
// $TEST$ error "The upper bound of a type parameter must not have an unknown type." | ||
// $TEST$ no error "The upper bound of a type parameter must not have an unknown type." | ||
class MyClass7<T1 sub »T2«, T2 sub »T1«> | ||
|
||
// $TEST$ error "The upper bound of a type parameter must not have an unknown type." | ||
class MyClass8<T sub »Unresolved«> | ||
|
||
// $TEST$ error "The upper bound of a type parameter must not have an unknown type." | ||
class MyClass9<T sub »unknown«> |