summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/transform/TypingTransformers.scala
diff options
context:
space:
mode:
authorIulian Dragos <jaguarul@gmail.com>2010-06-09 15:49:53 +0000
committerIulian Dragos <jaguarul@gmail.com>2010-06-09 15:49:53 +0000
commitf8429e2fcd23ebfdb67203e86cf6002445c77a63 (patch)
treea78b797507da749fb26d800c200719037ef5fb8d /src/compiler/scala/tools/nsc/transform/TypingTransformers.scala
parent0f5d5c58ec964d8769e0d538efe5e4d14563fd0a (diff)
downloadscala-f8429e2fcd23ebfdb67203e86cf6002445c77a63.tar.gz
scala-f8429e2fcd23ebfdb67203e86cf6002445c77a63.tar.bz2
scala-f8429e2fcd23ebfdb67203e86cf6002445c77a63.zip
Make local lazy values thread-safe.
is now guaranteed to be initialized at most once, even when accessed from different threads. Closes #3007, review by odersky.
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/TypingTransformers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/transform/TypingTransformers.scala7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/TypingTransformers.scala b/src/compiler/scala/tools/nsc/transform/TypingTransformers.scala
index 8efbb356e8..6656b79d26 100644
--- a/src/compiler/scala/tools/nsc/transform/TypingTransformers.scala
+++ b/src/compiler/scala/tools/nsc/transform/TypingTransformers.scala
@@ -17,8 +17,11 @@ trait TypingTransformers {
import global._
abstract class TypingTransformer(unit: CompilationUnit) extends Transformer {
- var localTyper: analyzer.Typer = analyzer.newTyper(
- analyzer.rootContext(unit, EmptyTree, true))
+ var localTyper: analyzer.Typer =
+ if (phase.erasedTypes)
+ erasure.newTyper(erasure.rootContext(unit, EmptyTree, true)).asInstanceOf[analyzer.Typer]
+ else
+ analyzer.newTyper(analyzer.rootContext(unit, EmptyTree, true))
protected var curTree: Tree = _
protected def typedPos(pos: Position)(tree: Tree) = localTyper typed { atPos(pos)(tree) }