summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Macros.scala
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-06-07 22:05:34 +0200
committerEugene Burmako <xeno.by@gmail.com>2012-06-08 15:34:26 +0200
commit5acac4d806eb45afdf1e7716c727a97130b69651 (patch)
treef37a3fcaf44699d4c0272ffdacdf7929424bc784 /src/compiler/scala/tools/nsc/typechecker/Macros.scala
parentbc5f42f51982eb473075bbd2f474a5d628813031 (diff)
downloadscala-5acac4d806eb45afdf1e7716c727a97130b69651.tar.gz
scala-5acac4d806eb45afdf1e7716c727a97130b69651.tar.bz2
scala-5acac4d806eb45afdf1e7716c727a97130b69651.zip
TypeTag => AbsTypeTag, ConcreteTypeTag => TypeTag
This protects everyone from the confusion caused by stuff like this: https://issues.scala-lang.org/browse/SI-5884
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Macros.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Macros.scala13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Macros.scala b/src/compiler/scala/tools/nsc/typechecker/Macros.scala
index 7b55ea6c72..ec14476d1a 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Macros.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Macros.scala
@@ -104,7 +104,7 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces {
RepeatedParamClass.typeConstructor,
List(implType(isType, sigma(origTpe.typeArgs.head))))
else {
- val tsym = getMember(MacroContextClass, if (isType) tpnme.TypeTag else tpnme.Expr)
+ val tsym = getMember(MacroContextClass, if (isType) tpnme.AbsTypeTag else tpnme.Expr)
typeRef(singleType(NoPrefix, ctxParam), tsym, List(sigma(origTpe)))
}
val paramCache = collection.mutable.Map[Symbol, Symbol]()
@@ -155,7 +155,7 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces {
case TypeRef(SingleType(NoPrefix, contextParam), sym, List(tparam)) =>
var wannabe = sym
while (wannabe.isAliasType) wannabe = wannabe.info.typeSymbol
- if (wannabe != definitions.TypeTagClass && wannabe != definitions.ConcreteTypeTagClass)
+ if (wannabe != definitions.AbsTypeTagClass && wannabe != definitions.TypeTagClass)
List(param)
else
transform(param, tparam.typeSymbol) map (_ :: Nil) getOrElse Nil
@@ -200,6 +200,7 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces {
implicit class AugmentedString(s: String) {
def abbreviateCoreAliases: String = { // hack!
var result = s
+ result = result.replace("c.universe.AbsTypeTag", "c.AbsTypeTag")
result = result.replace("c.universe.TypeTag", "c.TypeTag")
result = result.replace("c.universe.Expr", "c.Expr")
result
@@ -884,17 +885,17 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces {
macroLogVerbose("resolved tparam %s as %s".format(tparam, tpe))
resolved(tparam) = tpe
param.tpe.typeSymbol match {
- case definitions.TypeTagClass =>
+ case definitions.AbsTypeTagClass =>
// do nothing
- case definitions.ConcreteTypeTagClass =>
- if (!tpe.isConcrete) context.abort(context.enclosingPosition, "cannot create ConcreteTypeTag from a type %s having unresolved type parameters".format(tpe))
+ case definitions.TypeTagClass =>
+ if (!tpe.isConcrete) context.abort(context.enclosingPosition, "cannot create TypeTag from a type %s having unresolved type parameters".format(tpe))
// otherwise do nothing
case _ =>
throw new Error("unsupported tpe: " + tpe)
}
Some(tparam)
})
- val tags = paramss.last takeWhile (_.isType) map (resolved(_)) map (tpe => if (tpe.isConcrete) context.ConcreteTypeTag(tpe) else context.TypeTag(tpe))
+ val tags = paramss.last takeWhile (_.isType) map (resolved(_)) map (tpe => if (tpe.isConcrete) context.TypeTag(tpe) else context.AbsTypeTag(tpe))
if (paramss.lastOption map (params => !params.isEmpty && params.forall(_.isType)) getOrElse false) argss = argss :+ Nil
argss = argss.dropRight(1) :+ (tags ++ argss.last) // todo. add support for context bounds in argss