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

Refine AsSeenFrom approximation scheme #15957

Merged
merged 2 commits into from
Sep 4, 2022
Merged

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Sep 3, 2022

The previous scheme did not set the approximated flag in some cases, which led
to the appearance of unhelpful Nothing types in error messages.

We now always mark the AsSeenFrom map as approximated when encountering an illegal prefix at variance <= 0.
But we reset it again when a range in a prefix is dropped because we can follow a type alias or use a
singleton type info.

Furthermore, we use an Int, approxCount instead of approximated to keep track of
multiple approximation points.

Fixes #15939 in the sense that the error message now makes more sense. We still cannot find the implicit conversion; that would require a more global measure to fix the problem (such as going to ANF) or existential types.

The previous scheme did not set the approximated flag in some cases, which led
to the appearance of unhelpful Nothing types in error messages.

We now always mark the AsSeenFrom map as approximated when encountering an illegal prefix at variance <= 0.
But we reset it again when a range in a prefix is dropped because we can follow a type alias or use a
singleton type info.

Furthermore, we use an `Int`, `approxCount` instead of `approximated` to keep track of
multiple approximation points.
Copy link
Member

@smarter smarter left a comment

Choose a reason for hiding this comment

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

LGTM, that should be a lot more robust than the previous solution!

@smarter smarter merged commit ac74982 into scala:main Sep 4, 2022
@smarter smarter deleted the fix-15939 branch September 4, 2022 11:45
@Kordyjan Kordyjan added this to the 3.2.2 milestone Aug 1, 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.

Compile failure with right associative op and conversion
3 participants