scala / bug

Scala 2 bug reports only. Please, no questions — proper bug reports only.
https://scala-lang.org
232 stars 21 forks source link

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

Closed scabug closed 13 years ago

scabug commented 13 years ago

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

scabug commented 13 years ago

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

scabug commented 13 years ago

@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 commented 13 years ago

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