-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Disallow covariant cap
s in the lower bound of type members
#19624
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise LGTM
|
||
// Check the lower bound of path dependent types. | ||
// See issue #19330. | ||
val isTypeParam = t.prefix eq NoPrefix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isTypeParam
is misleading as a name. It could also be a local type definition, that also will lead to a NoPrefix
. I'd turn it around and define:
val isMember = t.prefix ne NoPrefix
Fixes #19330.
Since when instantiating a type member we do not disallow covariant
cap
s in the instance, a check is added at the application site to check for covariantcap
s in the lower bound of type members to maintain soundness. This check is elided for type parameters since their instances are always checked at the instantiation site.