Merge pull request #115461 from HolonProduction/gdscript/noroutine
GDScript: Prevent function states from leaking into typed temporaries, when overwriting with coroutines
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
class BaseClass:
|
||||
signal release_bool
|
||||
|
||||
func get_bool() -> bool:
|
||||
return true
|
||||
|
||||
class InheritedClass extends BaseClass:
|
||||
func get_bool() -> bool:
|
||||
await release_bool
|
||||
return false
|
||||
|
||||
|
||||
var instance: BaseClass = InheritedClass.new()
|
||||
|
||||
func test() -> void:
|
||||
@warning_ignore("missing_await")
|
||||
await_with_overwritten_coroutine()
|
||||
instance.release_bool.emit()
|
||||
|
||||
func await_with_overwritten_coroutine():
|
||||
var res_v := await instance.get_bool()
|
||||
print(res_v == true)
|
||||
var result: bool = bool(res_v)
|
||||
print(result == true)
|
||||
@@ -0,0 +1,4 @@
|
||||
GDTEST_OK
|
||||
~~ WARNING at line 21: (REDUNDANT_AWAIT) "await" keyword is unnecessary because the expression isn't a coroutine nor a signal.
|
||||
false
|
||||
false
|
||||
Reference in New Issue
Block a user