summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Analyzer.scala
diff options
context:
space:
mode:
authorSimon Ochsenreither <simon@ochsenreither.de>2013-07-01 21:20:05 +0200
committerSimon Ochsenreither <simon@ochsenreither.de>2013-07-06 12:22:13 +0200
commit415dda408d6bee761a6249a4a9578e6f50527a83 (patch)
tree5284f2fb7fe51ce912f89a6e40fac38afd61cb4f /src/compiler/scala/tools/nsc/typechecker/Analyzer.scala
parente2c173673f4068babde8e927a5d951e260b2942d (diff)
downloadscala-415dda408d6bee761a6249a4a9578e6f50527a83.tar.gz
scala-415dda408d6bee761a6249a4a9578e6f50527a83.tar.bz2
scala-415dda408d6bee761a6249a4a9578e6f50527a83.zip
SI-7174 Fix initialization issues
Without constant inlining, the compiler would not even bootstrap because it depends on constant inlining hiding initialization issues which would cause a NPE otherwise. In this case, global is null at runtime, but no NPE is happening despite accessing members of global (see SubComponent), because constant inlining has copied the values of those members to the call-sites and eliminated the dereference of global. This commit fixes the initialization order.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Analyzer.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Analyzer.scala11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Analyzer.scala b/src/compiler/scala/tools/nsc/typechecker/Analyzer.scala
index 02e1eb6f00..5c02516c47 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Analyzer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Analyzer.scala
@@ -29,8 +29,9 @@ trait Analyzer extends AnyRef
val global : Global
import global._
- object namerFactory extends SubComponent {
+ object namerFactory extends {
val global: Analyzer.this.global.type = Analyzer.this.global
+ } with SubComponent {
val phaseName = "namer"
val runsAfter = List[String]("parser")
val runsRightAfter = None
@@ -44,8 +45,9 @@ trait Analyzer extends AnyRef
}
}
- object packageObjects extends SubComponent {
+ object packageObjects extends {
val global: Analyzer.this.global.type = Analyzer.this.global
+ } with SubComponent {
val phaseName = "packageobjects"
val runsAfter = List[String]()
val runsRightAfter= Some("namer")
@@ -71,9 +73,10 @@ trait Analyzer extends AnyRef
}
}
- object typerFactory extends SubComponent {
- import scala.reflect.internal.TypesStats.typerNanos
+ object typerFactory extends {
val global: Analyzer.this.global.type = Analyzer.this.global
+ } with SubComponent {
+ import scala.reflect.internal.TypesStats.typerNanos
val phaseName = "typer"
val runsAfter = List[String]()
val runsRightAfter = Some("packageobjects")