mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
GDScript: Fix issues with typed arrays
This commit is contained in:
@@ -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]".
|
||||
Reference in New Issue
Block a user