You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Upon defining a nested dictionary constant the editor will mark it as an error. It does, however, work when defining the inner dictionary (as a constant) beforehand. Not sure whether this is by design but it did work in GDScript 1.0 (Godot 3.x) so I'm guessing this may be a bug.
Steps to reproduce
Define a nested dictionary as a constant inside a GDScript file (see below)
Minimal reproduction project
Create a new GDScript file inside the engine and paste the following:
Example reproduction case provided by @Scony in #52031
Godot version
master #fb176d5f6e6dc2b43c630a041a8ab7d737173ec4
System information
manjaro linux
Issue description
following script:
const X = {
'x': [],
}
yields
SCRIPT ERROR: Parse Error: Initializer for a constant must be a constant expression.
at: GDScript::reload (res://tests/potential-godot-bugs/const-dict.gd:1)
ERROR: Method/function failed. Returning: ERR_PARSE_ERROR
at: reload (modules/gdscript/gdscript.cpp:840)
while it was working in Godot 3.x
lyuma
changed the title
GDScript 2.0: Can't define nested dictionary constant
GDScript 2.0: Can't define nested dictionary and array constants
Aug 25, 2021
Godot version
v4.0.dev.calinou [bfc14a6]
System information
Windows 10
Issue description
Upon defining a nested dictionary constant the editor will mark it as an error. It does, however, work when defining the inner dictionary (as a constant) beforehand. Not sure whether this is by design but it did work in GDScript 1.0 (Godot 3.x) so I'm guessing this may be a bug.
Steps to reproduce
Define a nested dictionary as a constant inside a GDScript file (see below)
Minimal reproduction project
Create a new GDScript file inside the engine and paste the following:
The text was updated successfully, but these errors were encountered: