-
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: error if type parameter is used in nested named type declaration
- Loading branch information
1 parent
4ce4fd1
commit 354c00d
Showing
3 changed files
with
67 additions
and
3 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
...-ds-lang/tests/resources/validation/other/declarations/type parameters/usage/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.other.declarations.typeParameters.usage | ||
|
||
// $TEST$ no error "Type parameters cannot be used in nested named type declarations." | ||
class MyClass<T>(p: »T«) { | ||
// $TEST$ no error "Type parameters cannot be used in nested named type declarations." | ||
attr a: »T« | ||
|
||
// $TEST$ no error "Type parameters cannot be used in nested named type declarations." | ||
// $TEST$ no error "Type parameters cannot be used in nested named type declarations." | ||
// $TEST$ no error "Type parameters cannot be used in nested named type declarations." | ||
// $TEST$ no error "Type parameters cannot be used in nested named type declarations." | ||
fun f<S>(p1: »T«, p2: »S«) -> (r1: »T«, r2: »S«) | ||
|
||
// $TEST$ error "Type parameters cannot be used in nested named type declarations." | ||
// $TEST$ no error "Type parameters cannot be used in nested named type declarations." | ||
class MyInnerClass<S>(p1: »T«, p2: »S«) { | ||
// $TEST$ error "Type parameters cannot be used in nested named type declarations." | ||
attr a: »T« | ||
|
||
// $TEST$ error "Type parameters cannot be used in nested named type declarations." | ||
fun f(p: »T«) | ||
} | ||
|
||
enum MyInnerEnum { | ||
// $TEST$ error "Type parameters cannot be used in nested named type declarations." | ||
// $TEST$ no error "Type parameters cannot be used in nested named type declarations." | ||
MyEnumVariant<S>(p1: »T«, p2: »S«) | ||
} | ||
} |