-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typed arrays aren't working with += #72948
Comments
I see the same issue when initializing arrays like: var membervar: Array[ClassDefinedElseWhere] = Array() It seems like this is a more general issue. |
@esarver This is not the same issue. You are trying to assign an untyped array to a typed property, which is not possible due to ambiguous behavior. You need to use the assign method of the array if you want to convert your value to the typed array. If you only want to initialize your property, an array literal should work, |
Godot version
v4.0.rc1.official [8843d9a]
System information
Lubuntu
Issue description
You can't use + or += to mutate typed arrays.
It seems to be not correctly getting the type information from the second operand.
An erudite poster on the discord puts it differently:
The error you see is:
Trying to assign an array of type "Array" to a variable of type "Array[int]".
Steps to reproduce
This will crash with the above error message.
Minimal reproduction project
plus_syntax_broken_demo_project.zip
The text was updated successfully, but these errors were encountered: