-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Move to error case classes (Friday) #2484
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
Move to error case classes (Friday) #2484
Conversation
Main effort was to move to error case classes, some more explanations could be needed.All error changed scenarios are covered in ErrorMessagesTests.
😆 Alright! |
case class AbstractMemberMayNotHaveModifier(sym: Symbol, flag: FlagSet)( | ||
implicit ctx: Context) | ||
extends Message(AbstractMemberMayNotHaveModifierID) { | ||
val msg = hl"""abstract $sym may not have `$flag' modifier""" |
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've been hl"""${"abstract"} $sym..."""
extends Message(TraitsMayNotBeFinalID) { | ||
val msg = hl"""$sym may not be ${"final"}""" | ||
val kind = "Syntax" | ||
val explanation = "A trait can never be final." |
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.
~"...because you cant instantiate it since it is abstract by nature" or something?
extends Message(CannotExtendAnyValID) { | ||
val msg = hl"""$sym cannot extend ${"AnyVal"}""" | ||
val kind = "Syntax" | ||
val explanation = "" |
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.
Is there something we can say here in explanation
? I know you wanted to just get everything over to the new format first - but can't help myself 😆
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.
"Traits do not support extending AnyVal" ?
"AnyVal instances must be representable in a single value, which excludes usage of traits"?
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 leave it up to your discretion :)
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.
If someone tries to make a trait extending AnyVal, they should be told about universal traits (traits extending Any): http://docs.scala-lang.org/overviews/core/value-classes.html
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 leads to the question how we'd support adding relevant links to Message
s. Links to the lang specs will be helpful in many cases, Stackoverflow might be good, too.
But links do not always age well.
Main effort was to move to error case classes in
Checking.scala
, some more explanations could be beneficial.All changed scenarios are covered in ErrorMessagesTests.
DoesNotConformToSelfTypeCantBeInstantiated
used to be without source position, don't know why.@felixmulder I warned you ;-)