-
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 parent type is nullable (#891)
### Summary of Changes Only allow non-nullable class types as the parent types of a class.
- Loading branch information
1 parent
bb0c94b
commit add650d
Showing
6 changed files
with
58 additions
and
18 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
2 changes: 1 addition & 1 deletion
2
...urces/validation/inheritance/must inherit only classes/class without parent types.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package tests.validation.inheritance.mustInheritOnlyClasses | ||
|
||
// $TEST$ no error "A class must only inherit classes." | ||
class TestClass | ||
class TestClass7 |
34 changes: 34 additions & 0 deletions
34
...sts/resources/validation/inheritance/must not be nullable/class with parent types.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,34 @@ | ||
package tests.validation.inheritance.mustNotBeNullable | ||
|
||
class MyClass { | ||
class MyNestedClass | ||
} | ||
enum MyEnum { | ||
MyEnumVariant | ||
} | ||
|
||
// $TEST$ no error "The parent type must not be nullable." | ||
// $TEST$ no error "The parent type must not be nullable." | ||
// $TEST$ no error "The parent type must not be nullable." | ||
// $TEST$ no error "The parent type must not be nullable." | ||
// $TEST$ no error "The parent type must not be nullable." | ||
class TestClass1 sub »MyClass«, | ||
»MyClass.MyNestedClass?«, | ||
»MyEnum?«, | ||
»MyEnum.MyEnumVariant?«, | ||
»Unresolved?« | ||
|
||
// $TEST$ error "The parent type must not be nullable." | ||
class TestClass2 sub »MyClass?« | ||
|
||
// $TEST$ error "The parent type must not be nullable." | ||
class TestClass3 sub »MyClass.MyNestedClass?« | ||
|
||
// $TEST$ no error "The parent type must not be nullable." | ||
class TestClass4 sub »MyEnum?« | ||
|
||
// $TEST$ no error "The parent type must not be nullable." | ||
class TestClass5 sub »MyEnum.MyEnumVariant?« | ||
|
||
// $TEST$ no error "The parent type must not be nullable." | ||
class TestClass6 sub »Unresolved?« |