Merge pull request #70656 from vonagam/fix-void-returns

GDScript: Disallow return with value in void functions
This commit is contained in:
Rémi Verschelde
2023-01-03 12:20:33 +01:00
7 changed files with 20 additions and 0 deletions
@@ -0,0 +1,2 @@
func test() -> void:
return null
@@ -0,0 +1,2 @@
GDTEST_ANALYZER_ERROR
A void function cannot return a value.
@@ -0,0 +1,4 @@
func test() -> void:
var a
a = 1
return a
@@ -0,0 +1,2 @@
GDTEST_ANALYZER_ERROR
A void function cannot return a value.