GDScript: Fix issues with typed arrays
This commit is contained in:
parent
e9de988020
commit
5909f9f075
50 changed files with 959 additions and 555 deletions
|
|
@ -1,2 +1,2 @@
|
|||
GDTEST_ANALYZER_ERROR
|
||||
Cannot get index "true" from "[0, 1]".
|
||||
Invalid index type "bool" for a base of type "Array".
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
func test():
|
||||
var differently: Array[float] = [1.0]
|
||||
var typed: Array[int] = differently
|
||||
print('not ok')
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
GDTEST_ANALYZER_ERROR
|
||||
Cannot assign a value of type Array[float] to variable "typed" with specified type Array[int].
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
func test():
|
||||
const arr: Array[int] = ["Hello", "World"]
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
GDTEST_ANALYZER_ERROR
|
||||
Cannot include a value of type "String" as "int".
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
func test():
|
||||
var unconvertable := 1
|
||||
var typed: Array[Object] = [unconvertable]
|
||||
print('not ok')
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
GDTEST_ANALYZER_ERROR
|
||||
Cannot have an element of type "int" in an array of type "Array[Object]".
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
func expect_typed(typed: Array[int]):
|
||||
print(typed.size())
|
||||
|
||||
func test():
|
||||
var differently: Array[float] = [1.0]
|
||||
expect_typed(differently)
|
||||
print('not ok')
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
GDTEST_ANALYZER_ERROR
|
||||
Invalid argument for "expect_typed()" function: argument 1 should be "Array[int]" but is "Array[float]".
|
||||
Loading…
Add table
Add a link
Reference in a new issue