diff options
author | Iulian Dragos <jaguarul@gmail.com> | 2010-09-03 15:15:29 +0000 |
---|---|---|
committer | Iulian Dragos <jaguarul@gmail.com> | 2010-09-03 15:15:29 +0000 |
commit | 9813e37ca676ef88829b0026ab304386ecf3e473 (patch) | |
tree | 4ed32ca98110843cccb5d64619563be4c4825e1e /src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala | |
parent | 3bbfd70e39bd55dc15db5098dda248cc1a7fc7c8 (diff) | |
download | scala-9813e37ca676ef88829b0026ab304386ecf3e473.tar.gz scala-9813e37ca676ef88829b0026ab304386ecf3e473.tar.bz2 scala-9813e37ca676ef88829b0026ab304386ecf3e473.zip |
Closes #3650.
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala index 4f764f6fc0..abc590fb6b 100644 --- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala +++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala @@ -30,6 +30,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { type TypeEnv = immutable.Map[Symbol, Type] def emptyEnv: TypeEnv = immutable.ListMap.empty[Symbol, Type] + import definitions.SpecializedClass object TypeEnv { /** Return a new type environment binding specialized type parameters of sym to * the given args. Expects the lists to have the same length. @@ -103,9 +104,6 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { "specialized overload " + sym + " in " + env } - /** The annotation used to mark specialized type parameters. */ - lazy val SpecializedClass = definitions.getClass("scala.specialized") - protected def newTransformer(unit: CompilationUnit): Transformer = new SpecializationTransformer(unit) @@ -871,10 +869,11 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { } else tpe) } - /** Type transformation. + /** Type transformation. It is applied to all symbols, compiled or loaded. + * If it is a 'no-specialization' run, it is applied only to loaded symbols. */ override def transformInfo(sym: Symbol, tpe: Type): Type = { - val res = tpe match { + val res = if (!settings.nospecialization.value || !currentRun.compiles(sym)) tpe match { case PolyType(targs, ClassInfoType(base, decls, clazz)) if clazz != definitions.RepeatedParamClass && clazz != definitions.JavaRepeatedParamClass @@ -898,7 +897,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { case _ => tpe - } + } else tpe res } @@ -1460,7 +1459,8 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { class SpecializationTransformer(unit: CompilationUnit) extends Transformer { log("specializing " + unit) override def transform(tree: Tree) = - atPhase(phase.next) { + if (settings.nospecialization.value) tree + else atPhase(phase.next) { val res = specializeCalls(unit).transform(tree) res } |