Skip to content
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

Recoginze forgotten "def" in auxiliary constructor and provide better error message #4878

Closed
scabug opened this issue Aug 6, 2011 · 3 comments

Comments

@scabug
Copy link

scabug commented Aug 6, 2011

Don't know if this qualifies as opaque enough, and I also don't know if there is something you can do about it. Anyway, sometimes I forget the "def" when writing an auxiliary constructor:

scala> class Eg(name: String) {
     |  this() = this("DEFAULT")
     | }
<console>:8: error: value update is not a member of Eg
        this() = this("DEFAULT")
        ^

(I now immediately recognise the problem and simply add the missing "def", but the first few times, I found the error message a tiny bit cryptic.)

/////////////////////////////////////////

Created from nikolaj lindberg comment on https://issues.scala-lang.org/browse/SI-3092?focusedCommentId=48911&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-48911

@scabug
Copy link
Author

scabug commented Aug 6, 2011

Imported From: https://issues.scala-lang.org/browse/SI-4878?orig=1
Reporter: @soc
See #4876

@scabug
Copy link
Author

scabug commented Jun 11, 2012

@adriaanm said:
Jason, more error message improvements -- feel free to load balance with e.g., Hubert, or re-assign to reviewer.

@scabug
Copy link
Author

scabug commented Jun 17, 2012

@retronym said:
That is potentially legal code. I don't see an easy way to help out for this one.

scala> class A(a: Int) { this() = this(0); def update(i: Any) {}; def apply(a: Int) = ()}
defined class A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants