-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Keep correct kind when preparing constraint in stripParams #14761
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
Conversation
@@ -248,7 +248,7 @@ class OrderingConstraint(private val boundsMap: ParamBounds, | |||
NoType | |||
case tp: TypeBounds => | |||
val lo1 = stripParams(tp.lo, todos, !isUpper).orElse(defn.NothingType) | |||
val hi1 = stripParams(tp.hi, todos, isUpper).orElse(defn.AnyKindType) | |||
val hi1 = stripParams(tp.hi, todos, isUpper).orElse(tp.kind) |
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.
You should be able to use TypeApplications#topType
instead which I needed for the same reason :).
val hi1 = stripParams(tp.hi, todos, isUpper).orElse(tp.kind) | |
val hi1 = stripParams(tp.hi, todos, isUpper).orElse(tp.topType) |
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.
Ah, thanks! I had not remembered that.
topType already does what we need here, and it is also correct for classes.
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.
Thanks for checking the issue. LGTM!
@@ -229,7 +229,11 @@ class TypeApplications(val self: Type) extends AnyVal { | |||
(alias ne self) && alias.hasSimpleKind | |||
} | |||
|
|||
/** The top type with the same kind as `self`. */ | |||
/** The top type with the same kind as `self`. This is largest type capturing | |||
* the parameter shape of a type without looking at precise bounds. |
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.
In fact, topType does keep around precise bounds (e.g., [X <: Int] =>> Any
), though it could be tweaked to map the bounds themselves to topType if needed.
Fixes #14760