Skip to content

Improve handling of disjunctions when comparing types #11083

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

Merged
merged 3 commits into from
Jan 18, 2021

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jan 13, 2021

There were two problems in a comparison

A | B <: C
  1. If the LHS was a.type | Nothing, atoms computation
    did not correctly account for Nothing.

  2. For other comparisons, the preliminary widen test was
    not done under a frozen constraint, and therefore cut
    off solutions. This caused a problem for the
    summon[(1 | Nothing) <:< 1] comparison even once (1)
    was fixed.

Fixes #11003
But #10897 is not solved by this.

There were two problems in a comparison

    A | B <: C

 1. If the LHS was `a.type | Nothing`, atoms computation
    did not correctly account for Nothing.

 2. For other comparisons, the preliminary widen test was
    not done under a frozen constraint, and therefore cut
    off solutions. This caused a problem for the
    `summon[(1 | Nothing) <:< 1]` comparison even once (1)
    was fixed.
@odersky
Copy link
Contributor Author

odersky commented Jan 13, 2021

@abgruszecki It would be good to go over every occurrence of inFrozenGADT and reason whether or not it should be inFrozenConstraint as well. And vice versa. We seem to have too much independent development between the two.

Copy link
Contributor

@abgruszecki abgruszecki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR looks good to me. I'll be taking a look at when we freeze GADT constraint during the semester (maybe sooner if I'll feel the urge to do so), I definitely agree that we should understand that part of GADT logic better.

@abgruszecki abgruszecki merged commit 67835c3 into scala:master Jan 18, 2021
@abgruszecki abgruszecki deleted the fix-#11003 branch January 18, 2021 16:36
@abgruszecki abgruszecki restored the fix-#11003 branch January 18, 2021 16:36
@abgruszecki abgruszecki deleted the fix-#11003 branch January 18, 2021 16:36
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
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.

Inconsistent comparison of types involving unions of singleton types with Nothing
3 participants