Nested array mutability is not inferred
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.
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!
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!