-
-
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
Add workaround for compiler assertion failure in Promise.flatten_next #3991
Conversation
I'm not a big fan of this workaround. I'd rather find the root cause of this. Who knows what weirdness might come from this workaround. Will existing working flatten code of which there is a lot in the not yet published GitHub Rest API stop working? No idea. The workaround worries me on the correctness front. It works for this case, but does it break others? To accept the workaround, I would want us to have more working test cases, how to do that and have it model the real world code we came up with this feature to address, I'm not sure. |
@mfelsche can you rebase this against |
The actual issue is that the replaced lambda inside an object literal wasn't correctly reified and somehow survived until the reachability and thus a TypeParamRef showed up when collecting reachable types.
13f1305
to
d10616e
Compare
The workaround applied here is doing the exact same thing as it did before this PR. It is just that the compiler doesn't need to create a hygienic type for the lambda and thus the reification works as it should and we avoid the error case. I do agree that this workaround shouldn't be the last action to take solving this bug. But it is definitely an improvement over the current situation imho |
How is it the exact same thing it did before this PR? It's a change. That sounds different to me. |
Could you please look at what the lambda is returning and what the apply method of |
@@ -0,0 +1 @@ | |||
0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is redundant. You can remove it.
packages/promises/promise.pony
Outdated
|
||
class iso _PendingFulFill[A: Any #share, B: Any #share] is Fulfill[A, Promise[B]] | ||
""" | ||
Fulfill returning a promise that is never fulfilled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment doesn't make sense to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In particular
"Fulfill returning a promise" <-- ok we are fulfilling
"that is never fulfilled" <-- that we aren't fulfilling
which sounds like an internal contradiction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, the comment stems from a misunderstanding.
So we agree the error in question shouldn't be happening. If this is exactly equivalent then this would fix nothing. It does however fix something and there's no evidence at this time that it doesn't break anything in an odd fashion. I have a bunch of code that used flatten and there's no way from purely this PR to know it doesn't break that code. If this was exactly equivalent, it wouldn't fix the bug. I'm not comfortable with this change without verifying that the existing usage doesn't break. Can you build ponyc with this and run all the github_rest_api examples and verify they work? That would give me assurance that the existing code that I am using on a regular basis to works and isn't broken by this change. Without that I have no idea that with this change that given by working inputs, that they won't stop working because of this change. It's a different code path. If compiler was equivalent before and after this change then the sample from the issue would continue to fail. It doesn't so, at some level, this change is a change and not equivalent. It's not referentially transparent and if it isn't referentially transparent that means that existing code which we believe is correct could break given this takes existing code that we believe is correct and fixes it. The reverse is possible. Running all the existing github_rest_api example code through this change would give me the assurance that I am currently lacking. |
@mfelsche can you take your build of this on your machine and use it to do |
d10616e
to
454d45b
Compare
454d45b
to
0b584fc
Compare
The github_rest_api tests all worked. Also checked the examples on |
@mfelsche that's good to hear. can you open a new issue for the reification problem with how to reproduce (changes to stdlib etc) so we can have that for something that we can look into in the future then this can be merged and we can close the original issue. |
Hi @mfelsche, The changelog - fixed label was added to this pull request; all PRs with a changelog label need to have release notes included as part of the PR. If you haven't added release notes already, please do. Release notes are added by creating a uniquely named file in the The basic format of the release notes (using markdown) should be:
Thanks. |
Issue #4014 has been created. This can be merged once release notes are added. |
This fixes #3856 with only a workaround and explicitly without actually solving the underlying issue, but hey, it's something.
Somehow the replaced lambda, or to be exact, the hygienic type created for it, wasn't properly reified and remained as a generic type. The hygienic type generates was:
which seems correct, but this is the type that failed the reachability, namely the part where the methods from the interface
Fulfill
have been applied to the type: