forked from godotengine/godot
-
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.
GDScript: do not warn of return value discarded for super() inside _i…
…nit() DO NOT BATCH MERGE WITH godotengine#77324, WILL RESULT IN BROKEN CI Currently, calling super() inside _init() throws a RETURN_VALUE_DISCARDED warning. The analyzer identifies super() as being a constructor, which therefore returns an object of the relevant class. However, super() isn't really a constructor by itself: in this case, it is _part_ of the constructor, and so doesn't "return" a value. A test case for this is already in godotengine#77324, which contains the warning. I am duplicating it here, without the warning, and it should conflict with the other PR.
- Loading branch information
Showing
3 changed files
with
14 additions
and
2 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
10 changes: 10 additions & 0 deletions
10
modules/gdscript/tests/scripts/analyzer/features/virtual_super_implemented.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 TestOne: | ||
func _init(): | ||
pass | ||
|
||
class TestTwo extends TestOne: | ||
func _init(): | ||
super() | ||
|
||
func test(): | ||
pass |
1 change: 1 addition & 0 deletions
1
modules/gdscript/tests/scripts/analyzer/features/virtual_super_implemented.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 |