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

Wrong type when multi assign with arrays #332

Closed
blob1807 opened this issue Apr 1, 2024 · 1 comment
Closed

Wrong type when multi assign with arrays #332

blob1807 opened this issue Apr 1, 2024 · 1 comment

Comments

@blob1807
Copy link
Contributor

blob1807 commented Apr 1, 2024

It's seeing yd as a bool it should be int. The type doesn't matter it'll always been seen as bool.

Foo :: struct{d: []int}
x,y := Foo{d=[]int{1,2,3}}, Foo{d=[]int{1,2,3}}

for _, i in x.d {
    xd, yd := x.d[i], y.d[i]
    fmt.println(xd, yd)
}

OLS: VS Code v0.1.26
IDE: VSCodium
OS: Windows

@blob1807
Copy link
Contributor Author

blob1807 commented Apr 2, 2024

Forgot to add. It will see td as int if you explicitly use the type.

Foo :: struct{d: []int}
x, y := Foo{d=[]int{1,2,3}}, Foo{d=[]int{1,2,3}}

for _, i in x.d {
    xd, yd: int = x.d[i], y.d[i]
    fmt.println(xd, yd)
}

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

No branches or pull requests

1 participant