-
-
Notifications
You must be signed in to change notification settings - Fork 418
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
You can obtain a val from a box field via recover
#4244
Comments
recover
recover
This is the error message we should be getting here: ponyc/src/libponyc/expr/reference.c Lines 283 to 293 in 0f50e3c
|
This seems to be related to the sendability check for arrow types:
https://playground.ponylang.io/?gist=b6e61f17abf5e3f0b46f68e65ec2ddf6 |
@jasoncarr0 @jemc at sync today we merged a triggers release issue fix. I am prepping to do a release for that, however, if you think this would be fixed "soon-ish" like within a few days, I would hold the release to include this as well. Should I hold or go ahead with the release? |
@SeanTAllen - I say go ahead with the release. |
I would say go ahead because I'm not sure how long it would take for a fix depending on the details of the issue. |
recover
recover
@jasoncarr0 checking it to see if you are making progress on this. |
I haven't been making progress / working on this much, I know that the issue is that the current code takes the lower bound (so that lb(this->box) turns into lb({ref,val,box}->box) turns into lb({box,val,box}) into val which counts as sendable for the recover block). But trying to fix this naively just ran into some errors about what is supported. It's probably something very simple |
So the issue here is that we have
which in case TK_THISTYPE:
l_cap = TK_CAP_READ;
break; And whee! we are going to be sendable because in
where our @jemc does that sound correct to you? i'm not sure where to go to find the what is the correct thing to do (but I know this isn't correct). |
@SeanTAllen - yes, that matches Jason's description of the problem, from above:
|
This error exists all the way back on 0.13.0 so this is a long standing bug. |
Honestly getting the notifications and looking at this again, I think the only obviously correct solution is checking all instantiations and hence something like a Possibly because sendability as a condition is invariant, not co nor contravariant. The slightly nicer solution with infinite spare dev-hours is to replace all uses of sendability with a co-/contra-variant version. E.g. in recover blocks, we don't check sendability, we simply pick the best sendable approximation. But that doesn't quite work to replace the special casing on fields because |
I need to check with @sylvanc to see if my fix that passes all tests including regressions for this is in fact sound and correct. |
i was close, but, not quite there. i had the implementation "not quite right from a theory perspective". when i have time, i'll get the 3 regressions from this issue in place and open a PR to close then and then we can do a release. |
Last November, Gordon identified that the compiler was allowing code to recover a `val` from a `box` field. This is unsafe and very "doh". After investigation, it was determined that this bug has existed since Sylvan introduced viewpoint adaptation to the compiler almost a decade ago. I came up with a fix, but after talking with Sylvan, we changed to this fix as it is the "proper pure theory fix". Fixes #4244
Last November, Gordon identified that the compiler was allowing code to recover a `val` from a `box` field. This is unsafe and very "doh". After investigation, it was determined that this bug has existed since Sylvan introduced viewpoint adaptation to the compiler almost a decade ago. I came up with a fix, but after talking with Sylvan, we changed to this fix as it is the "proper pure theory fix". Fixes #4244
In the following code
The
get_s()
function should not compile, as recovering a val from a box is a leak in the type system.The text was updated successfully, but these errors were encountered: