Skip to content

Improve error message for field accesses in secondary constructors #2631

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

Closed
biboudis opened this issue May 31, 2017 · 1 comment
Closed

Improve error message for field accesses in secondary constructors #2631

biboudis opened this issue May 31, 2017 · 1 comment

Comments

@biboudis
Copy link
Contributor

class Foo(x : Any) {
  val foo : Integer = 0

  def this() = {
    this(foo)
  }
}
-- [E006] Unbound Identifier Error: /Users/bibou/Projects/EPFL/dotty/compiler/../tests/run/tMain.scala:5:9 -------------
5 |    this(foo)
  |         ^^^
  |         not found: foo
    Compilation failed for: '../tests/run/tMain.scala'    
@Varunram
Copy link
Contributor

Varunram commented Jun 1, 2017

@biboudis Very basic question, but how would you detect whether it is indeed inside a secondary class? For example, when I run this(foo) instead of it like
def this() = { this(foo) },
it prints the same error message right? Thanks!

nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jan 11, 2018
nicolasstucki added a commit that referenced this issue Jan 23, 2018
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

3 participants