Skip to content
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

Backport "Fix #20897: Make Nothing ⋔ Nothing, as per spec." to LTS #22077

Merged
merged 1 commit into from
Dec 3, 2024

Conversation

WojciechMazur
Copy link
Contributor

Backports #21241 to the 3.3.5.

PR submitted by the release tooling.
[skip ci]

`derivesFrom`, used in `provablyDisjointClasses`, normally returns
`false` when the receiver is `Nothing`. However, it returns `true`
if the right-hand-side happens to be exactly `Nothing` as well.
For the purpose of computing `provablyDisjoint`, that is not what
we want.

The root issue was that we let the previous algorithm handle
`Nothing` like a class type, which it *is* in dotc but not in the
spec. That led to this mistake.

`AnyKind` suffers a similar issue, but already had special-cases in
various places to mitigate it.

Instead of adding a new special-case for `Nothing` inside
`provablyDisjointClasses`, we address the root issue. Now we deal
with `Nothing` and `AnyKind` early, before trying any of the code
paths that handle (real) class types.

[Cherry-picked b7846c4][modified]
Base automatically changed from backport-lts-3.3-21232 to lts-3.3 December 3, 2024 18:58
@WojciechMazur
Copy link
Contributor Author

No regressions detected in the community build up to backport-lts-3.3-21343.

Reference

@WojciechMazur WojciechMazur merged commit a79aa0c into lts-3.3 Dec 3, 2024
19 checks passed
@WojciechMazur WojciechMazur deleted the backport-lts-3.3-21241 branch December 3, 2024 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant