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.
This commit is contained in:
@ -0,0 +1,10 @@
|
||||
class TestOne:
|
||||
func _init():
|
||||
pass
|
||||
|
||||
class TestTwo extends TestOne:
|
||||
func _init():
|
||||
super()
|
||||
|
||||
func test():
|
||||
pass
|
||||
@ -0,0 +1 @@
|
||||
GDTEST_OK
|
||||
Reference in New Issue
Block a user