-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't allow weaker return type in overriden method
- Loading branch information
Showing
12 changed files
with
54 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
7 changes: 7 additions & 0 deletions
7
modules/gdscript/tests/scripts/analyzer/errors/override_with_weaker_type.gd
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,7 @@ | ||
class Parent: | ||
func override_me() -> bool: | ||
return true | ||
|
||
class Child extends Parent: | ||
func override_me(): | ||
pass |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/analyzer/errors/override_with_weaker_type.out
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,2 @@ | ||
GDTEST_ANALYZER_ERROR | ||
The function signature doesn't match the parent. Parent signature is "override_me() -> bool". |
7 changes: 7 additions & 0 deletions
7
modules/gdscript/tests/scripts/analyzer/errors/override_with_wrong_type.gd
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,7 @@ | ||
class Parent: | ||
func override_me() -> bool: | ||
return true | ||
|
||
class Child extends Parent: | ||
func override_me() -> int: | ||
return 1 |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/analyzer/errors/override_with_wrong_type.out
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,2 @@ | ||
GDTEST_ANALYZER_ERROR | ||
The function signature doesn't match the parent. Parent signature is "override_me() -> bool". |
10 changes: 10 additions & 0 deletions
10
modules/gdscript/tests/scripts/analyzer/features/override_variant_with_weaker_type.gd
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,10 @@ | ||
class Parent: | ||
func override_me() -> Variant: | ||
return true | ||
|
||
class Child extends Parent: | ||
func override_me(): | ||
pass | ||
|
||
func test(): | ||
pass |
1 change: 1 addition & 0 deletions
1
modules/gdscript/tests/scripts/analyzer/features/override_variant_with_weaker_type.out
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 @@ | ||
GDTEST_OK |
10 changes: 10 additions & 0 deletions
10
modules/gdscript/tests/scripts/analyzer/features/override_void_with_weaker_type.gd
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,10 @@ | ||
class Parent: | ||
func override_me() -> void: | ||
pass | ||
|
||
class Child extends Parent: | ||
func override_me(): | ||
pass | ||
|
||
func test(): | ||
pass |
1 change: 1 addition & 0 deletions
1
modules/gdscript/tests/scripts/analyzer/features/override_void_with_weaker_type.out
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 @@ | ||
GDTEST_OK |
10 changes: 10 additions & 0 deletions
10
modules/gdscript/tests/scripts/analyzer/features/override_with_stronger_type.gd
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,10 @@ | ||
class Parent: | ||
func override_me(): | ||
pass | ||
|
||
class Child extends Parent: | ||
func override_me() -> bool: | ||
return true | ||
|
||
func test(): | ||
pass |
1 change: 1 addition & 0 deletions
1
modules/gdscript/tests/scripts/analyzer/features/override_with_stronger_type.out
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 @@ | ||
GDTEST_OK |