GDScript: Make using return of void function an error

Remove the `VOID_ASSIGNMENT` warning since those cases will be errors
now.
This commit is contained in:
George Marques
2022-12-30 11:57:25 -03:00
parent 0c15844551
commit bc739a4687
16 changed files with 38 additions and 35 deletions

View File

@@ -0,0 +1,3 @@
func test():
var builtin := []
print(builtin.reverse()) # Built-in type method.

View File

@@ -0,0 +1,2 @@
GDTEST_ANALYZER_ERROR
Cannot get return value of call to "reverse()" because it returns "void".

View File

@@ -0,0 +1,5 @@
func foo() -> void:
pass
func test():
print(foo()) # Custom method.

View File

@@ -0,0 +1,2 @@
GDTEST_ANALYZER_ERROR
Cannot get return value of call to "foo()" because it returns "void".

View File

@@ -0,0 +1,2 @@
func test():
print(print_debug()) # GDScript utility function.

View File

@@ -0,0 +1,2 @@
GDTEST_ANALYZER_ERROR
Cannot get return value of call to "print_debug()" because it returns "void".

View File

@@ -0,0 +1,3 @@
func test():
var obj := Node.new()
print(obj.free()) # Native type method.

View File

@@ -0,0 +1,2 @@
GDTEST_ANALYZER_ERROR
Cannot get return value of call to "free()" because it returns "void".

View File

@@ -0,0 +1,2 @@
func test():
print(print()) # Built-in utility function.

View File

@@ -0,0 +1,2 @@
GDTEST_ANALYZER_ERROR
Cannot get return value of call to "print()" because it returns "void".