diff options
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/reflect/Manifest.scala | 4 | ||||
-rw-r--r-- | src/library/scala/reflect/base/TagInterop.scala | 6 | ||||
-rw-r--r-- | src/library/scala/reflect/base/TypeTags.scala | 206 | ||||
-rw-r--r-- | src/library/scala/reflect/compat.scala | 4 | ||||
-rw-r--r-- | src/library/scala/reflect/makro/internal/package.scala | 2 | ||||
-rw-r--r-- | src/library/scala/reflect/package.scala | 21 |
6 files changed, 123 insertions, 120 deletions
diff --git a/src/library/scala/reflect/Manifest.scala b/src/library/scala/reflect/Manifest.scala index 559b82b177..7e320b42eb 100644 --- a/src/library/scala/reflect/Manifest.scala +++ b/src/library/scala/reflect/Manifest.scala @@ -39,7 +39,7 @@ import scala.collection.mutable.{ ArrayBuilder, WrappedArray } * */ @annotation.implicitNotFound(msg = "No Manifest available for ${T}.") -@deprecated("Use `@scala.reflect.ConcreteTypeTag` instead", "2.10.0") +@deprecated("Use TypeTag instead", "2.10.0") trait Manifest[T] extends ClassManifest[T] with Equals { override def typeArguments: List[Manifest[_]] = Nil @@ -76,7 +76,7 @@ abstract class AnyValManifest[T <: AnyVal](override val toString: String) extend * It is intended for use by the compiler and should not be used * in client code. */ -@deprecated("Use `@scala.reflect.ConcreteTypeTag` instead", "2.10.0") +@deprecated("Use TypeTag instead", "2.10.0") object Manifest { def valueManifests: List[AnyValManifest[_]] = List(Byte, Short, Char, Int, Long, Float, Double, Boolean, Unit) diff --git a/src/library/scala/reflect/base/TagInterop.scala b/src/library/scala/reflect/base/TagInterop.scala index 9c4159f1d8..158d1979e5 100644 --- a/src/library/scala/reflect/base/TagInterop.scala +++ b/src/library/scala/reflect/base/TagInterop.scala @@ -16,14 +16,14 @@ trait TagInterop { self: Universe => } // [Eugene++] `mirror` parameters are now of type `Any`, because I can't make these path-dependent types work - // if you're brave enough, replace `Any` with `Mirror`, recompile and run interop_concretetypetags_are_manifests.scala + // if you're brave enough, replace `Any` with `Mirror`, recompile and run interop_typetags_are_manifests.scala // [Eugene++] would be great if we could approximate the interop without any mirrors // todo. think how to implement that - def concreteTypeTagToManifest[T: ClassTag](mirror: Any, tag: base.Universe # ConcreteTypeTag[T]): Manifest[T] = + def typeTagToManifest[T: ClassTag](mirror: Any, tag: base.Universe # TypeTag[T]): Manifest[T] = throw new UnsupportedOperationException("This universe does not support tag -> manifest conversions. Use scala.reflect.runtime.universe from scala-reflect.jar.") - def manifestToConcreteTypeTag[T](mirror: Any, manifest: Manifest[T]): base.Universe # ConcreteTypeTag[T] = + def manifestToTypeTag[T](mirror: Any, manifest: Manifest[T]): base.Universe # TypeTag[T] = throw new UnsupportedOperationException("This universe does not support manifest -> tag conversions. Use scala.reflect.runtime.universe from scala-reflect.jar.") } diff --git a/src/library/scala/reflect/base/TypeTags.scala b/src/library/scala/reflect/base/TypeTags.scala index ed927fd889..774bc6ebea 100644 --- a/src/library/scala/reflect/base/TypeTags.scala +++ b/src/library/scala/reflect/base/TypeTags.scala @@ -17,15 +17,15 @@ import language.implicitConversions * === Overview === * * Type tags are organized in a hierarchy of three classes: - * [[scala.reflect.ClassTag]], [[scala.reflect.base.Universe#TypeTag]] and [[scala.reflect.base.Universe#ConcreteTypeTag]]. + * [[scala.reflect.ClassTag]], [[scala.reflect.base.Universe#TypeTag]] and [[scala.reflect.base.Universe#AbsTypeTag]]. * * A [[scala.reflect.ClassTag]] carries a runtime class that corresponds to the source type T. * As of such, it possesses the knowledge about how to build single- and multi-dimensional arrays of elements of that type. * It guarantees that the source type T did not to contain any references to type parameters or abstract types. * [[scala.reflect.ClassTag]] corresponds to a previous notion of [[scala.reflect.ClassManifest]]. * - * A [[scala.reflect.base.Universe#TypeTag]] value wraps a full Scala type in its tpe field. - * A [[scala.reflect.base.Universe#ConcreteTypeTag]] value is a [[scala.reflect.base.Universe#TypeTag]] + * A [[scala.reflect.base.Universe#AbsTypeTag]] value wraps a full Scala type in its tpe field. + * A [[scala.reflect.base.Universe#TypeTag]] value is an [[scala.reflect.base.Universe#AbsTypeTag]] * that is guaranteed not to contain any references to type parameters or abstract types. * * [Eugene++] also mention sensitivity to prefixes, i.e. that rb.TypeTag is different from ru.TypeTag @@ -40,49 +40,50 @@ import language.implicitConversions * import reflect.mirror._ * def f[T: TypeTag, U] = { * type L = T => U - * implicitly[TypeTag[L]] + * implicitly[AbsTypeTag[L]] * } * * Then a call of f[String, Int] will yield a result of the form * - * TypeTag(<[ String => U ]>). + * AbsTypeTag(<[ String => U ]>). * * Note that T has been replaced by String, because it comes with a TypeTag in f, whereas U was left as a type parameter. * - * === TypeTag vs ConcreteTypeTag === + * === AbsTypeTag vs TypeTag === * - * Be careful with TypeTag, because it will reify types even if these types are abstract. + * Be careful with AbsTypeTag, because it will reify types even if these types are abstract. * This makes it easy to forget to tag one of the methods in the call chain and discover it much later in the runtime * by getting cryptic errors far away from their source. For example, consider the following snippet: * - * def bind[T: TypeTag](name: String, value: T): IR.Result = bind((name, value)) - * def bind(p: NamedParam): IR.Result = bind(p.name, p.tpe, p.value) + * def bind[T: AbsTypeTag](name: String, value: T): IR.Result = bind((name, value)) + * def bind(p: NamedParam): IR.Result = bind(p.name, p.tpe, p.value) * object NamedParam { - * implicit def namedValue[T: TypeTag](name: String, x: T): NamedParam = apply(name, x) - * def apply[T: TypeTag](name: String, x: T): NamedParam = new Typed[T](name, x) + * implicit def namedValue[T: AbsTypeTag](name: String, x: T): NamedParam = apply(name, x) + * def apply[T: AbsTypeTag](name: String, x: T): NamedParam = new Typed[T](name, x) * } * * This fragment of Scala REPL implementation defines a `bind` function that carries a named value along with its type - * into the heart of the REPL. Using a [[scala.reflect.base.Universe#TypeTag]] here is reasonable, because it is desirable + * into the heart of the REPL. Using a [[scala.reflect.base.Universe#AbsTypeTag]] here is reasonable, because it is desirable * to work with all types, even if they are type parameters or abstract type members. * - * However if any of the three `TypeTag` context bounds is omitted, the resulting code will be incorrect, - * because the missing `TypeTag` will be transparently generated by the compiler, carrying meaningless information. + * However if any of the three `AbsTypeTag` context bounds is omitted, the resulting code will be incorrect, + * because the missing `AbsTypeTag` will be transparently generated by the compiler, carrying meaningless information. * Most likely, this problem will manifest itself elsewhere, making debugging complicated. - * If `TypeTag` context bounds were replaced with `ConcreteTypeTag`, then such errors would be reported statically. + * If `AbsTypeTag` context bounds were replaced with `TypeTag`, then such errors would be reported statically. * But in that case we wouldn't be able to use `bind` in arbitrary contexts. * * === Backward compatibility === * - * TypeTags correspond loosely to Manifests. More precisely: + * Type tags correspond loosely to manifests. + * + * More precisely: * The previous notion of a [[scala.reflect.ClassManifest]] corresponds to a scala.reflect.ClassTag, - * The previous notion of a [[scala.reflect.Manifest]] corresponds to scala.reflect.mirror.ConcreteTypeTag, - * Whereas scala.reflect.mirror.TypeTag is approximated by the previous notion of [[scala.reflect.OptManifest]]. + * The previous notion of a [[scala.reflect.Manifest]] corresponds to scala.reflect.runtime.universe.TypeTag, * * In Scala 2.10, manifests are deprecated, so it's adviseable to migrate them to tags, * because manifests might be removed in the next major release. * - * In most cases it will be enough to replace ClassManifests with ClassTags and Manifests with ConcreteTypeTags, + * In most cases it will be enough to replace ClassManifests with ClassTags and Manifests with TypeTags, * however there are a few caveats: * * 1) The notion of OptManifest is no longer supported. Tags can reify arbitrary types, so they are always available. @@ -102,20 +103,83 @@ import language.implicitConversions trait TypeTags { self: Universe => /** - * If an implicit value of type u.TypeTag[T] is required, the compiler will make one up on demand. + * If an implicit value of type u.AbsTypeTag[T] is required, the compiler will make one up on demand. * The implicitly created value contains in its tpe field a value of type u.Type that is a reflective representation of T. * In that value, any occurrences of type parameters or abstract types U * which come themselves with a TypeTag are represented by the type referenced by that TypeTag. * * @see [[scala.reflect.base.TypeTags]] */ - @annotation.implicitNotFound(msg = "No TypeTag available for ${T}") - trait TypeTag[T] extends Equals with Serializable { + @annotation.implicitNotFound(msg = "No AbsTypeTag available for ${T}") + trait AbsTypeTag[T] extends Equals with Serializable { val mirror: Mirror - def in[U <: Universe with Singleton](otherMirror: MirrorOf[U]): U # TypeTag[T] + def in[U <: Universe with Singleton](otherMirror: MirrorOf[U]): U # AbsTypeTag[T] def tpe: Type /** case class accessories */ + override def canEqual(x: Any) = x.isInstanceOf[AbsTypeTag[_]] + override def equals(x: Any) = x.isInstanceOf[AbsTypeTag[_]] && this.mirror == x.asInstanceOf[AbsTypeTag[_]].mirror && this.tpe == x.asInstanceOf[AbsTypeTag[_]].tpe + override def hashCode = mirror.hashCode * 31 + tpe.hashCode + override def toString = "AbsTypeTag[" + tpe + "]" + } + + object AbsTypeTag { + val Byte : AbsTypeTag[scala.Byte] = TypeTag.Byte + val Short : AbsTypeTag[scala.Short] = TypeTag.Short + val Char : AbsTypeTag[scala.Char] = TypeTag.Char + val Int : AbsTypeTag[scala.Int] = TypeTag.Int + val Long : AbsTypeTag[scala.Long] = TypeTag.Long + val Float : AbsTypeTag[scala.Float] = TypeTag.Float + val Double : AbsTypeTag[scala.Double] = TypeTag.Double + val Boolean : AbsTypeTag[scala.Boolean] = TypeTag.Boolean + val Unit : AbsTypeTag[scala.Unit] = TypeTag.Unit + val Any : AbsTypeTag[scala.Any] = TypeTag.Any + val Object : AbsTypeTag[java.lang.Object] = TypeTag.Object + val Nothing : AbsTypeTag[scala.Nothing] = TypeTag.Nothing + val Null : AbsTypeTag[scala.Null] = TypeTag.Null + val String : AbsTypeTag[java.lang.String] = TypeTag.String + + def apply[T](mirror1: MirrorOf[self.type], tpec1: TypeCreator): AbsTypeTag[T] = + tpec1(mirror1) match { + case ByteTpe => AbsTypeTag.Byte.asInstanceOf[AbsTypeTag[T]] + case ShortTpe => AbsTypeTag.Short.asInstanceOf[AbsTypeTag[T]] + case CharTpe => AbsTypeTag.Char.asInstanceOf[AbsTypeTag[T]] + case IntTpe => AbsTypeTag.Int.asInstanceOf[AbsTypeTag[T]] + case LongTpe => AbsTypeTag.Long.asInstanceOf[AbsTypeTag[T]] + case FloatTpe => AbsTypeTag.Float.asInstanceOf[AbsTypeTag[T]] + case DoubleTpe => AbsTypeTag.Double.asInstanceOf[AbsTypeTag[T]] + case BooleanTpe => AbsTypeTag.Boolean.asInstanceOf[AbsTypeTag[T]] + case UnitTpe => AbsTypeTag.Unit.asInstanceOf[AbsTypeTag[T]] + case AnyTpe => AbsTypeTag.Any.asInstanceOf[AbsTypeTag[T]] + case ObjectTpe => AbsTypeTag.Object.asInstanceOf[AbsTypeTag[T]] + case NothingTpe => AbsTypeTag.Nothing.asInstanceOf[AbsTypeTag[T]] + case NullTpe => AbsTypeTag.Null.asInstanceOf[AbsTypeTag[T]] + case StringTpe => AbsTypeTag.String.asInstanceOf[AbsTypeTag[T]] + case _ => new AbsTypeTagImpl[T](mirror1.asInstanceOf[Mirror], tpec1) + } + + def unapply[T](ttag: AbsTypeTag[T]): Option[Type] = Some(ttag.tpe) + } + + private class AbsTypeTagImpl[T](val mirror: Mirror, val tpec: TypeCreator) extends AbsTypeTag[T] { + lazy val tpe: Type = tpec[self.type](mirror) + def in[U <: Universe with Singleton](otherMirror: MirrorOf[U]): U # AbsTypeTag[T] = { + val otherMirror1 = otherMirror.asInstanceOf[MirrorOf[otherMirror.universe.type]] + otherMirror.universe.AbsTypeTag[T](otherMirror1, tpec) + } + } + + /** + * If an implicit value of type u.TypeTag[T] is required, the compiler will make one up on demand following the same procedure as for TypeTags. + * However, if the resulting type still contains references to type parameters or abstract types, a static error results. + * + * @see [[scala.reflect.base.TypeTags]] + */ + @annotation.implicitNotFound(msg = "No TypeTag available for ${T}") + trait TypeTag[T] extends AbsTypeTag[T] with Equals with Serializable { + override def in[U <: Universe with Singleton](otherMirror: MirrorOf[U]): U # TypeTag[T] + + /** case class accessories */ override def canEqual(x: Any) = x.isInstanceOf[TypeTag[_]] override def equals(x: Any) = x.isInstanceOf[TypeTag[_]] && this.mirror == x.asInstanceOf[TypeTag[_]].mirror && this.tpe == x.asInstanceOf[TypeTag[_]].tpe override def hashCode = mirror.hashCode * 31 + tpe.hashCode @@ -123,20 +187,20 @@ trait TypeTags { self: Universe => } object TypeTag { - val Byte : TypeTag[scala.Byte] = ConcreteTypeTag.Byte - val Short : TypeTag[scala.Short] = ConcreteTypeTag.Short - val Char : TypeTag[scala.Char] = ConcreteTypeTag.Char - val Int : TypeTag[scala.Int] = ConcreteTypeTag.Int - val Long : TypeTag[scala.Long] = ConcreteTypeTag.Long - val Float : TypeTag[scala.Float] = ConcreteTypeTag.Float - val Double : TypeTag[scala.Double] = ConcreteTypeTag.Double - val Boolean : TypeTag[scala.Boolean] = ConcreteTypeTag.Boolean - val Unit : TypeTag[scala.Unit] = ConcreteTypeTag.Unit - val Any : TypeTag[scala.Any] = ConcreteTypeTag.Any - val Object : TypeTag[java.lang.Object] = ConcreteTypeTag.Object - val Nothing : TypeTag[scala.Nothing] = ConcreteTypeTag.Nothing - val Null : TypeTag[scala.Null] = ConcreteTypeTag.Null - val String : TypeTag[java.lang.String] = ConcreteTypeTag.String + val Byte: TypeTag[scala.Byte] = new PredefTypeTag[scala.Byte] (ByteTpe, _.TypeTag.Byte) + val Short: TypeTag[scala.Short] = new PredefTypeTag[scala.Short] (ShortTpe, _.TypeTag.Short) + val Char: TypeTag[scala.Char] = new PredefTypeTag[scala.Char] (CharTpe, _.TypeTag.Char) + val Int: TypeTag[scala.Int] = new PredefTypeTag[scala.Int] (IntTpe, _.TypeTag.Int) + val Long: TypeTag[scala.Long] = new PredefTypeTag[scala.Long] (LongTpe, _.TypeTag.Long) + val Float: TypeTag[scala.Float] = new PredefTypeTag[scala.Float] (FloatTpe, _.TypeTag.Float) + val Double: TypeTag[scala.Double] = new PredefTypeTag[scala.Double] (DoubleTpe, _.TypeTag.Double) + val Boolean: TypeTag[scala.Boolean] = new PredefTypeTag[scala.Boolean] (BooleanTpe, _.TypeTag.Boolean) + val Unit: TypeTag[scala.Unit] = new PredefTypeTag[scala.Unit] (UnitTpe, _.TypeTag.Unit) + val Any: TypeTag[scala.Any] = new PredefTypeTag[scala.Any] (AnyTpe, _.TypeTag.Any) + val Object: TypeTag[java.lang.Object] = new PredefTypeTag[java.lang.Object] (ObjectTpe, _.TypeTag.Object) + val Nothing: TypeTag[scala.Nothing] = new PredefTypeTag[scala.Nothing] (NothingTpe, _.TypeTag.Nothing) + val Null: TypeTag[scala.Null] = new PredefTypeTag[scala.Null] (NullTpe, _.TypeTag.Null) + val String: TypeTag[java.lang.String] = new PredefTypeTag[java.lang.String] (StringTpe, _.TypeTag.String) def apply[T](mirror1: MirrorOf[self.type], tpec1: TypeCreator): TypeTag[T] = tpec1(mirror1) match { @@ -160,75 +224,14 @@ trait TypeTags { self: Universe => def unapply[T](ttag: TypeTag[T]): Option[Type] = Some(ttag.tpe) } - private class TypeTagImpl[T](val mirror: Mirror, val tpec: TypeCreator) extends TypeTag[T] { - lazy val tpe: Type = tpec[self.type](mirror) - def in[U <: Universe with Singleton](otherMirror: MirrorOf[U]): U # TypeTag[T] = { - val otherMirror1 = otherMirror.asInstanceOf[MirrorOf[otherMirror.universe.type]] - otherMirror.universe.TypeTag[T](otherMirror1, tpec) - } - } - - /** - * If an implicit value of type u.ConcreteTypeTag[T] is required, the compiler will make one up on demand following the same procedure as for TypeTags. - * However, if the resulting type still contains references to type parameters or abstract types, a static error results. - * - * @see [[scala.reflect.base.TypeTags]] - */ - @annotation.implicitNotFound(msg = "No ConcreteTypeTag available for ${T}") - trait ConcreteTypeTag[T] extends TypeTag[T] with Equals with Serializable { - /** case class accessories */ - override def canEqual(x: Any) = x.isInstanceOf[ConcreteTypeTag[_]] - override def equals(x: Any) = x.isInstanceOf[ConcreteTypeTag[_]] && this.mirror == x.asInstanceOf[ConcreteTypeTag[_]].mirror && this.tpe == x.asInstanceOf[ConcreteTypeTag[_]].tpe - override def hashCode = mirror.hashCode * 31 + tpe.hashCode - override def toString = "ConcreteTypeTag[" + tpe + "]" - } - - object ConcreteTypeTag { - val Byte: ConcreteTypeTag[scala.Byte] = new PredefConcreteTypeTag[scala.Byte] (ByteTpe, _.ConcreteTypeTag.Byte) - val Short: ConcreteTypeTag[scala.Short] = new PredefConcreteTypeTag[scala.Short] (ShortTpe, _.ConcreteTypeTag.Short) - val Char: ConcreteTypeTag[scala.Char] = new PredefConcreteTypeTag[scala.Char] (CharTpe, _.ConcreteTypeTag.Char) - val Int: ConcreteTypeTag[scala.Int] = new PredefConcreteTypeTag[scala.Int] (IntTpe, _.ConcreteTypeTag.Int) - val Long: ConcreteTypeTag[scala.Long] = new PredefConcreteTypeTag[scala.Long] (LongTpe, _.ConcreteTypeTag.Long) - val Float: ConcreteTypeTag[scala.Float] = new PredefConcreteTypeTag[scala.Float] (FloatTpe, _.ConcreteTypeTag.Float) - val Double: ConcreteTypeTag[scala.Double] = new PredefConcreteTypeTag[scala.Double] (DoubleTpe, _.ConcreteTypeTag.Double) - val Boolean: ConcreteTypeTag[scala.Boolean] = new PredefConcreteTypeTag[scala.Boolean] (BooleanTpe, _.ConcreteTypeTag.Boolean) - val Unit: ConcreteTypeTag[scala.Unit] = new PredefConcreteTypeTag[scala.Unit] (UnitTpe, _.ConcreteTypeTag.Unit) - val Any: ConcreteTypeTag[scala.Any] = new PredefConcreteTypeTag[scala.Any] (AnyTpe, _.ConcreteTypeTag.Any) - val Object: ConcreteTypeTag[java.lang.Object] = new PredefConcreteTypeTag[java.lang.Object] (ObjectTpe, _.ConcreteTypeTag.Object) - val Nothing: ConcreteTypeTag[scala.Nothing] = new PredefConcreteTypeTag[scala.Nothing] (NothingTpe, _.ConcreteTypeTag.Nothing) - val Null: ConcreteTypeTag[scala.Null] = new PredefConcreteTypeTag[scala.Null] (NullTpe, _.ConcreteTypeTag.Null) - val String: ConcreteTypeTag[java.lang.String] = new PredefConcreteTypeTag[java.lang.String] (StringTpe, _.ConcreteTypeTag.String) - - def apply[T](mirror1: MirrorOf[self.type], tpec1: TypeCreator): ConcreteTypeTag[T] = - tpec1(mirror1) match { - case ByteTpe => ConcreteTypeTag.Byte.asInstanceOf[ConcreteTypeTag[T]] - case ShortTpe => ConcreteTypeTag.Short.asInstanceOf[ConcreteTypeTag[T]] - case CharTpe => ConcreteTypeTag.Char.asInstanceOf[ConcreteTypeTag[T]] - case IntTpe => ConcreteTypeTag.Int.asInstanceOf[ConcreteTypeTag[T]] - case LongTpe => ConcreteTypeTag.Long.asInstanceOf[ConcreteTypeTag[T]] - case FloatTpe => ConcreteTypeTag.Float.asInstanceOf[ConcreteTypeTag[T]] - case DoubleTpe => ConcreteTypeTag.Double.asInstanceOf[ConcreteTypeTag[T]] - case BooleanTpe => ConcreteTypeTag.Boolean.asInstanceOf[ConcreteTypeTag[T]] - case UnitTpe => ConcreteTypeTag.Unit.asInstanceOf[ConcreteTypeTag[T]] - case AnyTpe => ConcreteTypeTag.Any.asInstanceOf[ConcreteTypeTag[T]] - case ObjectTpe => ConcreteTypeTag.Object.asInstanceOf[ConcreteTypeTag[T]] - case NothingTpe => ConcreteTypeTag.Nothing.asInstanceOf[ConcreteTypeTag[T]] - case NullTpe => ConcreteTypeTag.Null.asInstanceOf[ConcreteTypeTag[T]] - case StringTpe => ConcreteTypeTag.String.asInstanceOf[ConcreteTypeTag[T]] - case _ => new ConcreteTypeTagImpl[T](mirror1.asInstanceOf[Mirror], tpec1) - } - - def unapply[T](ttag: ConcreteTypeTag[T]): Option[Type] = Some(ttag.tpe) - } - - private class ConcreteTypeTagImpl[T](mirror: Mirror, tpec: TypeCreator) extends TypeTagImpl[T](mirror, tpec) with ConcreteTypeTag[T] { + private class TypeTagImpl[T](mirror: Mirror, tpec: TypeCreator) extends AbsTypeTagImpl[T](mirror, tpec) with TypeTag[T] { override def in[U <: Universe with Singleton](otherMirror: MirrorOf[U]): U # TypeTag[T] = { val otherMirror1 = otherMirror.asInstanceOf[MirrorOf[otherMirror.universe.type]] - otherMirror.universe.ConcreteTypeTag[T](otherMirror1, tpec) + otherMirror.universe.TypeTag[T](otherMirror1, tpec) } } - private class PredefConcreteTypeTag[T](_tpe: Type, copyIn: Universe => Universe # TypeTag[T]) extends ConcreteTypeTagImpl[T](rootMirror, null) { + private class PredefTypeTag[T](_tpe: Type, copyIn: Universe => Universe # TypeTag[T]) extends TypeTagImpl[T](rootMirror, null) { override lazy val tpe: Type = _tpe override def in[U <: Universe with Singleton](otherMirror: MirrorOf[U]): U # TypeTag[T] = copyIn(otherMirror.universe).asInstanceOf[U # TypeTag[T]] @@ -237,7 +240,6 @@ trait TypeTags { self: Universe => // incantations def typeTag[T](implicit ttag: TypeTag[T]) = ttag - def concreteTypeTag[T](implicit cttag: ConcreteTypeTag[T]) = cttag // big thanks to Viktor Klang for this brilliant idea! def typeOf[T](implicit ttag: TypeTag[T]): Type = ttag.tpe diff --git a/src/library/scala/reflect/compat.scala b/src/library/scala/reflect/compat.scala index 7bfe9f38e1..fc0e5fbf9c 100644 --- a/src/library/scala/reflect/compat.scala +++ b/src/library/scala/reflect/compat.scala @@ -1,7 +1,9 @@ // [Eugene++] delete this once we merge with trunk and have a working IDE package scala.reflect { + trait ArrayTag[T] trait ErasureTag[T] + trait ConcreteTypeTag[T] } package scala.reflect.api { @@ -24,6 +26,8 @@ package scala.reflect { import scala.reflect.base.{Universe => BaseUniverse} trait internal_compat { + private[scala] def materializeArrayTag[T](u: BaseUniverse): ArrayTag[T] = ??? private[scala] def materializeErasureTag[T](u: BaseUniverse): ErasureTag[T] = ??? + private[scala] def materializeConcreteTypeTag[T](u: BaseUniverse): ConcreteTypeTag[T] = ??? } }
\ No newline at end of file diff --git a/src/library/scala/reflect/makro/internal/package.scala b/src/library/scala/reflect/makro/internal/package.scala index f98177542a..d31a0f0d14 100644 --- a/src/library/scala/reflect/makro/internal/package.scala +++ b/src/library/scala/reflect/makro/internal/package.scala @@ -11,6 +11,6 @@ import scala.reflect.base.{Universe => BaseUniverse} // [Eugene++] how do I hide this from scaladoc? package object internal extends scala.reflect.internal_compat { private[scala] def materializeClassTag[T](u: BaseUniverse): ClassTag[T] = macro ??? + private[scala] def materializeAbsTypeTag[T](u: BaseUniverse): u.AbsTypeTag[T] = macro ??? private[scala] def materializeTypeTag[T](u: BaseUniverse): u.TypeTag[T] = macro ??? - private[scala] def materializeConcreteTypeTag[T](u: BaseUniverse): u.ConcreteTypeTag[T] = macro ??? } diff --git a/src/library/scala/reflect/package.scala b/src/library/scala/reflect/package.scala index 49374a552c..0ee58df2cd 100644 --- a/src/library/scala/reflect/package.scala +++ b/src/library/scala/reflect/package.scala @@ -4,6 +4,15 @@ package object reflect extends reflect_compat { lazy val basis: base.Universe = new base.Base + def classTag[T](implicit ctag: ClassTag[T]) = ctag + // typeTag incantation is defined inside scala.reflect.basis and scala.reflect.runtime.universe + + // ClassTag class is defined in ClassTag.scala + type TypeTag[T] = scala.reflect.basis.TypeTag[T] + + // ClassTag object is defined in ClassTag.scala + lazy val TypeTag = scala.reflect.basis.TypeTag + @deprecated("Use `@scala.beans.BeanDescription` instead", "2.10.0") type BeanDescription = scala.beans.BeanDescription @deprecated("Use `@scala.beans.BeanDisplayName` instead", "2.10.0") @@ -18,16 +27,4 @@ package object reflect extends reflect_compat { type BooleanBeanProperty = scala.beans.BooleanBeanProperty @deprecated("Use `@scala.beans.ScalaBeanInfo` instead", "2.10.0") type ScalaBeanInfo = scala.beans.ScalaBeanInfo - - // ClassTag class is defined outside the basis - def classTag[T](implicit ctag: ClassTag[T]) = ctag - // typeTag incantation is defined inside the basis - // concreteTypeTag incantation is defined inside the basis - - type TypeTag[T] = scala.reflect.basis.TypeTag[T] - type ConcreteTypeTag[T] = scala.reflect.basis.ConcreteTypeTag[T] - - // ClassTag object is defined outside the basis - lazy val TypeTag = scala.reflect.basis.TypeTag - lazy val ConcreteTypeTag = scala.reflect.basis.ConcreteTypeTag } |