summaryrefslogtreecommitdiff
path: root/src/interactive
diff options
context:
space:
mode:
authorDen Shabalin <den.shabalin@gmail.com>2013-12-06 18:01:05 +0100
committerDen Shabalin <den.shabalin@gmail.com>2013-12-12 15:49:16 +0100
commit760df9843a910d6c3618e490c752eb03fb6924bd (patch)
tree0ae30fa878ea53812dcd58f1acbab342e562d698 /src/interactive
parentb345b42cac64aa97e3bbcc6f14ef8f08214ab56f (diff)
downloadscala-760df9843a910d6c3618e490c752eb03fb6924bd.tar.gz
scala-760df9843a910d6c3618e490c752eb03fb6924bd.tar.bz2
scala-760df9843a910d6c3618e490c752eb03fb6924bd.zip
SI-8030 force symbols on presentation compiler initialization
This commit forces a number of built-in symbols in presentation compiler to prevent them from being entered during parsing. The property “parsing doesn’t enter new symbols” is tested on a rich source file that contains significant number of variations of Scala syntax.
Diffstat (limited to 'src/interactive')
-rw-r--r--src/interactive/scala/tools/nsc/interactive/Global.scala12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/interactive/scala/tools/nsc/interactive/Global.scala b/src/interactive/scala/tools/nsc/interactive/Global.scala
index 467a210cab..cab5137a87 100644
--- a/src/interactive/scala/tools/nsc/interactive/Global.scala
+++ b/src/interactive/scala/tools/nsc/interactive/Global.scala
@@ -1234,6 +1234,18 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "")
}
}
+ // We need to force a number of symbols that might be touched by a parser.
+ // Otherwise thread safety property of parseTree method would be violated.
+ protected def forceSymbolsUsedByParser(): Unit = {
+ val symbols =
+ Set(UnitClass, BooleanClass, ByteClass,
+ ShortClass, IntClass, LongClass, FloatClass,
+ DoubleClass, NilModule, ListClass) ++ TupleClass.seq
+ symbols.foreach(_.initialize)
+ }
+
+ forceSymbolsUsedByParser()
+
/** The compiler has been initialized. Constructors are evaluated in textual order,
* so this is set to true only after all super constructors and the primary constructor
* have been executed.