Skip to content
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

Array += Array is broken #76041

Closed
vmedea opened this issue Apr 13, 2023 · 1 comment · Fixed by #75885
Closed

Array += Array is broken #76041

vmedea opened this issue Apr 13, 2023 · 1 comment · Fixed by #75885

Comments

@vmedea
Copy link
Contributor

vmedea commented Apr 13, 2023

Godot version

4.1.dev (4dcf2c5)

System information

Debian Linux, rendering N/A

Issue description

I noticed the following strange behavior on master as of 4dcf2c5:

func _ready():
        var list: Array = []
        list = [1,2,3,4]
        list += [1,2]
        print(list) # should print: [1,2,3,4,1,2] prints: [1,2]
        list += []
        print(list) # should print: [1,2,3,4,1,2] prints: []

        var list2: Array = [1,2,3]
        list += list2
        print(list) # should print: [1,2,...2,3] prints: [1,2,3]

It appears that += overwrites the current data instead of appending.

FWIW, just writing var list = [] doesn't trigger the problem. So it's likely something with type Array. Array.append_array doesn't suffer from the problem.

The problem is similar to #72948, however this involves not a typed array only the type Array, and I haven't seen an error. The data just disappears silently. But it might still be fixed by #73540. Haven't tested yet.

Steps to reproduce

See issue description.

Minimal reproduction project

N/A

@akien-mga akien-mga added this to the 4.1 milestone Apr 13, 2023
@AThousandShips
Copy link
Member

AThousandShips commented Apr 14, 2023

Related to #75832, and is fixed by #75885

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants