GDScript: Disallow type inference with untyped initializer

This commit is contained in:
Dmitrii Maganov
2023-01-13 20:51:29 +02:00
parent 228db366bf
commit a1e0281b45
9 changed files with 20 additions and 9 deletions
@@ -0,0 +1,3 @@
func test():
var untyped = 1
var inferred := untyped
@@ -0,0 +1,2 @@
GDTEST_ANALYZER_ERROR
Cannot infer the type of "inferred" variable because the value doesn't have a set type.
@@ -0,0 +1,5 @@
var untyped = 1
var inferred := untyped
func test():
pass
@@ -0,0 +1,2 @@
GDTEST_ANALYZER_ERROR
Cannot infer the type of "inferred" variable because the value doesn't have a set type.
@@ -0,0 +1,5 @@
func check(untyped = 1, inferred := untyped):
pass
func test():
check()
@@ -0,0 +1,2 @@
GDTEST_ANALYZER_ERROR
Cannot infer the type of "inferred" parameter because the value doesn't have a set type.