Merge pull request #70702 from vnen/gdscript-error-on-assign-void

GDScript: Error when assigning return value of void function
This commit is contained in:
Rémi Verschelde
2023-01-03 12:23:00 +01:00
26 changed files with 108 additions and 53 deletions
@@ -0,0 +1,3 @@
func test():
var builtin := []
print(builtin.reverse()) # Built-in type method.
@@ -0,0 +1,2 @@
GDTEST_ANALYZER_ERROR
Cannot get return value of call to "reverse()" because it returns "void".
@@ -0,0 +1,5 @@
func foo() -> void:
pass
func test():
print(foo()) # Custom method.
@@ -0,0 +1,2 @@
GDTEST_ANALYZER_ERROR
Cannot get return value of call to "foo()" because it returns "void".
@@ -0,0 +1,2 @@
func test():
print(print_debug()) # GDScript utility function.
@@ -0,0 +1,2 @@
GDTEST_ANALYZER_ERROR
Cannot get return value of call to "print_debug()" because it returns "void".
@@ -0,0 +1,3 @@
func test():
var obj := Node.new()
print(obj.free()) # Native type method.
@@ -0,0 +1,2 @@
GDTEST_ANALYZER_ERROR
Cannot get return value of call to "free()" because it returns "void".
@@ -0,0 +1,2 @@
func test():
print(print()) # Built-in utility function.
@@ -0,0 +1,2 @@
GDTEST_ANALYZER_ERROR
Cannot get return value of call to "print()" because it returns "void".