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

Generate kind-correct wildcards when selecting from a wildcard #17025

Merged
merged 1 commit into from
Mar 1, 2023

Conversation

smarter
Copy link
Member

@smarter smarter commented Feb 28, 2023

Previously, derivedSelect would incorrectly approximate fn.R by ? >: Nothing <: Any in i16997.min.scala, which subsequently lead to a kind-incorrect type application Any[Y] that broke type inference. #16999 proposed to fix this by changing type inference, but it seems like we don't need to do that if we make sure our wildcards are always kind-correct.

Note that the wildcard logic in lookupRefined could be removed: it seems like it was supposed to be used by reduceProjection according to its documentation, but the constructor of NamedType disallows wildcards as prefixes so it didn't actually do anything there.

Co-Authored-By: Dale Wijnand dale.wijnand@gmail.com

Previously, derivedSelect would incorrectly approximate `fn.R` by `? >: Nothing
<: Any` in `i16997.min.scala`, which subsequently lead to a kind-incorrect
type application `Any[Y]` that broke type inference. scala#16999 proposed to fix this
by changing type inference, but it seems like we don't need to do that if we
make sure our wildcards are always kind-correct.

Note that the wildcard logic in lookupRefined could be removed: it seems like
it was supposed to be used by `reduceProjection` according to its documentation,
but the constructor of `NamedType` disallows wildcards as prefixes so it didn't
actually do anything there.

Co-Authored-By: Dale Wijnand <dale.wijnand@gmail.com>
Copy link
Member

@dwijnand dwijnand left a comment

Choose a reason for hiding this comment

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

Thanks!

@dwijnand dwijnand merged commit 0df5ae2 into scala:main Mar 1, 2023
@dwijnand dwijnand deleted the fix-i16999-alt branch March 1, 2023 11:26
@Kordyjan Kordyjan added this to the 3.3.1 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
3 participants