Closed qarmin closed 5 years ago
Flagging as bug since we should either enforce giving an initial value or make sure it is initialized to new, unshared arrays.
Looks like decorating with export (Array) also causes the break to occur even when the variable isn't Typed.
Confirmed in 6e600706.
Hmm, Im wondering if the default value of
var array: Array
should actually be null and cause a crash if not initialized. it would help to enforce giving a default value and would avoid the bug all together.
That might require more changes, since you aren't allowed to assign null
to variables statically typed as built-in types that don't extend Object (like Array or Dictionary).
I think typed variables should require an initial value, that's really what "var array: Array
should actually be null and cause a crash if not initialized." is trying to get you to infer, but I think it's better to be explicit and tell someone "This isn't going to work as expected without an initial value".
Yeah, I misunderstood.
Like you said, better to have an explicit warning.
As seen in #27997, it seems to be the same for Dictionary.
Looks like decorating with export (Array) also causes the break to occur even when the variable isn't Typed.
This still seems to be the case in v3.3.3.stable.official [b973f997f]
This still appears to be occurring in v3.5.2.stable.official [170ba337a] as well.
Godot version: 3.1 8dd00ed
OS/device including version: Windows 10
Issue description: When I append value to array, other array have this value inside. This is broken code
and this is Output
When I didn't use typed GDScript then it seems to work correct:
and this is Output