-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix Missing error message on FailureToEliminateExistential #3296
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
Fix Missing error message on FailureToEliminateExistential #3296
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.
Hello, and thank you for opening this PR! 🎉
All contributors have signed the CLA, thank you! ❤️
Have an awesome day! ☀️
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.
Could you rebase and add a test case?
@@ -1778,4 +1778,15 @@ object messages { | |||
hl"""A class marked with the ${"final"} keyword cannot be extended""" | |||
} | |||
|
|||
case class FailureToEliminateExistential(tp: Types.Type, tp1: Types.Type, tp2: Types.Type, boundSyms: List[Symbols.Symbol])(implicit ctx: Context) | |||
extends Message(FailureToEliminateExistentialID) { | |||
val kind = "Syntax" |
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.
This isn't a syntax related message. Maybe: Compatibility
@@ -1778,4 +1778,15 @@ object messages { | |||
hl"""A class marked with the ${"final"} keyword cannot be extended""" | |||
} | |||
|
|||
case class FailureToEliminateExistential(tp: Types.Type, tp1: Types.Type, tp2: Types.Type, boundSyms: List[Symbols.Symbol])(implicit ctx: Context) |
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.
Simply use Type
instead of Types.Type
and Symbol
instead of Symbols.Symbol
case class FailureToEliminateExistential(tp: Types.Type, tp1: Types.Type, tp2: Types.Type, boundSyms: List[Symbols.Symbol])(implicit ctx: Context) | ||
extends Message(FailureToEliminateExistentialID) { | ||
val kind = "Syntax" | ||
val msg = hl"failure to eliminate existential" |
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.
hl"Failure to eliminate existential type. Proceed at own risk."
hl"""original type : $tp forSome {${ctx.dclsText(boundSyms, "; ").show} | ||
|reduces to : $tp1 | ||
|type used instead: $tp2 | ||
|proceed at own risk. |
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 think this is better as part of the msg
val kind = "Syntax" | ||
val msg = hl"failure to eliminate existential" | ||
val explanation = | ||
hl"""original type : $tp forSome {${ctx.dclsText(boundSyms, "; ").show} |
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 would extract original type in order to fully syntax highlight it:
val explanation = {
val originalTpe = s"$tp forSome {${ctx.dclsText(boundSyms, "; ").show}"
hl"""original type : $originalTpe
...
}
Thanks for code review @allanrenucci, i'll rebase and fix the issuses later this week |
64e1866
to
d7d4f21
Compare
Hey @allanrenucci can you lend me a hand with writing the test as such? I was moving through the documentation but I could find the documented case when such warning should appear. Any help with this would be very welcome |
@smarter I looked at our test suite and I can't find any test that exercises this warning. Could you give us an example? |
You'll need to compile some code with scalac (or find some existing code) that uses an existential type that cannot be expressed with wildcards, e.g. |
thanks @allanrenucci ! |
One step forward with #1589