Closed scabug closed 13 years ago
Imported From: https://issues.scala-lang.org/browse/SI-4426?orig=1 Reporter: @TiarkRompf
@paulp said: Here's a somewhat narrowed reproduction which doesn't use the repl. The call to super.computePluginPhases() is necessary for the crash.
import scala.tools.nsc._
object Test {
val x = {
object cc extends Global(new Settings()) {
// object dummy //<-- uncomment to make the error go away
object sbtAnalyzer { }
override def computePluginPhases() = {
super.computePluginPhases()
assert(sbtAnalyzer ne null, "FAIL!")
}
}
println(new cc.Run)
}
def main(args: Array[String]): Unit = {
}
}
@paulp said: See also #4432.
@paulp said: Of unknown relevance, but note this comment I placed at some distantly remembered time in computePluginPhases.
lazy val plugins: List[Plugin] = loadPlugins
// ...
protected def computePluginPhases(): Unit = {
// For reasons not yet apparent to me, plugins started appearing
// as null when I added phaseTimings to global.
if (plugins != null)
phasesSet ++= (plugins flatMap (_.components))
}
Since plugins is a lazy val it probably shouldn't be appearing as null. Also note that if I override a different randomly chosen method in similar fashion, it doesn't crash. So this manifestation of the issue may depend on what exactly this method is doing.
@odersky said: Looks like this one is a release blocker.
@hubertp said: Replying to [comment:7 extempore]:
Of unknown relevance, but note this comment I placed at some distantly remembered time in computePluginPhases. {code} lazy val plugins: List[Plugin] = loadPlugins // ... protected def computePluginPhases(): Unit = { // For reasons not yet apparent to me, plugins started appearing // as null when I added phaseTimings to global. if (plugins != null) phasesSet ++= (plugins flatMap (_.components)) } }} Since plugins is a lazy val it probably shouldn't be appearing as null. Also note that if I override a different randomly chosen method in similar fashion, it doesn't crash. So this manifestation of the issue may depend on what exactly this method is doing.
And actually phaseTimings are the real culprit (I mean the private thing is essential) as it messes up the numbering for bitmaps. Should be easy to fix now.
@hubertp said: (In a3b106bf60) closes #4426. name mangling for private lazy vals that are lifted during explicitouter is now taken into account. this also handles lazy vals/objects inside anonymous classes. review by dragos.
@hubertp said: (In 6c1feb586b) remove now redundant check (see #4426). review by extempore
Sbt doesn't load compiler plugins when using 2.9 RC1 (used to work fine with 2.8). I've narrowed it down a bit and it seems like there's an underlying error in scalac that has to do with nested objects not being initialized correctly. The weird thing about it is that it happens only to the first nested object. In the repl script below, uncommenting the dummy object makes the error go away.
=== What steps will reproduce the problem (please be specific and use wikiformatting)? ===
=== What is the expected behavior? ===
object sbtAnalyzer should be initialized (lazily), no matter whether it is syntactically the first nested object or not.
=== What do you see instead? ===
sbtAnalyzer is null. If there is another object declaration before sbtAnalyzer, it is initialized correctly.
=== What versions of the following are you using? ===