From f536e6d9acf47b16131c0ea321ee3c52f6ee6042 Mon Sep 17 00:00:00 2001 From: Mark Harrah Date: Fri, 24 Aug 2012 13:27:34 -0400 Subject: [PATCH] Scala 2.10.0-M7 --- util/appmacro/ContextUtil.scala | 15 ++++++++++----- util/appmacro/Instance.scala | 4 ++-- util/appmacro/KListBuilder.scala | 2 +- util/appmacro/MixedBuilder.scala | 2 +- util/appmacro/TupleBuilder.scala | 2 +- util/appmacro/TupleNBuilder.scala | 2 +- 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/util/appmacro/ContextUtil.scala b/util/appmacro/ContextUtil.scala index 2451c7c98..ad66c84e2 100644 --- a/util/appmacro/ContextUtil.scala +++ b/util/appmacro/ContextUtil.scala @@ -2,7 +2,7 @@ package sbt package appmacro import scala.reflect._ - import makro._ + import macros._ import scala.tools.nsc.Global object ContextUtil { @@ -66,7 +66,7 @@ final class ContextUtil[C <: Context](val ctx: C) polyType(tvar :: Nil, refVar(tvar)) } /** A Type that references the given type variable. */ - def refVar(variable: TypeSymbol): Type = variable.asTypeConstructor + def refVar(variable: TypeSymbol): Type = variable.toTypeConstructor /** Constructs a new, synthetic type variable that is a type constructor. For example, in type Y[L[x]], L is such a type variable. */ def newTCVariable(owner: Symbol): TypeSymbol = { @@ -75,7 +75,7 @@ final class ContextUtil[C <: Context](val ctx: C) tc.setTypeSignature(PolyType(arg :: Nil, emptyTypeBounds)) tc } - def emptyTypeBounds: TypeBounds = TypeBounds(definitions.NothingClass.asType, definitions.AnyClass.asType) + def emptyTypeBounds: TypeBounds = TypeBounds(definitions.NothingClass.toType, definitions.AnyClass.toType) /** Returns the Symbol that references the statically accessible singleton `i`. */ def singleton[T <: AnyRef with Singleton](i: T)(implicit it: ctx.TypeTag[i.type]): Symbol = @@ -85,7 +85,12 @@ final class ContextUtil[C <: Context](val ctx: C) } /** Returns the symbol for the non-private method named `name` for the class/module `obj`. */ - def method(obj: Symbol, name: String): Symbol = obj.typeSignature.nonPrivateMember(newTermName(name)) + def method(obj: Symbol, name: String): Symbol = { + val global: Global = ctx.universe.asInstanceOf[Global] + val ts: Type = obj.typeSignature + val m: global.Symbol = ts.asInstanceOf[global.Type].nonPrivateMember(global.newTermName(name)) + m.asInstanceOf[Symbol] + } /** Returns a Type representing the type constructor tcp.. For example, given * `object Demo { type M[x] = List[x] }`, the call `extractTC(Demo, "M")` will return a type representing @@ -97,7 +102,7 @@ final class ContextUtil[C <: Context](val ctx: C) val itTpe = it.tpe.asInstanceOf[global.Type] val m = itTpe.nonPrivateMember(global.newTypeName(name)) val tc = itTpe.memberInfo(m).asInstanceOf[ctx.universe.Type] - assert(tc != NoType && tc.isHigherKinded, "Invalid type constructor: " + tc) + assert(tc != NoType && tc.takesTypeArgs, "Invalid type constructor: " + tc) tc } } \ No newline at end of file diff --git a/util/appmacro/Instance.scala b/util/appmacro/Instance.scala index 71360c1c7..e03a29cb2 100644 --- a/util/appmacro/Instance.scala +++ b/util/appmacro/Instance.scala @@ -18,7 +18,7 @@ trait Instance } trait Convert { - def apply[T: c.AbsTypeTag](c: scala.reflect.makro.Context)(in: c.Tree): c.Tree + def apply[T: c.AbsTypeTag](c: scala.reflect.macros.Context)(in: c.Tree): c.Tree } trait MonadInstance extends Instance { @@ -30,7 +30,7 @@ object InputWrapper } import scala.reflect._ - import makro._ + import macros._ object Instance { diff --git a/util/appmacro/KListBuilder.scala b/util/appmacro/KListBuilder.scala index b57a39449..7ae0696d0 100644 --- a/util/appmacro/KListBuilder.scala +++ b/util/appmacro/KListBuilder.scala @@ -4,7 +4,7 @@ package appmacro import Types.Id import scala.tools.nsc.Global import scala.reflect._ - import makro._ + import macros._ /** A `TupleBuilder` that uses a KList as the tuple representation.*/ object KListBuilder extends TupleBuilder diff --git a/util/appmacro/MixedBuilder.scala b/util/appmacro/MixedBuilder.scala index 593f60382..e58adb2b0 100644 --- a/util/appmacro/MixedBuilder.scala +++ b/util/appmacro/MixedBuilder.scala @@ -2,7 +2,7 @@ package sbt package appmacro import scala.reflect._ - import makro._ + import macros._ /** A builder that uses `TupleN` as the representation for small numbers of inputs (up to `TupleNBuilder.MaxInputs`) * and `KList` for larger numbers of inputs. This builder cannot handle fewer than 2 inputs.*/ diff --git a/util/appmacro/TupleBuilder.scala b/util/appmacro/TupleBuilder.scala index f91d3c91c..f6442cb02 100644 --- a/util/appmacro/TupleBuilder.scala +++ b/util/appmacro/TupleBuilder.scala @@ -4,7 +4,7 @@ package appmacro import Types.Id import scala.tools.nsc.Global import scala.reflect._ - import makro._ + import macros._ /** * A `TupleBuilder` abstracts the work of constructing a tuple data structure such as a `TupleN` or `KList` diff --git a/util/appmacro/TupleNBuilder.scala b/util/appmacro/TupleNBuilder.scala index 4f034adae..c7b9929ab 100644 --- a/util/appmacro/TupleNBuilder.scala +++ b/util/appmacro/TupleNBuilder.scala @@ -4,7 +4,7 @@ package appmacro import Types.Id import scala.tools.nsc.Global import scala.reflect._ - import makro._ + import macros._ /** A builder that uses a TupleN as the tuple representation. * It is limited to tuples of size 2 to `MaxInputs`. */