diff options
author | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2011-02-09 15:46:45 +0000 |
---|---|---|
committer | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2011-02-09 15:46:45 +0000 |
commit | 75667b88b379744d4eb33bae49c5120a54fa1f8f (patch) | |
tree | b642211382341380289aa27a8b311d08a359fbd0 | |
parent | dff00da93dd7b5a08162522a992c3ac4373d00a9 (diff) | |
download | scala-75667b88b379744d4eb33bae49c5120a54fa1f8f.tar.gz scala-75667b88b379744d4eb33bae49c5120a54fa1f8f.tar.bz2 scala-75667b88b379744d4eb33bae49c5120a54fa1f8f.zip |
Changed the dummy specialization parameter Ref ...
Changed the dummy specialization parameter Ref to AnyRef.
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/Definitions.scala | 4 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala | 15 | ||||
-rw-r--r-- | src/library/scala/AnyCompanion.scala | 15 | ||||
-rw-r--r-- | src/library/scala/AnyValCompanion.scala | 1 | ||||
-rw-r--r-- | src/library/scala/Predef.scala | 1 | ||||
-rw-r--r-- | src/library/scala/Ref.scala | 12 |
6 files changed, 22 insertions, 26 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Definitions.scala b/src/compiler/scala/tools/nsc/symtab/Definitions.scala index 99367e1de8..011b753a9d 100644 --- a/src/compiler/scala/tools/nsc/symtab/Definitions.scala +++ b/src/compiler/scala/tools/nsc/symtab/Definitions.scala @@ -50,7 +50,7 @@ trait Definitions extends reflect.generic.StandardDefinitions { tpnme.Double -> DOUBLE_TAG, tpnme.Boolean -> BOOL_TAG, tpnme.Unit -> VOID_TAG, - tpnme.Object -> CLASS_TAG + tpnme.Object -> TVAR_TAG ) private def classesMap[T](f: Name => T) = symbolsMap(ScalaValueClassesNoUnit, f) @@ -231,6 +231,7 @@ trait Definitions extends reflect.generic.StandardDefinitions { // fundamental modules lazy val PredefModule: Symbol = getModule("scala.Predef") lazy val PredefModuleClass = PredefModule.tpe.typeSymbol + def Predef_AnyRef = getMember(PredefModule, "AnyRef") // used by the specialization annotation def Predef_classOf = getMember(PredefModule, nme.classOf) def Predef_error = getMember(PredefModule, nme.error) def Predef_identity = getMember(PredefModule, nme.identity) @@ -248,7 +249,6 @@ trait Definitions extends reflect.generic.StandardDefinitions { def ensureAccessibleMethod = getMember(ScalaRunTimeModule, "ensureAccessible") def scalaRuntimeHash = getMember(ScalaRunTimeModule, "hash") def scalaRuntimeSameElements = getMember(ScalaRunTimeModule, nme.sameElements) - lazy val RefModule = getModule("scala.Ref") // classes with special meanings lazy val NotNullClass = getClass("scala.NotNull") diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala index b81750efa2..a9e34ae7fb 100644 --- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala +++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala @@ -30,13 +30,13 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { import definitions.{ RootClass, BooleanClass, UnitClass, ArrayClass, ScalaValueClasses, SpecializedClass, RepeatedParamClass, JavaRepeatedParamClass, - AnyRefClass, RefModule, ObjectClass + AnyRefClass, Predef_AnyRef, ObjectClass } private def isSpecialized(sym: Symbol) = sym hasAnnotation SpecializedClass private def isSpecializedOnAnyRef(sym: Symbol) = sym.getAnnotation(SpecializedClass) match { case Some(AnnotationInfo(_, args, _)) => - args.find(_.symbol == RefModule) match { + args.find(_.symbol == Predef_AnyRef) match { case Some(_) => true case None => false } @@ -285,7 +285,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { primitiveTypes case _ => val tpes = args map { - t => if (t.symbol == RefModule) AnyRefClass.tpe else t.symbol.companionClass.tpe + t => if (t.symbol == Predef_AnyRef) AnyRefClass.tpe else t.symbol.companionClass.tpe } log(sym + " specialized on " + tpes) tpes @@ -715,6 +715,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { * m[T, U](x: T, y: U), * m$I[ U](x: Int, y: U), * m$D[ U](x: Double, y: U) + * // etc. */ private def normalizeMember(owner: Symbol, sym: Symbol, outerEnv: TypeEnv): List[Symbol] = { if (settings.debug.value) log("normalizeMember: " + sym.fullName) @@ -1464,10 +1465,10 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { }) // replace value and type parameters of the old method with the new ones - log("Adding body for " + tree.symbol + " - origtparams: " + origtparams + "; tparams: " + tparams) - log("Type vars of: " + source + ": " + source.typeParams) - log("Type env of: " + tree.symbol + ": " + boundTvars) - log("newtparams: " + newtparams) + // log("Adding body for " + tree.symbol + " - origtparams: " + origtparams + "; tparams: " + tparams) + // log("Type vars of: " + source + ": " + source.typeParams) + // log("Type env of: " + tree.symbol + ": " + boundTvars) + // log("newtparams: " + newtparams) val symSubstituter = new ImplementationAdapter( parameters(source).flatten ::: origtparams, vparamss1.flatten.map(_.symbol) ::: newtparams, diff --git a/src/library/scala/AnyCompanion.scala b/src/library/scala/AnyCompanion.scala index 0a14ebacdb..d34e7bc461 100644 --- a/src/library/scala/AnyCompanion.scala +++ b/src/library/scala/AnyCompanion.scala @@ -1,6 +1,13 @@ -package scala - - +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2011, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ +package scala -private[scala] trait AnyCompanion { } +/** A common supertype for companion classes. + */ +private[scala] trait AnyCompanion diff --git a/src/library/scala/AnyValCompanion.scala b/src/library/scala/AnyValCompanion.scala index 3c3379de38..3ddd66c2d0 100644 --- a/src/library/scala/AnyValCompanion.scala +++ b/src/library/scala/AnyValCompanion.scala @@ -1,4 +1,3 @@ - /* __ *\ ** ________ ___ / / ___ Scala API ** ** / __/ __// _ | / / / _ | (c) 2002-2011, LAMP/EPFL ** diff --git a/src/library/scala/Predef.scala b/src/library/scala/Predef.scala index 222d5e4fd4..99953130d3 100644 --- a/src/library/scala/Predef.scala +++ b/src/library/scala/Predef.scala @@ -38,6 +38,7 @@ object Predef extends LowPriorityImplicits { type Set[A] = immutable.Set[A] val Map = immutable.Map val Set = immutable.Set + val AnyRef = new AnyCompanion {} // a dummy used by the specialization annotation // Manifest types, companions, and incantations for summoning type ClassManifest[T] = scala.reflect.ClassManifest[T] diff --git a/src/library/scala/Ref.scala b/src/library/scala/Ref.scala deleted file mode 100644 index 327b4a91f1..0000000000 --- a/src/library/scala/Ref.scala +++ /dev/null @@ -1,12 +0,0 @@ -package scala - - - - - - -object Ref extends AnyCompanion - - - - |