-
-
Notifications
You must be signed in to change notification settings - Fork 670
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 LUB computation for class types #2594
Conversation
Seems to be the same breakage as previously seen in #2575. Only happens on bootstrap:release and in CI. |
Last log is interesting in that its output looks a lot like memory corruption. Something is missing, though, given that the problem cannot be reproduced locally. Things I've seen in the past were differences in line endings leading to subtly different compilation and GH actions runners running out of memory and instead of exiting showing undefined behavior. |
Looking at the bootstrapped artifact (js to wasm, step 1), it's identical to what I have locally. Narrows it down to how the artifact is invoked / used. |
In fact becomes reproducible locally when replacing |
Slightly better stacktrace (preserving debug info even though optimizing):
|
What if you revert #2586? |
Reverted locally to check, doesn't make a difference. |
Greetings from Rtrace
|
In a different setup (main branch), the first Rtrace error happens in Interestingly, temporarily assigning |
In other words, the initial compiler is bugged, not the bootstrapped one. |
Looks like it, with the issue only materializing in the Wasm variant when the stars align. The surprise "fix" I've employed just to work around the issue, in the particular setup above, is this change in // Combine all alternatives that merge again with outer flow
if (possiblyBreaks || (isLast && possiblyFallsThrough)) {
if (breakingFlowAlternatives) breakingFlowAlternatives.inheritAlternatives(breakingFlowAlternatives, innerFlow);
else {
breakingFlowAlternatives = innerFlow;
Compiler.breakingFlowAlternatives = breakingFlowAlternatives; // HERE
}
// Otherwise just merge the effects of a non-merging branch
} else if (!possiblyFallsThrough) {
outerFlow.mergeSideEffects(innerFlow);
} with a |
Just tried with #2596, and indeed that mitigates the issue. |
Addresses #2407. Previously, the LHS type was used to determine the resulting type of binary / ternary expressions. This is plausible for basic numeric types, but not so much for classes. Hence, computation of the common type now tries whether LHS and RHS map to the contextual type first, and if not (or there is none) computes the least upper bound of the two class types.
For example, in
the least upper bound when mixing types
A
,B
and orC
isA
, which is used if there isn't a more suitable contextual type. For example, inif contextual type is
I
, andB
andC
are mixed, the result remainsI
(both are assignable) instead ofA
(the LUB).