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

Nested array mutability is not inferred #6246

Open
Chriscbr opened this issue Apr 15, 2024 · 2 comments
Open

Nested array mutability is not inferred #6246

Chriscbr opened this issue Apr 15, 2024 · 2 comments
Labels
🐛 bug Something isn't working 🛠️ compiler Compiler Stale

Comments

@Chriscbr
Copy link
Contributor

I tried this:

let x = MutArray<MutArray<num>>[[1, 2, 3]];

This happened:

It raises the following error:

error: Expected type to be "MutArray<num>", but got "Array<num>" instead
  --> main.w:1:33
  |
1 | let x = MutArray<MutArray<num>>[[1, 2, 3]];
  |                                 ^^^^^^^^^ Expected type to be "MutArray<num>", but got "Array<num>" instead

I expected this:

It should allow the code to compile since the full types are specified on the left hand side

Is there a workaround?

Fully specify the types:

let x = MutArray<MutArray<num>>[MutArray<num>[1, 2, 3]];

For 3D arrays this is quite laborious

let x = MutArray<MutArray<MutArray<num>>>[
  MutArray<MutArray<num>>[MutArray<num>[1, 2, 3]]
];

Anything else?

No response

Wing Version

0.70.6

Node.js Version

20.11.1

Platform(s)

MacOS

Community Notes

  • Please vote by adding a 👍 reaction to the issue to help us prioritize.
  • If you are interested to work on this issue, please leave a comment.
@Chriscbr Chriscbr added 🐛 bug Something isn't working 🛠️ compiler Compiler labels Apr 15, 2024
@monadabot monadabot added this to Wing Apr 15, 2024
@github-project-automation github-project-automation bot moved this to 🆕 New - not properly defined in Wing Apr 15, 2024
@staycoolcall911 staycoolcall911 moved this from 🆕 New - not properly defined to 🤝 Backlog - handoff to owners in Wing Apr 23, 2024
Copy link

Hi,

This issue hasn't seen activity in 90 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days.
Feel free to re-open this issue when there's an update or relevant information to be added.
Thanks!

Copy link

Hi,

This issue hasn't seen activity in 90 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days.
Feel free to re-open this issue when there's an update or relevant information to be added.
Thanks!

@github-actions github-actions bot added the Stale label Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working 🛠️ compiler Compiler Stale
Projects
Status: 🤝 Backlog - handoff to owners
Development

No branches or pull requests

2 participants