You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-13 13:31:48 +00:00
GDScript: Allow void functions to return calls to other void functions
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
func test():
|
||||
return_call()
|
||||
return_nothing()
|
||||
return_side_effect()
|
||||
var r = return_side_effect.call() # Untyped call to check return value.
|
||||
prints(r, typeof(r) == TYPE_NIL)
|
||||
print("end")
|
||||
|
||||
func side_effect(v):
|
||||
print("effect")
|
||||
return v
|
||||
|
||||
func return_call() -> void:
|
||||
return print("hello")
|
||||
|
||||
func return_nothing() -> void:
|
||||
return
|
||||
|
||||
func return_side_effect() -> void:
|
||||
return side_effect("x")
|
||||
@@ -0,0 +1,10 @@
|
||||
GDTEST_OK
|
||||
>> WARNING
|
||||
>> Line: 20
|
||||
>> UNSAFE_VOID_RETURN
|
||||
>> The method 'return_side_effect()' returns 'void' but it's trying to return a call to 'side_effect()' that can't be ensured to also be 'void'.
|
||||
hello
|
||||
effect
|
||||
effect
|
||||
<null> true
|
||||
end
|
||||
Reference in New Issue
Block a user