-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Change 'overrides nothing' to report via Message (see #1965) #1968
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
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.
Some nitpicks, but otherwise LGTM :)
|
||
assertMessageCount(1, messages) | ||
val OverridesNothing(member) :: Nil = messages | ||
assertEquals("bar", member.name.toString) |
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.
member.name.toString
=> member.name.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.
Doesn't really matter in this case, but show automatically decodes "weird" names - so let's set a good precedence 👍
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, than I reckon I should use member.name.show
in the message and explanation, as well - or does hl
do that for me?
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
should do that for you
val nonMatching = clazz.info.member(member.name).altsWith(alt => alt.owner != clazz && !alt.is(Final)) | ||
def issueError(suffix: String) = | ||
ctx.error(i"$member overrides nothing$suffix", member.pos) | ||
val nonMatching = clazz.info.member(member.name).altsWith(alt => alt.owner != clazz) |
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.
Just looking at the compressed diff here - so I can't see the reason to cut !alt.is(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.
The former error message listed only non-final methods with the same name, but I think it is useful to have even final methods in the "not eligible" list of methods so that one can easily see it as the modifiers are included.
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.
Sure, makes sense :)
// check expected context data | ||
assertEquals("bar", member.name.toString) | ||
assertEquals(3, sameName.size) | ||
assert(sameName.forall(_.symbol.name.toString == "bar"), |
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.
show
assertMessageCount(1, messages) | ||
val OverridesNothingButNameExists(member, sameName) :: Nil = messages | ||
// check expected context data | ||
assertEquals("bar", member.name.toString) |
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.
show
Regarding |
Thanks @ennru! 🎉 |
'overrides nothing' is now reported as Message as descibed in #1589 (even though it is not listed in that issue.
I took the liberty to split the error into two different messages:
Please review the explaining texts thoroughly as I'm not really sure what to call things properly.
I noticed
SingleDenotation.showDcl
creates non-valid code e.g.def foo(i: Int)Unit
without the colon. Is there a better way to print declarations in the error messages?