let a = MutArray<num> [1,2];
a.push(3); //succeeds because a is mutable
test "mutability disabled on inflight error message should be improved" { // test syntax currently implies inflight, so referenced preflight expressions are lifted by the compiler
a.push(4); //fails because during lifting a was implicitly converted to immutable
}
This happened:
Compiler error within the test block:
error: Member "push" doesn't exist in "Array"
--> wing/main.w:5:5
|
5 | a.push(4);
| ^^^^
I expected this:
In #6258 we added the compiler behavior to convert mutable preflight expressions to immutable when lifting them to inflight.
So, I was expecting calling a.push() inflight to fail, but it is unclear from the error message that a is not mutable anymore or what should I do.
I would expect an error message in the spirit of:
Preflight "MutArray" object was implicitly converted to "Array" when lifting to inflight - for additional information please see https://www.winglang.io/docs/concepts/inflights#using-preflight-data-from-inflight
Important to note that if I would use a non existing method name (e.g. a.pushhhh()), I would still expect to get the current error message: error: Member "pushhhh" doesn't exist in "Array".
Is there a workaround?
No response
Anything else?
No response
Wing Version
0.74.14
Node.js Version
No response
Platform(s)
No response
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.
I tried this:
This happened:
Compiler error within the test block:
I expected this:
In #6258 we added the compiler behavior to convert mutable preflight expressions to immutable when lifting them to inflight. So, I was expecting calling
a.push()
inflight to fail, but it is unclear from the error message thata
is not mutable anymore or what should I do.I would expect an error message in the spirit of:
Preflight "MutArray" object was implicitly converted to "Array" when lifting to inflight - for additional information please see https://www.winglang.io/docs/concepts/inflights#using-preflight-data-from-inflight
Important to note that if I would use a non existing method name (e.g.
a.pushhhh()
), I would still expect to get the current error message:error: Member "pushhhh" doesn't exist in "Array"
.Is there a workaround?
No response
Anything else?
No response
Wing Version
0.74.14
Node.js Version
No response
Platform(s)
No response
Community Notes