-
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 (
#750) Closes #748 ### Summary of Changes Show an error if a type parameter of a class is used inside a nested named type declaration.
- Loading branch information
1 parent
6510555
commit 52374aa
Showing
5 changed files
with
69 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
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
...d must be own type parameter/main.sdstest → ...d must be own type parameter/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
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«) | ||
} | ||
} |