-
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
Print the type parameter bounds of higher kinded types #13372
Conversation
Co-authored-by: Jamie Thompson <jamie.thompson@bath.edu> Co-authored-by: Meriam Lachkar <meriam.lachkar@gmail.com>
This PR changes the error reporting of unchecked type bounds as in object test2:
class FunctorImpl[Generic1[T] <: Iterable[T]]{}
class HKT3_1[Functor[Generic2[T<:String]<:Set[T]]]{}
var h = new HKT3_1[FunctorImpl](); // error // error [E057] Type Mismatch Error: tests/neg-custom-args/i11637.scala:11:21 ------------------------------------------------
11 | var h = new HKT3_1[FunctorImpl](); // error // error
| ^
- | Type argument test2.FunctorImpl does not conform to upper bound [Generic2[T] <: Set[T]] =>> Any
+ | Type argument test2.FunctorImpl does not conform to upper bound [Generic2[T <: String] <: Set[T]] =>> Any I updated the check file because the new message looks more accurate. |
final module class Exports() extends Object() { this: example.Exports.type => | ||
val instance: example.MembersContainer = new example.MembersContainer() | ||
export example.Exports.instance.* | ||
final type MyType[T <: example.MyClass] = Comparable[T] |
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.
i noticed the lower bound does not print either, implying it's Nothing
, however it is still inconsistent with how a TypeBoundsTree
is printed - if you look at the original MyType
- but that would lead to very verbose error messages I think.
One solution could be some print mode parameter which knows if we are printing "full trees" or just the type, which could allow you to decide when to always print the lower bound
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.
Looks good to me.
Fix #13306
When the exported type is a higher-kinded type, we print the bounds of its type parameters.
Co-authored by @bishabosha
Co-authored by @mlachkar