Merge pull request #71349 from vonagam/disallow-infer-on-weak

GDScript: Disallow type inference with untyped initializer
This commit is contained in:
Rémi Verschelde
2023-01-25 14:42:20 +01:00
9 changed files with 20 additions and 9 deletions

View File

@@ -0,0 +1,3 @@
func test():
var untyped = 1
var inferred := untyped

View File

@@ -0,0 +1,2 @@
GDTEST_ANALYZER_ERROR
Cannot infer the type of "inferred" variable because the value doesn't have a set type.

View File

@@ -0,0 +1,5 @@
var untyped = 1
var inferred := untyped
func test():
pass

View File

@@ -0,0 +1,2 @@
GDTEST_ANALYZER_ERROR
Cannot infer the type of "inferred" variable because the value doesn't have a set type.

View File

@@ -0,0 +1,5 @@
func check(untyped = 1, inferred := untyped):
pass
func test():
check()

View File

@@ -0,0 +1,2 @@
GDTEST_ANALYZER_ERROR
Cannot infer the type of "inferred" parameter because the value doesn't have a set type.