Affects Version/s: Scala 2.9.3, Scala 2.10.2, Scala 2.11.0-M6
Fix Version/s: Scala 2.11.0-M8
The comment in CleanUp says:
This transformation should identify Scala symbol
invocations in the tree and replace them with
references to a static member. Also, whenever
a class has at least a single symbol invocation
somewhere in its methods, a new static member
should be created and initialized for that symbol.
The reasoning behind this transformation is the
following. Symbols get interned - they are stored
in a global map which is protected with a lock.
The reason for this is making equality checks
quicker. But calling Symbol.apply, although it
does return a unique symbol, accesses a locked
object, making symbol access slow. To solve this,
the unique symbol from the global symbol map
in Symbol is accessed only once during class
loading, and after that, the unique symbol is in
the static member. Hence, it is cheap to both
reach the unique symbol and do equality
checks on it.
It seems like this transformation was never executed because the pattern did never match, and if it had, it would have broken horribly due bugs in the implementation.