summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-04-12 11:32:31 +0200
committerEugene Burmako <xeno.by@gmail.com>2012-04-12 12:17:05 +0200
commit46d0d73f66111d5d31b9fd593972970d7e9056bb (patch)
tree8eed53751313f90fb27ea9c89133aa5414f6a847 /src
parent814cf34fb00f9ccb001249f4b3445ebc4f9942c9 (diff)
downloadscala-46d0d73f66111d5d31b9fd593972970d7e9056bb.tar.gz
scala-46d0d73f66111d5d31b9fd593972970d7e9056bb.tar.bz2
scala-46d0d73f66111d5d31b9fd593972970d7e9056bb.zip
GroundTypeTag => ConcreteTypeTag
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/reflect/internal/Definitions.scala22
-rw-r--r--src/compiler/scala/reflect/internal/StdNames.scala4
-rw-r--r--src/compiler/scala/reflect/makro/runtime/Reifiers.scala8
-rw-r--r--src/compiler/scala/reflect/reify/Errors.scala4
-rw-r--r--src/compiler/scala/reflect/reify/Reifiers.scala6
-rw-r--r--src/compiler/scala/reflect/reify/codegen/Types.scala20
-rw-r--r--src/compiler/scala/reflect/reify/package.scala6
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Implicits.scala4
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Macros.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala2
-rw-r--r--src/library/scala/Predef.scala26
-rw-r--r--src/library/scala/reflect/ClassTags.scala15
-rw-r--r--src/library/scala/reflect/TagMaterialization.scala42
-rwxr-xr-xsrc/library/scala/reflect/api/StandardDefinitions.scala4
-rw-r--r--src/library/scala/reflect/api/TypeTags.scala153
-rw-r--r--src/library/scala/reflect/makro/Aliases.scala4
-rw-r--r--src/library/scala/reflect/makro/Reifiers.scala2
-rw-r--r--src/library/scala/reflect/makro/internal/typeTagImpl.scala18
-rw-r--r--src/library/scala/reflect/package.scala16
19 files changed, 184 insertions, 174 deletions
diff --git a/src/compiler/scala/reflect/internal/Definitions.scala b/src/compiler/scala/reflect/internal/Definitions.scala
index b1c822ed97..12b083b4f6 100644
--- a/src/compiler/scala/reflect/internal/Definitions.scala
+++ b/src/compiler/scala/reflect/internal/Definitions.scala
@@ -477,16 +477,16 @@ trait Definitions extends reflect.api.StandardDefinitions {
def ExprValue = getMember(ExprClass, nme.value)
lazy val ExprModule = getMember(getRequiredClass("scala.reflect.api.Exprs"), nme.Expr)
- lazy val ClassTagClass = getRequiredClass("scala.reflect.ClassTag")
- def ClassTagErasure = getMember(ClassTagClass, nme.erasure)
- def ClassTagTpe = getMember(ClassTagClass, nme.tpe)
- lazy val ClassTagModule = getRequiredModule("scala.reflect.ClassTag")
- lazy val TypeTagsClass = getRequiredClass("scala.reflect.api.TypeTags")
- lazy val TypeTagClass = getMember(TypeTagsClass, tpnme.TypeTag)
- def TypeTagTpe = getMember(TypeTagClass, nme.tpe)
- lazy val TypeTagModule = getMember(TypeTagsClass, nme.TypeTag)
- lazy val GroundTypeTagClass = getMember(TypeTagsClass, tpnme.GroundTypeTag)
- lazy val GroundTypeTagModule = getMember(TypeTagsClass, nme.GroundTypeTag)
+ lazy val ClassTagClass = getRequiredClass("scala.reflect.ClassTag")
+ def ClassTagErasure = getMember(ClassTagClass, nme.erasure)
+ def ClassTagTpe = getMember(ClassTagClass, nme.tpe)
+ lazy val ClassTagModule = getRequiredModule("scala.reflect.ClassTag")
+ lazy val TypeTagsClass = getRequiredClass("scala.reflect.api.TypeTags")
+ lazy val TypeTagClass = getMember(TypeTagsClass, tpnme.TypeTag)
+ def TypeTagTpe = getMember(TypeTagClass, nme.tpe)
+ lazy val TypeTagModule = getMember(TypeTagsClass, nme.TypeTag)
+ lazy val ConcreteTypeTagClass = getMember(TypeTagsClass, tpnme.ConcreteTypeTag)
+ lazy val ConcreteTypeTagModule = getMember(TypeTagsClass, nme.ConcreteTypeTag)
lazy val MacroContextClass = getRequiredClass("scala.reflect.makro.Context")
def MacroContextPrefix = getMember(MacroContextClass, nme.prefix)
@@ -497,7 +497,7 @@ trait Definitions extends reflect.api.StandardDefinitions {
lazy val MacroInternalPackage = getPackageObject("scala.reflect.makro.internal")
def MacroInternal_materializeClassTag = getMember(MacroInternalPackage, nme.materializeClassTag)
def MacroInternal_materializeTypeTag = getMember(MacroInternalPackage, nme.materializeTypeTag)
- def MacroInternal_materializeGroundTypeTag = getMember(MacroInternalPackage, nme.materializeGroundTypeTag)
+ def MacroInternal_materializeConcreteTypeTag = getMember(MacroInternalPackage, nme.materializeConcreteTypeTag)
lazy val ScalaSignatureAnnotation = getRequiredClass("scala.reflect.ScalaSignature")
lazy val ScalaLongSignatureAnnotation = getRequiredClass("scala.reflect.ScalaLongSignature")
diff --git a/src/compiler/scala/reflect/internal/StdNames.scala b/src/compiler/scala/reflect/internal/StdNames.scala
index b72610f1e0..1666887133 100644
--- a/src/compiler/scala/reflect/internal/StdNames.scala
+++ b/src/compiler/scala/reflect/internal/StdNames.scala
@@ -126,7 +126,7 @@ trait StdNames extends NameManglers { self: SymbolTable =>
final val Symbol: NameType = "Symbol"
final val ClassTag: NameType = "ClassTag"
final val TypeTag : NameType = "TypeTag"
- final val GroundTypeTag: NameType = "GroundTypeTag"
+ final val ConcreteTypeTag: NameType = "ConcreteTypeTag"
// fictions we use as both types and terms
final val ERROR: NameType = "<error>"
@@ -396,7 +396,7 @@ trait StdNames extends NameManglers { self: SymbolTable =>
val map: NameType = "map"
val materializeClassTag: NameType = "materializeClassTag"
val materializeTypeTag: NameType = "materializeTypeTag"
- val materializeGroundTypeTag: NameType = "materializeGroundTypeTag"
+ val materializeConcreteTypeTag: NameType = "materializeConcreteTypeTag"
val mirror : NameType = "mirror"
val moduleClass : NameType = "moduleClass"
val name: NameType = "name"
diff --git a/src/compiler/scala/reflect/makro/runtime/Reifiers.scala b/src/compiler/scala/reflect/makro/runtime/Reifiers.scala
index 826fa7153f..2488b06d6c 100644
--- a/src/compiler/scala/reflect/makro/runtime/Reifiers.scala
+++ b/src/compiler/scala/reflect/makro/runtime/Reifiers.scala
@@ -21,16 +21,16 @@ trait Reifiers {
def reifyTree(prefix: Tree, tree: Tree): Tree =
reifyTopLevel(prefix, tree)
- def reifyType(prefix: Tree, tpe: Type, dontSpliceAtTopLevel: Boolean = false, noTypeVariablesInResult: Boolean = false): Tree =
- reifyTopLevel(prefix, tpe, dontSpliceAtTopLevel, noTypeVariablesInResult)
+ def reifyType(prefix: Tree, tpe: Type, dontSpliceAtTopLevel: Boolean = false, requireConcreteTypeTag: Boolean = false): Tree =
+ reifyTopLevel(prefix, tpe, dontSpliceAtTopLevel, requireConcreteTypeTag)
def unreifyTree(tree: Tree): Tree =
Select(tree, definitions.ExprEval)
- def reifyTopLevel(prefix: Tree, reifee: Any, dontSpliceAtTopLevel: Boolean = false, requireGroundTypeTag: Boolean = false): Tree = {
+ def reifyTopLevel(prefix: Tree, reifee: Any, dontSpliceAtTopLevel: Boolean = false, requireConcreteTypeTag: Boolean = false): Tree = {
// [Eugene] the plumbing is not very pretty, but anyways factoring out the reifier seems like a necessary step to me
import scala.reflect.reify._
- val reifier = mkReifier(mirror)(callsiteTyper, prefix, reifee, dontSpliceAtTopLevel, requireGroundTypeTag)
+ val reifier = mkReifier(mirror)(callsiteTyper, prefix, reifee, dontSpliceAtTopLevel, requireConcreteTypeTag)
try {
val result = reifier.reified
diff --git a/src/compiler/scala/reflect/reify/Errors.scala b/src/compiler/scala/reflect/reify/Errors.scala
index 8bfe64621b..30c6c06c7b 100644
--- a/src/compiler/scala/reflect/reify/Errors.scala
+++ b/src/compiler/scala/reflect/reify/Errors.scala
@@ -33,8 +33,8 @@ trait Errors {
throw new ReificationError(defaultErrorPosition, msg)
}
- def CannotReifyGroundTypeTagHavingUnresolvedTypeParameters(tpe: Type) = {
- val msg = "cannot reify GroundTypeTag having unresolved type parameter %s".format(tpe)
+ def CannotReifyConcreteTypeTagHavingUnresolvedTypeParameters(tpe: Type) = {
+ val msg = "cannot reify ConcreteTypeTag having unresolved type parameter %s".format(tpe)
throw new ReificationError(defaultErrorPosition, msg)
}
diff --git a/src/compiler/scala/reflect/reify/Reifiers.scala b/src/compiler/scala/reflect/reify/Reifiers.scala
index 6854710949..16c26734b2 100644
--- a/src/compiler/scala/reflect/reify/Reifiers.scala
+++ b/src/compiler/scala/reflect/reify/Reifiers.scala
@@ -21,7 +21,7 @@ abstract class Reifier extends Phases
val prefix: Tree
val reifee: Any
val dontSpliceAtTopLevel: Boolean
- val requireGroundTypeTag: Boolean
+ val requireConcreteTypeTag: Boolean
/**
* For ``reifee'' and other reification parameters, generate a tree of the form
@@ -74,7 +74,7 @@ abstract class Reifier extends Phases
val manifestedType = typer.packedType(tree, NoSymbol)
val manifestedRtype = reifyType(manifestedType)
- val tagModule = if (definitelyGround) GroundTypeTagModule else TypeTagModule
+ val tagModule = if (definitelyConcrete) ConcreteTypeTagModule else TypeTagModule
var typeTagCtor = TypeApply(Select(Ident(nme.MIRROR_SHORT), tagModule.name), List(TypeTree(manifestedType)))
var exprCtor = TypeApply(Select(Ident(nme.MIRROR_SHORT), ExprModule.name), List(TypeTree(manifestedType)))
Apply(Apply(exprCtor, List(rtree)), List(Apply(typeTagCtor, List(manifestedRtype))))
@@ -85,7 +85,7 @@ abstract class Reifier extends Phases
val rtree = reify(tpe)
val manifestedType = tpe
- var tagModule = if (definitelyGround) GroundTypeTagModule else TypeTagModule
+ var tagModule = if (definitelyConcrete) ConcreteTypeTagModule else TypeTagModule
var ctor = TypeApply(Select(Ident(nme.MIRROR_SHORT), tagModule.name), List(TypeTree(manifestedType)))
Apply(ctor, List(rtree))
diff --git a/src/compiler/scala/reflect/reify/codegen/Types.scala b/src/compiler/scala/reflect/reify/codegen/Types.scala
index 6f3a60a076..9bc113e8a4 100644
--- a/src/compiler/scala/reflect/reify/codegen/Types.scala
+++ b/src/compiler/scala/reflect/reify/codegen/Types.scala
@@ -67,8 +67,8 @@ trait Types {
private var spliceTypesEnabled = !dontSpliceAtTopLevel
/** Keeps track of whether this reification contains abstract type parameters */
- var maybeGround = true
- var definitelyGround = true
+ var maybeConcrete = true
+ var definitelyConcrete = true
def eligibleForSplicing(tpe: Type): Boolean = {
// [Eugene] is this comprehensive?
@@ -88,7 +88,7 @@ trait Types {
if (reifyDebug) println("splicing " + tpe)
if (spliceTypesEnabled) {
- var tagClass = if (requireGroundTypeTag) GroundTypeTagClass else TypeTagClass
+ var tagClass = if (requireConcreteTypeTag) ConcreteTypeTagClass else TypeTagClass
val tagTpe = singleType(prefix.tpe, prefix.tpe member tagClass.name)
// [Eugene] this should be enough for an abstract type, right?
@@ -99,16 +99,16 @@ trait Types {
// to find out the whereabouts of the error run scalac with -Ydebug
if (reifyDebug) println("launching implicit search for %s.%s[%s]".format(prefix, tagClass.name, tpe))
val positionBearer = mirror.analyzer.openMacros.find(c => c.macroApplication.pos != NoPosition).map(_.macroApplication).getOrElse(EmptyTree).asInstanceOf[Tree]
- typer.resolveTypeTag(positionBearer, prefix.tpe, tpe, requireGroundTypeTag) match {
+ typer.resolveTypeTag(positionBearer, prefix.tpe, tpe, requireConcreteTypeTag) match {
case failure if failure.isEmpty =>
if (reifyDebug) println("implicit search was fruitless")
- definitelyGround &= false
- maybeGround &= false
+ definitelyConcrete &= false
+ maybeConcrete &= false
EmptyTree
case success =>
if (reifyDebug) println("implicit search has produced a result: " + success)
- definitelyGround |= requireGroundTypeTag
- maybeGround |= true
+ definitelyConcrete |= requireConcreteTypeTag
+ maybeConcrete |= true
var splice = Select(success, nme.tpe)
splice match {
case InlinedTypeSplice(_, inlinedSymbolTable, tpe) =>
@@ -126,8 +126,8 @@ trait Types {
if (reifyDebug) println("splicing has been cancelled: spliceTypesEnabled = false")
}
- if (requireGroundTypeTag)
- CannotReifyGroundTypeTagHavingUnresolvedTypeParameters(tpe)
+ if (requireConcreteTypeTag)
+ CannotReifyConcreteTypeTagHavingUnresolvedTypeParameters(tpe)
}
spliceTypesEnabled = true
diff --git a/src/compiler/scala/reflect/reify/package.scala b/src/compiler/scala/reflect/reify/package.scala
index 7041fbf6ed..85cf92fe2f 100644
--- a/src/compiler/scala/reflect/reify/package.scala
+++ b/src/compiler/scala/reflect/reify/package.scala
@@ -3,12 +3,12 @@ package scala.reflect
import scala.tools.nsc.Global
package object reify {
- def mkReifier(global: Global)(typer: global.analyzer.Typer, prefix: global.Tree, reifee: Any, dontSpliceAtTopLevel: Boolean = false, requireGroundTypeTag: Boolean = false): Reifier { val mirror: global.type } = {
+ def mkReifier(global: Global)(typer: global.analyzer.Typer, prefix: global.Tree, reifee: Any, dontSpliceAtTopLevel: Boolean = false, requireConcreteTypeTag: Boolean = false): Reifier { val mirror: global.type } = {
val typer1: typer.type = typer
val prefix1: prefix.type = prefix
val reifee1 = reifee
val dontSpliceAtTopLevel1 = dontSpliceAtTopLevel
- val requireGroundTypeTag1 = requireGroundTypeTag
+ val requireConcreteTypeTag1 = requireConcreteTypeTag
new {
val mirror: global.type = global
@@ -16,7 +16,7 @@ package object reify {
val prefix = prefix1
val reifee = reifee1
val dontSpliceAtTopLevel = dontSpliceAtTopLevel1
- val requireGroundTypeTag = requireGroundTypeTag1
+ val requireConcreteTypeTag = requireConcreteTypeTag1
} with Reifier
}
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
index 8aa257983a..3a789b83b6 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
@@ -1099,11 +1099,11 @@ trait Implicits {
}
// these should be lazy, otherwise we wouldn't be able to compile scala-library with starr
- private val TagSymbols = Set(ClassTagClass, TypeTagClass, GroundTypeTagClass)
+ private val TagSymbols = Set(ClassTagClass, TypeTagClass, ConcreteTypeTagClass)
private val TagMaterializers = Map(
ClassTagClass -> MacroInternal_materializeClassTag,
TypeTagClass -> MacroInternal_materializeTypeTag,
- GroundTypeTagClass -> MacroInternal_materializeGroundTypeTag
+ ConcreteTypeTagClass -> MacroInternal_materializeConcreteTypeTag
)
def tagOfType(pre: Type, tp: Type, tagClass: Symbol): SearchResult = {
diff --git a/src/compiler/scala/tools/nsc/typechecker/Macros.scala b/src/compiler/scala/tools/nsc/typechecker/Macros.scala
index 3b270a92ad..9608108a0d 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Macros.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Macros.scala
@@ -877,7 +877,7 @@ trait Macros { self: Analyzer =>
tpe
}) map (tpe => {
val ttag = TypeTag(tpe)
- if (ttag.isGround) ttag.toGround else ttag
+ if (ttag.isConcrete) ttag.toConcrete else ttag
})
argss = argss.dropRight(1) :+ (evidences ++ argss.last)
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 1b508a96fe..5d9b8ae94a 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -5020,7 +5020,7 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser {
def resolveTypeTag(tree: Tree, pre: Type, tp: Type, full: Boolean): Tree = beforeTyper {
inferImplicit(
EmptyTree,
- appliedType(singleType(pre, pre member (if (full) GroundTypeTagClass else TypeTagClass).name), List(tp)),
+ appliedType(singleType(pre, pre member (if (full) ConcreteTypeTagClass else TypeTagClass).name), List(tp)),
/*reportAmbiguous =*/ true,
/*isView =*/ false,
/*context =*/ context,
diff --git a/src/library/scala/Predef.scala b/src/library/scala/Predef.scala
index d241d2ddc0..837ce96baa 100644
--- a/src/library/scala/Predef.scala
+++ b/src/library/scala/Predef.scala
@@ -103,12 +103,12 @@ object Predef extends LowPriorityImplicits {
type ClassManifest[T] = scala.reflect.ClassManifest[T]
@deprecated("OptManifest is no longer supported and using it may lead to incorrect results, use `@scala.reflect.TypeTag` instead", "2.10.0")
type OptManifest[T] = scala.reflect.OptManifest[T]
- @deprecated("Use `@scala.reflect.GroundTypeTag` instead", "2.10.0")
+ @deprecated("Use `@scala.reflect.ConcreteTypeTag` instead", "2.10.0")
type Manifest[T] = scala.reflect.Manifest[T]
@deprecated("Use `@scala.reflect.ClassTag` instead", "2.10.0")
val ClassManifest = scala.reflect.ClassManifest
// [Paul to Eugene] No lazy vals in Predef. Too expensive. Have to work harder on breaking initialization dependencies.
- @deprecated("Use `@scala.reflect.GroundTypeTag` instead", "2.10.0")
+ @deprecated("Use `@scala.reflect.ConcreteTypeTag` instead", "2.10.0")
lazy val Manifest = scala.reflect.Manifest // needs to be lazy, because requires scala.reflect.mirror instance
@deprecated("NoManifest is no longer supported and using it may lead to incorrect results, use `@scala.reflect.TypeTag` instead", "2.10.0")
lazy val NoManifest = scala.reflect.NoManifest // needs to be lazy, because requires scala.reflect.mirror instance
@@ -118,20 +118,20 @@ object Predef extends LowPriorityImplicits {
def optManifest[T](implicit m: OptManifest[T]) = m
// Tag types and companions, and incantations for summoning
- type ClassTag[T] = scala.reflect.ClassTag[T]
- type TypeTag[T] = scala.reflect.TypeTag[T]
- type GroundTypeTag[T] = scala.reflect.GroundTypeTag[T]
- val ClassTag = scala.reflect.ClassTag // doesn't need to be lazy, because it's not a path-dependent type
+ type ClassTag[T] = scala.reflect.ClassTag[T]
+ type TypeTag[T] = scala.reflect.TypeTag[T]
+ type ConcreteTypeTag[T] = scala.reflect.ConcreteTypeTag[T]
+ val ClassTag = scala.reflect.ClassTag // doesn't need to be lazy, because it's not a path-dependent type
// [Paul to Eugene] No lazy vals in Predef. Too expensive. Have to work harder on breaking initialization dependencies.
- lazy val TypeTag = scala.reflect.TypeTag // needs to be lazy, because requires scala.reflect.mirror instance
- lazy val GroundTypeTag = scala.reflect.GroundTypeTag
+ lazy val TypeTag = scala.reflect.TypeTag // needs to be lazy, because requires scala.reflect.mirror instance
+ lazy val ConcreteTypeTag = scala.reflect.ConcreteTypeTag
// [Eugene to Martin] it's really tedious to type "implicitly[...]" all the time, so I'm reintroducing these shortcuts
- def classTag[T](implicit ctag: ClassTag[T]) = ctag
- def tag[T](implicit ttag: TypeTag[T]) = ttag
- def typeTag[T](implicit ttag: TypeTag[T]) = ttag
- def groundTag[T](implicit gttag: GroundTypeTag[T]) = gttag
- def groundTypeTag[T](implicit gttag: GroundTypeTag[T]) = gttag
+ def classTag[T](implicit ctag: ClassTag[T]) = ctag
+ def tag[T](implicit ttag: TypeTag[T]) = ttag
+ def typeTag[T](implicit ttag: TypeTag[T]) = ttag
+ def concreteTag[T](implicit cttag: ConcreteTypeTag[T]) = cttag
+ def concreteTypeTag[T](implicit cttag: ConcreteTypeTag[T]) = cttag
// Minor variations on identity functions
def identity[A](x: A): A = x // @see `conforms` for the implicit version
diff --git a/src/library/scala/reflect/ClassTags.scala b/src/library/scala/reflect/ClassTags.scala
index 2833e7cc8e..cde6da5539 100644
--- a/src/library/scala/reflect/ClassTags.scala
+++ b/src/library/scala/reflect/ClassTags.scala
@@ -4,11 +4,20 @@ import java.lang.{ Class => jClass }
import scala.reflect.{ mirror => rm }
/** A `ClassTag[T]` wraps a Java class, which can be accessed via the `erasure` method.
+ *
* This is useful in itself, but also enables very important use case.
* Having this knowledge ClassTag can instantiate `Arrays`
* in those cases where the element type is unknown at compile time.
* Hence, ClassTag[T] conforms to the ArrayTag[T] trait.
- */
+ *
+ * If an implicit value of type u.ClassTag[T] is required, the compiler will make one up on demand.
+ * The implicitly created value contains in its erasure field the Java class that is the result of erasing type T.
+ * In that value, any occurrences of type parameters or abstract types U which come themselves with a ClassTag
+ * or a reflect.mirror.ConcreteTypeTag are represented by the type referenced by that tag.
+ * If the type T contains unresolved references to type parameters or abstract types, a static error results.
+ *
+ * A ConcreteTypeTag member of the reflect.mirror object is convertible to a ClassTag via an implicit conversion
+ * (this is not possible to do in all reflection universes because an operation that converts a type to a Java class might not be available). */
// please, don't add any APIs here, like it was with `newWrappedArray` and `newArrayBuilder`
// class tags, and all tags in general, should be as minimalistic as possible
@annotation.implicitNotFound(msg = "No ClassTag available for ${T}")
@@ -20,7 +29,7 @@ abstract case class ClassTag[T](erasure: jClass[_]) extends ArrayTag[T] {
/** A Scala reflection type representing T.
* For ClassTags this representation is lossy (in their case tpe is retrospectively constructed from erasure).
- * For TypeTags and GroundTypeTags the representation is almost precise, because it uses reification
+ * For TypeTags and ConcreteTypeTags the representation is almost precise, because they use reification
* (information is lost only when T refers to non-locatable symbols, which are then reified as free variables). */
def tpe: rm.Type = rm.classToType(erasure)
@@ -153,6 +162,6 @@ class DeprecatedClassManifestApis[T](ctag: ClassTag[T]) {
@deprecated("Use `@scala.collection.mutable.ArrayBuilder` object instead", "2.10.0")
def newArrayBuilder(): ArrayBuilder[T] = ArrayBuilder.make[T]()(ctag)
- @deprecated("`typeArguments` is no longer supported, and will always return an empty list. Use `@scala.reflect.TypeTag` or `@scala.reflect.GroundTypeTag` to capture and analyze type arguments", "2.10.0")
+ @deprecated("`typeArguments` is no longer supported, and will always return an empty list. Use `@scala.reflect.TypeTag` or `@scala.reflect.ConcreteTypeTag` to capture and analyze type arguments", "2.10.0")
def typeArguments: List[OptManifest[_]] = List()
} \ No newline at end of file
diff --git a/src/library/scala/reflect/TagMaterialization.scala b/src/library/scala/reflect/TagMaterialization.scala
index 991feb3bac..5918b6effc 100644
--- a/src/library/scala/reflect/TagMaterialization.scala
+++ b/src/library/scala/reflect/TagMaterialization.scala
@@ -18,13 +18,13 @@ object TagMaterialization {
def materializeTypeTag[T: c.TypeTag](c: Context { type PrefixType = Universe }): c.Expr[c.prefix.value.TypeTag[T]] = {
import c.mirror._
val tpe = implicitly[c.TypeTag[T]].tpe
- c.materializeTypeTag(tpe, requireGroundTypeTag = false)
+ c.materializeTypeTag(tpe, requireConcreteTypeTag = false)
}
- def materializeGroundTypeTag[T: c.TypeTag](c: Context { type PrefixType = Universe }): c.Expr[c.prefix.value.GroundTypeTag[T]] = {
+ def materializeConcreteTypeTag[T: c.TypeTag](c: Context { type PrefixType = Universe }): c.Expr[c.prefix.value.ConcreteTypeTag[T]] = {
import c.mirror._
val tpe = implicitly[c.TypeTag[T]].tpe
- c.materializeTypeTag(tpe, requireGroundTypeTag = true)
+ c.materializeTypeTag(tpe, requireConcreteTypeTag = true)
}
private implicit def context2utils(c0: Context) : Utils { val c: c0.type } = new { val c: c0.type = c0 } with Utils
@@ -52,17 +52,17 @@ object TagMaterialization {
NothingClass.asType -> newTermName("Nothing"),
NullClass.asType -> newTermName("Null"))
- val ReflectPackage = staticModule("scala.reflect.package")
- val Reflect_mirror = selectTerm(ReflectPackage, "mirror")
- val ClassTagClass = staticClass("scala.reflect.ClassTag")
- val ClassTagErasure = selectTerm(ClassTagClass, "erasure")
- val ClassTagModule = staticModule("scala.reflect.ClassTag")
- val TypeTagsClass = staticClass("scala.reflect.api.TypeTags")
- val TypeTagClass = selectType(TypeTagsClass, "TypeTag")
- val TypeTagTpe = selectTerm(TypeTagClass, "tpe")
- val TypeTagModule = selectTerm(TypeTagsClass, "TypeTag")
- val GroundTypeTagClass = selectType(TypeTagsClass, "GroundTypeTag")
- val GroundTypeTagModule = selectTerm(TypeTagsClass, "GroundTypeTag")
+ val ReflectPackage = staticModule("scala.reflect.package")
+ val Reflect_mirror = selectTerm(ReflectPackage, "mirror")
+ val ClassTagClass = staticClass("scala.reflect.ClassTag")
+ val ClassTagErasure = selectTerm(ClassTagClass, "erasure")
+ val ClassTagModule = staticModule("scala.reflect.ClassTag")
+ val TypeTagsClass = staticClass("scala.reflect.api.TypeTags")
+ val TypeTagClass = selectType(TypeTagsClass, "TypeTag")
+ val TypeTagTpe = selectTerm(TypeTagClass, "tpe")
+ val TypeTagModule = selectTerm(TypeTagsClass, "TypeTag")
+ val ConcreteTypeTagClass = selectType(TypeTagsClass, "ConcreteTypeTag")
+ val ConcreteTypeTagModule = selectTerm(TypeTagsClass, "ConcreteTypeTag")
def materializeClassTag(tpe: Type): Tree = {
val prefix = gen.mkAttributedRef(Reflect_mirror) setType singleType(Reflect_mirror.owner.thisPrefix, Reflect_mirror)
@@ -70,8 +70,8 @@ object TagMaterialization {
}
def materializeClassTag(prefix: Tree, tpe: Type): Tree = {
- val typetagInScope = c.inferImplicitValue(appliedType(typeRef(prefix.tpe, TypeTagClass, Nil), List(tpe)))
- def typetagIsSynthetic(tree: Tree) = tree.isInstanceOf[Block] || (tree exists (sub => sub.symbol == TypeTagModule || sub.symbol == GroundTypeTagModule))
+ val typetagInScope = c.inferImplicitValue(appliedType(typeRef(prefix.tpe, ConcreteTypeTagClass, Nil), List(tpe)))
+ def typetagIsSynthetic(tree: Tree) = tree.isInstanceOf[Block] || (tree exists (sub => sub.symbol == TypeTagModule || sub.symbol == ConcreteTypeTagModule))
typetagInScope match {
case success if !success.isEmpty && !typetagIsSynthetic(success) =>
val factory = TypeApply(Select(Ident(ClassTagModule), newTermName("apply")), List(TypeTree(tpe)))
@@ -104,19 +104,19 @@ object TagMaterialization {
}
}
- def materializeTypeTag(tpe: Type, requireGroundTypeTag: Boolean): Tree = {
+ def materializeTypeTag(tpe: Type, requireConcreteTypeTag: Boolean): Tree = {
def prefix: Tree = ??? // todo. needs to be synthesized from c.prefix
- materializeTypeTag(prefix, tpe, requireGroundTypeTag)
+ materializeTypeTag(prefix, tpe, requireConcreteTypeTag)
}
- def materializeTypeTag(prefix: Tree, tpe: Type, requireGroundTypeTag: Boolean): Tree = {
- val tagModule = if (requireGroundTypeTag) GroundTypeTagModule else TypeTagModule
+ def materializeTypeTag(prefix: Tree, tpe: Type, requireConcreteTypeTag: Boolean): Tree = {
+ val tagModule = if (requireConcreteTypeTag) ConcreteTypeTagModule else TypeTagModule
val result =
tpe match {
case coreTpe if coreTags contains coreTpe =>
Select(Select(prefix, tagModule.name), coreTags(coreTpe))
case _ =>
- try c.reifyType(prefix, tpe, dontSpliceAtTopLevel = true, requireGroundTypeTag = requireGroundTypeTag)
+ try c.reifyType(prefix, tpe, dontSpliceAtTopLevel = true, requireConcreteTypeTag = requireConcreteTypeTag)
catch {
case ex: Throwable =>
// [Eugene] cannot pattern match on an abstract type, so had to do this
diff --git a/src/library/scala/reflect/api/StandardDefinitions.scala b/src/library/scala/reflect/api/StandardDefinitions.scala
index b4fedbe055..e457bb73e0 100755
--- a/src/library/scala/reflect/api/StandardDefinitions.scala
+++ b/src/library/scala/reflect/api/StandardDefinitions.scala
@@ -113,8 +113,8 @@ trait StandardDefinitions { self: Universe =>
def ClassTagModule: Symbol
def TypeTagClass: Symbol
def TypeTagModule: Symbol
- def GroundTypeTagClass: Symbol
- def GroundTypeTagModule: Symbol
+ def ConcreteTypeTagClass: Symbol
+ def ConcreteTypeTagModule: Symbol
/** Given a type T, returns the type corresponding to the VM's
* representation: ClassClass's type constructor applied to `arg`.
diff --git a/src/library/scala/reflect/api/TypeTags.scala b/src/library/scala/reflect/api/TypeTags.scala
index a38c21a9d4..ed47620e13 100644
--- a/src/library/scala/reflect/api/TypeTags.scala
+++ b/src/library/scala/reflect/api/TypeTags.scala
@@ -14,14 +14,16 @@ import scala.reflect.{ mirror => rm }
* TypeTags are much better integrated with reflection than manifests are, and are consequently much simpler.
*
* Type tags are organized in a hierarchy of two classes:
- * [[scala.reflect.ClassTag]], [[scala.reflect.api.Universe#TypeTag]] and [[scala.reflect.api.Universe#GroundTypeTag]].
- * A [[scala.reflect.ClassTag]] value wraps a Java class, which can be accessed via the erasure method.
+ * [[scala.reflect.api.Universe#TypeTag]] and [[scala.reflect.api.Universe#ConcreteTypeTag]].
* A [[scala.reflect.api.Universe#TypeTag]] value wraps a full Scala type in its tpe field.
- * A [[scala.reflect.api.Universe#GroundTypeTag]] value is a type tag that is guaranteed not to contain any references to type parameters or abstract types.
+ * A [[scala.reflect.api.Universe#ConcreteTypeTag]] value is a type tag that is guaranteed not to contain any references to type parameters or abstract types.
+ *
+ * It is also possible to capture Java classes by using a different kind of tag.
+ * A [[scala.reflect.ClassTag]] value wraps a Java class, which can be accessed via the erasure method.
*
* TypeTags 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.GroundTypeTag,
+ * 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]].
*
* Implicit in the contract for all Tag classes is that the reified type tpe represents the type parameter T.
@@ -59,38 +61,34 @@ trait TypeTags { self: Universe =>
def sym = tpe.typeSymbol
- def isGround = !isNotGround
- def isNotGround = tpe exists (_.typeSymbol.isAbstractType)
-
- def toGround: GroundTypeTag[T] = {
- assert(isGround, tpe)
- GroundTypeTag[T](tpe)
- }
+ def isConcrete = !isNotConcrete
+ def isNotConcrete = tpe exists (_.typeSymbol.isAbstractType)
+ def toConcrete: ConcreteTypeTag[T] = ConcreteTypeTag[T](tpe)
override def toString = {
- var prefix = if (isGround) "GroundTypeTag" else "TypeTag"
+ var prefix = if (isConcrete) "ConcreteTypeTag" else "TypeTag"
if (prefix != this.productPrefix) prefix = "*" + prefix
prefix + "[" + tpe + "]"
}
}
object TypeTag {
- val Byte : TypeTag[scala.Byte] = GroundTypeTag.Byte
- val Short : TypeTag[scala.Short] = GroundTypeTag.Short
- val Char : TypeTag[scala.Char] = GroundTypeTag.Char
- val Int : TypeTag[scala.Int] = GroundTypeTag.Int
- val Long : TypeTag[scala.Long] = GroundTypeTag.Long
- val Float : TypeTag[scala.Float] = GroundTypeTag.Float
- val Double : TypeTag[scala.Double] = GroundTypeTag.Double
- val Boolean : TypeTag[scala.Boolean] = GroundTypeTag.Boolean
- val Unit : TypeTag[scala.Unit] = GroundTypeTag.Unit
- val Any : TypeTag[scala.Any] = GroundTypeTag.Any
- val Object : TypeTag[java.lang.Object] = GroundTypeTag.Object
- val AnyVal : TypeTag[scala.AnyVal] = GroundTypeTag.AnyVal
- val AnyRef : TypeTag[scala.AnyRef] = GroundTypeTag.AnyRef
- val Nothing : TypeTag[scala.Nothing] = GroundTypeTag.Nothing
- val Null : TypeTag[scala.Null] = GroundTypeTag.Null
- val String : TypeTag[java.lang.String] = GroundTypeTag.String
+ 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 AnyVal : TypeTag[scala.AnyVal] = ConcreteTypeTag.AnyVal
+ val AnyRef : TypeTag[scala.AnyRef] = ConcreteTypeTag.AnyRef
+ val Nothing : TypeTag[scala.Nothing] = ConcreteTypeTag.Nothing
+ val Null : TypeTag[scala.Null] = ConcreteTypeTag.Null
+ val String : TypeTag[java.lang.String] = ConcreteTypeTag.String
def apply[T](tpe: Type): TypeTag[T] =
tpe match {
@@ -115,64 +113,67 @@ trait TypeTags { self: Universe =>
}
/**
- * If an implicit value of type u.GroundTypeTag[T] is required, the compiler will make one up on demand following the same procedure as for TypeTags.
+ * 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.api.TypeTags]]
*/
- @annotation.implicitNotFound(msg = "No GroundTypeTag available for ${T}")
- class GroundTypeTag[T](tpe: Type) extends TypeTag[T](tpe) {
- assert(isGround, tpe)
- override def productPrefix = "GroundTypeTag"
+ @annotation.implicitNotFound(msg = "No ConcreteTypeTag available for ${T}")
+ class ConcreteTypeTag[T](tpe: Type) extends TypeTag[T](tpe) {
+ // it's unsafe to use assert here, because we might run into deadlocks with Predef
+ // also see comments in ClassTags.scala
+ //assert(isConcrete, tpe)
+ if (isNotConcrete) throw new Error("%s (%s) is not concrete and cannot be used to construct a concrete type tag".format(tpe, tpe.kind))
+ override def productPrefix = "ConcreteTypeTag"
}
- object GroundTypeTag {
- val Byte : GroundTypeTag[scala.Byte] = new GroundTypeTag[scala.Byte](ByteTpe) { private def readResolve() = GroundTypeTag.Byte }
- val Short : GroundTypeTag[scala.Short] = new GroundTypeTag[scala.Short](ShortTpe) { private def readResolve() = GroundTypeTag.Short }
- val Char : GroundTypeTag[scala.Char] = new GroundTypeTag[scala.Char](CharTpe) { private def readResolve() = GroundTypeTag.Char }
- val Int : GroundTypeTag[scala.Int] = new GroundTypeTag[scala.Int](IntTpe) { private def readResolve() = GroundTypeTag.Int }
- val Long : GroundTypeTag[scala.Long] = new GroundTypeTag[scala.Long](LongTpe) { private def readResolve() = GroundTypeTag.Long }
- val Float : GroundTypeTag[scala.Float] = new GroundTypeTag[scala.Float](FloatTpe) { private def readResolve() = GroundTypeTag.Float }
- val Double : GroundTypeTag[scala.Double] = new GroundTypeTag[scala.Double](DoubleTpe) { private def readResolve() = GroundTypeTag.Double }
- val Boolean : GroundTypeTag[scala.Boolean] = new GroundTypeTag[scala.Boolean](BooleanTpe) { private def readResolve() = GroundTypeTag.Boolean }
- val Unit : GroundTypeTag[scala.Unit] = new GroundTypeTag[scala.Unit](UnitTpe) { private def readResolve() = GroundTypeTag.Unit }
- val Any : GroundTypeTag[scala.Any] = new GroundTypeTag[scala.Any](AnyTpe) { private def readResolve() = GroundTypeTag.Any }
- val Object : GroundTypeTag[java.lang.Object] = new GroundTypeTag[java.lang.Object](ObjectTpe) { private def readResolve() = GroundTypeTag.Object }
- val AnyVal : GroundTypeTag[scala.AnyVal] = new GroundTypeTag[scala.AnyVal](AnyValTpe) { private def readResolve() = GroundTypeTag.AnyVal }
- val AnyRef : GroundTypeTag[scala.AnyRef] = new GroundTypeTag[scala.AnyRef](AnyRefTpe) { private def readResolve() = GroundTypeTag.AnyRef }
- val Nothing : GroundTypeTag[scala.Nothing] = new GroundTypeTag[scala.Nothing](NothingTpe) { private def readResolve() = GroundTypeTag.Nothing }
- val Null : GroundTypeTag[scala.Null] = new GroundTypeTag[scala.Null](NullTpe) { private def readResolve() = GroundTypeTag.Null }
- val String : GroundTypeTag[java.lang.String] = new GroundTypeTag[java.lang.String](StringTpe) { private def readResolve() = GroundTypeTag.String }
-
- def apply[T](tpe: Type): GroundTypeTag[T] =
+ object ConcreteTypeTag {
+ val Byte : ConcreteTypeTag[scala.Byte] = new ConcreteTypeTag[scala.Byte](ByteTpe) { private def readResolve() = ConcreteTypeTag.Byte }
+ val Short : ConcreteTypeTag[scala.Short] = new ConcreteTypeTag[scala.Short](ShortTpe) { private def readResolve() = ConcreteTypeTag.Short }
+ val Char : ConcreteTypeTag[scala.Char] = new ConcreteTypeTag[scala.Char](CharTpe) { private def readResolve() = ConcreteTypeTag.Char }
+ val Int : ConcreteTypeTag[scala.Int] = new ConcreteTypeTag[scala.Int](IntTpe) { private def readResolve() = ConcreteTypeTag.Int }
+ val Long : ConcreteTypeTag[scala.Long] = new ConcreteTypeTag[scala.Long](LongTpe) { private def readResolve() = ConcreteTypeTag.Long }
+ val Float : ConcreteTypeTag[scala.Float] = new ConcreteTypeTag[scala.Float](FloatTpe) { private def readResolve() = ConcreteTypeTag.Float }
+ val Double : ConcreteTypeTag[scala.Double] = new ConcreteTypeTag[scala.Double](DoubleTpe) { private def readResolve() = ConcreteTypeTag.Double }
+ val Boolean : ConcreteTypeTag[scala.Boolean] = new ConcreteTypeTag[scala.Boolean](BooleanTpe) { private def readResolve() = ConcreteTypeTag.Boolean }
+ val Unit : ConcreteTypeTag[scala.Unit] = new ConcreteTypeTag[scala.Unit](UnitTpe) { private def readResolve() = ConcreteTypeTag.Unit }
+ val Any : ConcreteTypeTag[scala.Any] = new ConcreteTypeTag[scala.Any](AnyTpe) { private def readResolve() = ConcreteTypeTag.Any }
+ val Object : ConcreteTypeTag[java.lang.Object] = new ConcreteTypeTag[java.lang.Object](ObjectTpe) { private def readResolve() = ConcreteTypeTag.Object }
+ val AnyVal : ConcreteTypeTag[scala.AnyVal] = new ConcreteTypeTag[scala.AnyVal](AnyValTpe) { private def readResolve() = ConcreteTypeTag.AnyVal }
+ val AnyRef : ConcreteTypeTag[scala.AnyRef] = new ConcreteTypeTag[scala.AnyRef](AnyRefTpe) { private def readResolve() = ConcreteTypeTag.AnyRef }
+ val Nothing : ConcreteTypeTag[scala.Nothing] = new ConcreteTypeTag[scala.Nothing](NothingTpe) { private def readResolve() = ConcreteTypeTag.Nothing }
+ val Null : ConcreteTypeTag[scala.Null] = new ConcreteTypeTag[scala.Null](NullTpe) { private def readResolve() = ConcreteTypeTag.Null }
+ val String : ConcreteTypeTag[java.lang.String] = new ConcreteTypeTag[java.lang.String](StringTpe) { private def readResolve() = ConcreteTypeTag.String }
+
+ def apply[T](tpe: Type): ConcreteTypeTag[T] =
tpe match {
- case ByteTpe => GroundTypeTag.Byte.asInstanceOf[GroundTypeTag[T]]
- case ShortTpe => GroundTypeTag.Short.asInstanceOf[GroundTypeTag[T]]
- case CharTpe => GroundTypeTag.Char.asInstanceOf[GroundTypeTag[T]]
- case IntTpe => GroundTypeTag.Int.asInstanceOf[GroundTypeTag[T]]
- case LongTpe => GroundTypeTag.Long.asInstanceOf[GroundTypeTag[T]]
- case FloatTpe => GroundTypeTag.Float.asInstanceOf[GroundTypeTag[T]]
- case DoubleTpe => GroundTypeTag.Double.asInstanceOf[GroundTypeTag[T]]
- case BooleanTpe => GroundTypeTag.Boolean.asInstanceOf[GroundTypeTag[T]]
- case UnitTpe => GroundTypeTag.Unit.asInstanceOf[GroundTypeTag[T]]
- case AnyTpe => GroundTypeTag.Any.asInstanceOf[GroundTypeTag[T]]
- case ObjectTpe => GroundTypeTag.Object.asInstanceOf[GroundTypeTag[T]]
- case AnyValTpe => GroundTypeTag.AnyVal.asInstanceOf[GroundTypeTag[T]]
- case AnyRefTpe => GroundTypeTag.AnyRef.asInstanceOf[GroundTypeTag[T]]
- case NothingTpe => GroundTypeTag.Nothing.asInstanceOf[GroundTypeTag[T]]
- case NullTpe => GroundTypeTag.Null.asInstanceOf[GroundTypeTag[T]]
- case StringTpe => GroundTypeTag.String.asInstanceOf[GroundTypeTag[T]]
- case _ => new GroundTypeTag[T](tpe) {}
+ 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 AnyValTpe => ConcreteTypeTag.AnyVal.asInstanceOf[ConcreteTypeTag[T]]
+ case AnyRefTpe => ConcreteTypeTag.AnyRef.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 ConcreteTypeTag[T](tpe) {}
}
- def unapply[T](ttag: TypeTag[T]): Option[Type] = if (ttag.isGround) Some(ttag.tpe) else None
+ def unapply[T](ttag: TypeTag[T]): Option[Type] = if (ttag.isConcrete) Some(ttag.tpe) else None
- implicit def toClassTag[T](ttag: rm.GroundTypeTag[T]): ClassTag[T] = ClassTag[T](rm.typeToClass(ttag.tpe.erasure))
+ implicit def toClassTag[T](ttag: rm.ConcreteTypeTag[T]): ClassTag[T] = ClassTag[T](rm.typeToClass(ttag.tpe.erasure))
- implicit def toDeprecatedManifestApis[T](ttag: rm.GroundTypeTag[T]): DeprecatedManifestApis[T] = new DeprecatedManifestApis[T](ttag)
+ implicit def toDeprecatedManifestApis[T](ttag: rm.ConcreteTypeTag[T]): DeprecatedManifestApis[T] = new DeprecatedManifestApis[T](ttag)
// this class should not be used directly in client code
- class DeprecatedManifestApis[T](ttag: rm.GroundTypeTag[T]) extends DeprecatedClassManifestApis[T](toClassTag(ttag)) {
+ class DeprecatedManifestApis[T](ttag: rm.ConcreteTypeTag[T]) extends DeprecatedClassManifestApis[T](toClassTag(ttag)) {
@deprecated("Use `tpe` to analyze the underlying type", "2.10.0")
def <:<(that: Manifest[_]): Boolean = ttag.tpe <:< that.tpe
@@ -180,7 +181,7 @@ trait TypeTags { self: Universe =>
def >:>(that: Manifest[_]): Boolean = that <:< ttag
@deprecated("Use `tpe` to analyze the type arguments", "2.10.0")
- override def typeArguments: List[Manifest[_]] = ttag.tpe.typeArguments map (targ => rm.GroundTypeTag(targ))
+ override def typeArguments: List[Manifest[_]] = ttag.tpe.typeArguments map (targ => rm.ConcreteTypeTag(targ))
}
}
@@ -188,6 +189,6 @@ trait TypeTags { self: Universe =>
// moved to Context, since rm.tags have their own incantations in Predef, and these guys are only useful in macros
// def tag[T](implicit ttag: TypeTag[T]) = ttag
// def typeTag[T](implicit ttag: TypeTag[T]) = ttag
-// def groundTag[T](implicit gttag: GroundTypeTag[T]) = gttag
-// def groundTypeTag[T](implicit gttag: GroundTypeTag[T]) = gttag
+// def concreteTag[T](implicit gttag: ConcreteTypeTag[T]) = cttag
+// def concreteTypeTag[T](implicit gttag: ConcreteTypeTag[T]) = cttag
} \ No newline at end of file
diff --git a/src/library/scala/reflect/makro/Aliases.scala b/src/library/scala/reflect/makro/Aliases.scala
index e8b847600c..38b1065a40 100644
--- a/src/library/scala/reflect/makro/Aliases.scala
+++ b/src/library/scala/reflect/makro/Aliases.scala
@@ -21,6 +21,6 @@ trait Aliases {
/** incantations for summoning tags */
def tag[T](implicit ttag: TypeTag[T]) = ttag
def typeTag[T](implicit ttag: TypeTag[T]) = ttag
- def groundTag[T](implicit gttag: GroundTypeTag[T]) = gttag
- def groundTypeTag[T](implicit gttag: GroundTypeTag[T]) = gttag
+ def concreteTag[T](implicit cttag: ConcreteTypeTag[T]) = cttag
+ def concreteTypeTag[T](implicit cttag: ConcreteTypeTag[T]) = cttag
}
diff --git a/src/library/scala/reflect/makro/Reifiers.scala b/src/library/scala/reflect/makro/Reifiers.scala
index 9bd25cf0f8..d690df6aee 100644
--- a/src/library/scala/reflect/makro/Reifiers.scala
+++ b/src/library/scala/reflect/makro/Reifiers.scala
@@ -46,7 +46,7 @@ trait Reifiers {
* The produced tree will be bound to the mirror specified by ``prefix'' (also see ``reflectMirrorPrefix'').
* For more information and examples see the documentation for ``Context.reifyTree'' and ``Universe.reify''.
*/
- def reifyType(prefix: Tree, tpe: Type, dontSpliceAtTopLevel: Boolean = false, requireGroundTypeTag: Boolean = false): Tree
+ def reifyType(prefix: Tree, tpe: Type, dontSpliceAtTopLevel: Boolean = false, requireConcreteTypeTag: Boolean = false): Tree
/** Undoes reification of a tree.
*
diff --git a/src/library/scala/reflect/makro/internal/typeTagImpl.scala b/src/library/scala/reflect/makro/internal/typeTagImpl.scala
index 6c49ef45de..de404ff39f 100644
--- a/src/library/scala/reflect/makro/internal/typeTagImpl.scala
+++ b/src/library/scala/reflect/makro/internal/typeTagImpl.scala
@@ -16,14 +16,14 @@ package object internal {
/** This method is required by the compiler and <b>should not be used in client code</b>. */
def materializeTypeTag_impl[T: c.TypeTag](c: Context)(u: c.Expr[Universe]): c.Expr[u.value.TypeTag[T]] =
- c.Expr[Nothing](c.materializeTypeTag(u.tree, implicitly[c.TypeTag[T]].tpe, requireGroundTypeTag = false))(c.TypeTag.Nothing)
+ c.Expr[Nothing](c.materializeTypeTag(u.tree, implicitly[c.TypeTag[T]].tpe, requireConcreteTypeTag = false))(c.TypeTag.Nothing)
/** This method is required by the compiler and <b>should not be used in client code</b>. */
- def materializeGroundTypeTag[T](u: Universe): u.GroundTypeTag[T] = macro materializeGroundTypeTag_impl[T]
+ def materializeConcreteTypeTag[T](u: Universe): u.ConcreteTypeTag[T] = macro materializeConcreteTypeTag_impl[T]
/** This method is required by the compiler and <b>should not be used in client code</b>. */
- def materializeGroundTypeTag_impl[T: c.TypeTag](c: Context)(u: c.Expr[Universe]): c.Expr[u.value.GroundTypeTag[T]] =
- c.Expr[Nothing](c.materializeTypeTag(u.tree, implicitly[c.TypeTag[T]].tpe, requireGroundTypeTag = true))(c.TypeTag.Nothing)
+ def materializeConcreteTypeTag_impl[T: c.TypeTag](c: Context)(u: c.Expr[Universe]): c.Expr[u.value.ConcreteTypeTag[T]] =
+ c.Expr[Nothing](c.materializeTypeTag(u.tree, implicitly[c.TypeTag[T]].tpe, requireConcreteTypeTag = true))(c.TypeTag.Nothing)
/** This method is required by the compiler and <b>should not be used in client code</b>. */
private[scala] implicit def context2utils(c0: Context) : Utils { val c: c0.type } = new { val c: c0.type = c0 } with Utils
@@ -54,8 +54,8 @@ package internal {
NullClass.asType -> newTermName("Null"))
def materializeClassTag(prefix: Tree, tpe: Type): Tree = {
- val typetagInScope = c.inferImplicitValue(appliedType(typeRef(prefix.tpe, TypeTagClass, Nil), List(tpe)))
- def typetagIsSynthetic(tree: Tree) = tree.isInstanceOf[Block] || (tree exists (sub => sub.symbol == TypeTagModule || sub.symbol == GroundTypeTagModule))
+ val typetagInScope = c.inferImplicitValue(appliedType(typeRef(prefix.tpe, ConcreteTypeTagClass, Nil), List(tpe)))
+ def typetagIsSynthetic(tree: Tree) = tree.isInstanceOf[Block] || (tree exists (sub => sub.symbol == TypeTagModule || sub.symbol == ConcreteTypeTagModule))
typetagInScope match {
case success if !success.isEmpty && !typetagIsSynthetic(success) =>
val factory = TypeApply(Select(Ident(ClassTagModule), newTermName("apply")), List(TypeTree(tpe)))
@@ -88,14 +88,14 @@ package internal {
}
}
- def materializeTypeTag(prefix: Tree, tpe: Type, requireGroundTypeTag: Boolean): Tree = {
- val tagModule = if (requireGroundTypeTag) GroundTypeTagModule else TypeTagModule
+ def materializeTypeTag(prefix: Tree, tpe: Type, requireConcreteTypeTag: Boolean): Tree = {
+ val tagModule = if (requireConcreteTypeTag) ConcreteTypeTagModule else TypeTagModule
val result =
tpe match {
case coreTpe if coreTags contains coreTpe =>
Select(Select(prefix, tagModule.name), coreTags(coreTpe))
case _ =>
- try c.reifyType(prefix, tpe, dontSpliceAtTopLevel = true, requireGroundTypeTag = requireGroundTypeTag)
+ try c.reifyType(prefix, tpe, dontSpliceAtTopLevel = true, requireConcreteTypeTag = requireConcreteTypeTag)
catch {
case ex: Throwable =>
// [Eugene] cannot pattern match on an abstract type, so had to do this
diff --git a/src/library/scala/reflect/package.scala b/src/library/scala/reflect/package.scala
index 7a8267e689..1738642932 100644
--- a/src/library/scala/reflect/package.scala
+++ b/src/library/scala/reflect/package.scala
@@ -43,21 +43,21 @@ package object reflect {
type ClassManifest[T] = ClassTag[T]
@deprecated("OptManifest is no longer supported, and using it may lead to incorrect results, Use `@scala.reflect.TypeTag` instead", "2.10.0")
type OptManifest[T] = TypeTag[T]
- @deprecated("Use `@scala.reflect.GroundTypeTag` instead", "2.10.0")
- type Manifest[T] = GroundTypeTag[T]
+ @deprecated("Use `@scala.reflect.ConcreteTypeTag` instead", "2.10.0")
+ type Manifest[T] = ConcreteTypeTag[T]
@deprecated("Use `@scala.reflect.ClassTag` instead", "2.10.0")
val ClassManifest = ClassTag
- @deprecated("Use `@scala.reflect.GroundTypeTag` instead", "2.10.0")
- lazy val Manifest = GroundTypeTag
+ @deprecated("Use `@scala.reflect.ConcreteTypeTag` instead", "2.10.0")
+ lazy val Manifest = ConcreteTypeTag
@deprecated("NoManifest is no longer supported, and using it may lead to incorrect results, Use `@scala.reflect.TypeTag` instead", "2.10.0")
object NoManifest extends OptManifest[Nothing](scala.reflect.mirror.definitions.NothingClass.asType) with Serializable
// ClassTag class is defined separately from the mirror
- type TypeTag[T] = scala.reflect.mirror.TypeTag[T]
- type GroundTypeTag[T] = scala.reflect.mirror.GroundTypeTag[T]
+ type TypeTag[T] = scala.reflect.mirror.TypeTag[T]
+ type ConcreteTypeTag[T] = scala.reflect.mirror.ConcreteTypeTag[T]
// ClassTag object is defined separately from the mirror
- lazy val TypeTag = scala.reflect.mirror.TypeTag
- lazy val GroundTypeTag = scala.reflect.mirror.GroundTypeTag
+ lazy val TypeTag = scala.reflect.mirror.TypeTag
+ lazy val ConcreteTypeTag = scala.reflect.mirror.ConcreteTypeTag
}