Merge pull request #71349 from vonagam/disallow-infer-on-weak
GDScript: Disallow type inference with untyped initializer
This commit is contained in:
+3
@@ -0,0 +1,3 @@
|
||||
func test():
|
||||
var untyped = 1
|
||||
var inferred := untyped
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
GDTEST_ANALYZER_ERROR
|
||||
Cannot infer the type of "inferred" variable because the value doesn't have a set type.
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
var untyped = 1
|
||||
var inferred := untyped
|
||||
|
||||
func test():
|
||||
pass
|
||||
+2
@@ -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.
|
||||
@@ -1,9 +1,4 @@
|
||||
func test():
|
||||
var one_0 = 0
|
||||
one_0 = 1
|
||||
var one_1 := one_0
|
||||
print(one_1)
|
||||
|
||||
var two: Variant = 0
|
||||
two += 2
|
||||
print(two)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
GDTEST_OK
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
|
||||
Reference in New Issue
Block a user