Skip to content

Conversation

@WojciechMazur
Copy link
Contributor

Backports #21241 to the 3.5.2 branch.

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]
Base automatically changed from 3.5.x-21232 to 3.5.x August 27, 2024 22:08
@WojciechMazur WojciechMazur merged commit 9de63ca into 3.5.x Aug 27, 2024
@WojciechMazur WojciechMazur deleted the 3.5.x-21241 branch August 27, 2024 22:08
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.

3 participants