You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-23 15:16:17 +00:00
GDScript: Begin making constants deep, not shallow or flat
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
const array: Array = [{}]
|
||||
|
||||
func test():
|
||||
var dictionary := array[0]
|
||||
var key: int = 0
|
||||
dictionary[key] = 0
|
||||
@@ -0,0 +1,6 @@
|
||||
GDTEST_RUNTIME_ERROR
|
||||
>> SCRIPT ERROR
|
||||
>> on function: test()
|
||||
>> runtime/errors/constant_array_is_deep.gd
|
||||
>> 6
|
||||
>> Invalid set index '0' (on base: 'Dictionary') with value of type 'int'
|
||||
@@ -0,0 +1,4 @@
|
||||
const array: Array = [0]
|
||||
|
||||
func test():
|
||||
array.push_back(0)
|
||||
@@ -0,0 +1,7 @@
|
||||
GDTEST_RUNTIME_ERROR
|
||||
>> ERROR
|
||||
>> on function: push_back()
|
||||
>> core/variant/array.cpp
|
||||
>> 253
|
||||
>> Condition "_p->read_only" is true.
|
||||
>> Array is in read-only state.
|
||||
@@ -0,0 +1,4 @@
|
||||
const dictionary := {}
|
||||
|
||||
func test():
|
||||
dictionary.erase(0)
|
||||
@@ -0,0 +1,7 @@
|
||||
GDTEST_RUNTIME_ERROR
|
||||
>> ERROR
|
||||
>> on function: erase()
|
||||
>> core/variant/dictionary.cpp
|
||||
>> 177
|
||||
>> Condition "_p->read_only" is true. Returning: false
|
||||
>> Dictionary is in read-only state.
|
||||
@@ -0,0 +1,6 @@
|
||||
const dictionary := {0: [0]}
|
||||
|
||||
func test():
|
||||
var array := dictionary[0]
|
||||
var key: int = 0
|
||||
array[key] = 0
|
||||
@@ -0,0 +1,6 @@
|
||||
GDTEST_RUNTIME_ERROR
|
||||
>> SCRIPT ERROR
|
||||
>> on function: test()
|
||||
>> runtime/errors/constant_dictionary_is_deep.gd
|
||||
>> 6
|
||||
>> Invalid set index '0' (on base: 'Array') with value of type 'int'
|
||||
Reference in New Issue
Block a user