-
Notifications
You must be signed in to change notification settings - Fork 1.1k
#1589: add dedicated error message for missing companion for static members #3530
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
checkMessagesAfter("checkStatic") { | ||
""" | ||
|object Foo { | ||
| @annotation.static def bar(): Unit = 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.
def bar(): Unit = ()
assertEquals(member.show, "method bar") | ||
} | ||
|
||
@Test def notMissingCompanionForStatic = |
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.
You can remote this test. Here we only test the content of error messages.
We already have tests for correct and incorrect programs: tests/run/statics.scala
, tests/neg/static-no-companion.scala
val msg = hl"${member.owner} does not have a companion class" | ||
val kind = "Syntax" | ||
val explanation = | ||
hl"object that contains @static members must have a companion class." |
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"Object that contain ${"@static"} members must have a companion class."
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 propose a slight change:
hl"An object that contains ${"@static"} members must have a companion class."
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
8746fdb
to
f3ffd52
Compare
Can you rebase? |
f3ffd52
to
46e1aad
Compare
Of course. |
Thanks @esarbe! |
No description provided.