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

Invisible forward reference when using default argument with case class #4036

Closed
scabug opened this issue Nov 26, 2010 · 3 comments
Closed
Assignees

Comments

@scabug
Copy link

scabug commented Nov 26, 2010

Compiling this code

object Error {
  def f {
    case class X(b: Boolean = false)
    val x = X()
  }
}

with scalac 2.8.1.final yields:

Error.scala:4: error: forward reference extends over definition of value x
    val x = X()
            ^
one error found

This seems similar to ticket #2489, but this has been fixed and the code from that ticket compiles without errors.

Versions

  • Scala:
$$ scalac -version
Scala compiler version 2.8.1.final -- Copyright 2002-2010, LAMP/EPFL
  • Java:
$$ java -version
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02-279-10M3065)
Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01-279, mixed mode)
  • Operating system: Mac OS X 10.6.4 Build 10F569
$$ uname -a
Darwin john.doe.com 10.4.0 Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT 2010; root:xnu-1504.7.4~1/RELEASE_I386 i386
@scabug
Copy link
Author

scabug commented Nov 26, 2010

Imported From: https://issues.scala-lang.org/browse/SI-4036?orig=1
Reporter: Martin Gamwell Dawids (mgd)

@scabug
Copy link
Author

scabug commented Nov 30, 2010

@adriaanm said:
this seems to be related to the default getter, as this compiles:

object Error {
  def f {
    case class X(b: Boolean)
    val x = X(true)
  }
}

@scabug
Copy link
Author

scabug commented Dec 3, 2010

@lrytz said:
(In e1a0866ce7) close #4036, fix #2489. synthetic members (companion objects, default getters) are emitted next to their correspondant. review by extempore.

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

No branches or pull requests

2 participants