diff options
| author | ocean (they/them) <anvilfolk@gmail.com> | 2023-05-22 09:21:25 -0400 |
|---|---|---|
| committer | ocean (they/them) <anvilfolk@gmail.com> | 2023-05-22 09:29:34 -0400 |
| commit | 25c90836fd408566b70be8b3d79b9dbafd2eaec1 (patch) | |
| tree | 6bbb81094b016cd42c8a92d7424d982c52c2a05b /modules/gdscript/tests/scripts | |
| parent | 809a98216267f3066b9fec2f02b2042bdc9d3e0d (diff) | |
| download | redot-engine-25c90836fd408566b70be8b3d79b9dbafd2eaec1.tar.gz | |
GDScript: do not warn of return value discarded for super() inside _init()
DO NOT BATCH MERGE WITH #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 #77324, which contains the warning. I
am duplicating it here, without the warning, and it should conflict with
the other PR.
Diffstat (limited to 'modules/gdscript/tests/scripts')
| -rw-r--r-- | modules/gdscript/tests/scripts/analyzer/features/virtual_super_implemented.gd | 10 | ||||
| -rw-r--r-- | modules/gdscript/tests/scripts/analyzer/features/virtual_super_implemented.out | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/analyzer/features/virtual_super_implemented.gd b/modules/gdscript/tests/scripts/analyzer/features/virtual_super_implemented.gd new file mode 100644 index 0000000000..c447003619 --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/virtual_super_implemented.gd @@ -0,0 +1,10 @@ +class TestOne: + func _init(): + pass + +class TestTwo extends TestOne: + func _init(): + super() + +func test(): + pass diff --git a/modules/gdscript/tests/scripts/analyzer/features/virtual_super_implemented.out b/modules/gdscript/tests/scripts/analyzer/features/virtual_super_implemented.out new file mode 100644 index 0000000000..d73c5eb7cd --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/virtual_super_implemented.out @@ -0,0 +1 @@ +GDTEST_OK |
