Skip to content

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Mar 23, 2022

Fixes #14760

@odersky odersky requested a review from Linyxus March 23, 2022 16:57
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)
Copy link
Member

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 :).

Suggested change
val hi1 = stripParams(tp.hi, todos, isUpper).orElse(tp.kind)
val hi1 = stripParams(tp.hi, todos, isUpper).orElse(tp.topType)

Copy link
Contributor Author

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.
Copy link
Contributor

@Linyxus Linyxus left a 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!


/** 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.
Copy link
Member

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.

@odersky odersky merged commit 54dc0c1 into scala:main Mar 24, 2022
@odersky odersky deleted the fix-14760 branch March 24, 2022 08:06
@Kordyjan Kordyjan added this to the 3.1.3 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.

Unexpected error message when typing wildcard parameters in pattern

4 participants