diff options
author | Josh Suereth <Joshua.Suereth@gmail.com> | 2012-08-07 15:07:24 -0700 |
---|---|---|
committer | Josh Suereth <Joshua.Suereth@gmail.com> | 2012-08-07 15:07:24 -0700 |
commit | c957bf808352364467243875b84b1b7d103caace (patch) | |
tree | eaed9ae5f33cc4909912a5e8219f771fff791b91 /src | |
parent | 6b3d36bc19cc82350c3754b0b91fb074a443d9bc (diff) | |
parent | 788478d3ab7dbb6386932eb8cb58dfcc5ee950b1 (diff) | |
download | scala-c957bf808352364467243875b84b1b7d103caace.tar.gz scala-c957bf808352364467243875b84b1b7d103caace.tar.bz2 scala-c957bf808352364467243875b84b1b7d103caace.zip |
Merge pull request #1080 from scalamacros/ticket/6186
SI-6186 TypeTags no longer supported in macros
Diffstat (limited to 'src')
5 files changed, 9 insertions, 13 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Macros.scala b/src/compiler/scala/tools/nsc/typechecker/Macros.scala index 1381450970..7c5d458fee 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Macros.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Macros.scala @@ -23,7 +23,7 @@ import java.lang.reflect.{Array => jArray, Method => jMethod} * * Then fooBar needs to point to a static method of the following form: * - * def fooBar[T: c.TypeTag] + * def fooBar[T: c.AbsTypeTag] * (c: scala.reflect.macros.Context) * (xs: c.Expr[List[T]]) * : c.Expr[T] = { @@ -156,7 +156,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.AbsTypeTagClass && wannabe != definitions.TypeTagClass) + if (wannabe != definitions.AbsTypeTagClass) List(param) else transform(param, tparam.typeSymbol) map (_ :: Nil) getOrElse Nil @@ -202,7 +202,6 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { 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 } @@ -440,7 +439,7 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { // we don't have to do this, but it appears to be more clear than allowing them val implicitParams = actparamss.flatten filter (_.isImplicit) if (implicitParams.length > 0) { - reportError(implicitParams.head.pos, "macro implementations cannot have implicit parameters other than TypeTag evidences") + reportError(implicitParams.head.pos, "macro implementations cannot have implicit parameters other than AbsTypeTag evidences") macroTraceVerbose("macro def failed to satisfy trivial preconditions: ")(macroDef) } @@ -854,9 +853,6 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { param.tpe.typeSymbol match { case definitions.AbsTypeTagClass => // do nothing - 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) } @@ -1019,7 +1015,7 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { ) val forgotten = ( if (sym.isTerm) "splice when splicing this variable into a reifee" - else "c.TypeTag annotation for this type parameter" + else "c.AbsTypeTag annotation for this type parameter" ) typer.context.error(expandee.pos, template.replaceAllLiterally("@kind@", sym.name.nameKind).format( diff --git a/src/compiler/scala/tools/reflect/FastTrack.scala b/src/compiler/scala/tools/reflect/FastTrack.scala index e093c64c72..f84877cccb 100644 --- a/src/compiler/scala/tools/reflect/FastTrack.scala +++ b/src/compiler/scala/tools/reflect/FastTrack.scala @@ -28,7 +28,7 @@ trait FastTrack { def run(args: List[Any]): Any = { val c = args(0).asInstanceOf[MacroContext] val result = expander((c, c.expandee)) - c.Expr[Nothing](result)(c.TypeTag.Nothing) + c.Expr[Nothing](result)(c.AbsTypeTag.Nothing) } } diff --git a/src/library/scala/reflect/base/Universe.scala b/src/library/scala/reflect/base/Universe.scala index 6f37214fa8..f098876c18 100644 --- a/src/library/scala/reflect/base/Universe.scala +++ b/src/library/scala/reflect/base/Universe.scala @@ -46,8 +46,8 @@ abstract class Universe extends Symbols * def macroImpl[T](c: Context) = { * ... * // T here is just a type parameter, so the tree produced by reify won't be of much use in a macro expansion - * // however, if T were annotated with c.TypeTag (which would declare an implicit parameter for macroImpl) - * // then reification would subtitute T with the TypeTree that was used in a TypeApply of this particular macro invocation + * // however, if T were annotated with c.AbsTypeTag (which would declare an implicit parameter for macroImpl) + * // then reification would substitute T with the TypeTree that was used in a TypeApply of this particular macro invocation * val factory = c.reify{ new Queryable[T] } * ... * } diff --git a/src/reflect/scala/reflect/macros/Infrastructure.scala b/src/reflect/scala/reflect/macros/Infrastructure.scala index 1f1bd160a1..5ae2c08265 100644 --- a/src/reflect/scala/reflect/macros/Infrastructure.scala +++ b/src/reflect/scala/reflect/macros/Infrastructure.scala @@ -35,7 +35,7 @@ trait Infrastructure { * * def staticEval[T](x: T) = macro staticEval[T] * - * def staticEval[T: c.TypeTag](c: Context)(x: c.Expr[T]) = { + * def staticEval[T](c: Context)(x: c.Expr[T]) = { * import scala.reflect.runtime.{universe => ru} * val mirror = ru.runtimeMirror(c.libraryClassLoader) * import scala.tools.reflect.ToolBox diff --git a/src/reflect/scala/reflect/runtime/package.scala b/src/reflect/scala/reflect/runtime/package.scala index 2cb72d3824..d00094c0c1 100644 --- a/src/reflect/scala/reflect/runtime/package.scala +++ b/src/reflect/scala/reflect/runtime/package.scala @@ -19,7 +19,7 @@ package runtime { if (runtimeClass.isEmpty) c.abort(c.enclosingPosition, "call site does not have an enclosing class") val runtimeUniverse = Select(Select(Select(Ident(newTermName("scala")), newTermName("reflect")), newTermName("runtime")), newTermName("universe")) val currentMirror = Apply(Select(runtimeUniverse, newTermName("runtimeMirror")), List(Select(runtimeClass, newTermName("getClassLoader")))) - c.Expr[Nothing](currentMirror)(c.TypeTag.Nothing) + c.Expr[Nothing](currentMirror)(c.AbsTypeTag.Nothing) } } } |