From 814cf34fb00f9ccb001249f4b3445ebc4f9942c9 Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Thu, 12 Apr 2012 01:59:46 +0200 Subject: Next generation of macros Implements SIP 16: Self-cleaning macros: http://bit.ly/wjjXTZ Features: * Macro defs * Reification * Type tags * Manifests aliased to type tags * Extended reflection API * Several hundred tests * 1111 changed files Not yet implemented: * Reification of refined types * Expr.value splicing * Named and default macro expansions * Intricacies of interaction between macros and implicits * Emission of debug information for macros (compliant with JSR-45) Dedicated to Yuri Alekseyevich Gagarin --- test/files/run/macro-expand-tparams-prefix-a.check | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 test/files/run/macro-expand-tparams-prefix-a.check (limited to 'test/files/run/macro-expand-tparams-prefix-a.check') diff --git a/test/files/run/macro-expand-tparams-prefix-a.check b/test/files/run/macro-expand-tparams-prefix-a.check new file mode 100644 index 0000000000..1447c2478f --- /dev/null +++ b/test/files/run/macro-expand-tparams-prefix-a.check @@ -0,0 +1,4 @@ +GroundTypeTag[Int] +GroundTypeTag[Int] +GroundTypeTag[String] +GroundTypeTag[Boolean] -- cgit v1.2.3 From 46d0d73f66111d5d31b9fd593972970d7e9056bb Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Thu, 12 Apr 2012 11:32:31 +0200 Subject: GroundTypeTag => ConcreteTypeTag --- lib/scala-compiler.jar.desired.sha1 | 2 +- lib/scala-library.jar.desired.sha1 | 2 +- .../scala/reflect/internal/Definitions.scala | 22 +-- src/compiler/scala/reflect/internal/StdNames.scala | 4 +- .../scala/reflect/makro/runtime/Reifiers.scala | 8 +- src/compiler/scala/reflect/reify/Errors.scala | 4 +- src/compiler/scala/reflect/reify/Reifiers.scala | 6 +- .../scala/reflect/reify/codegen/Types.scala | 20 +-- src/compiler/scala/reflect/reify/package.scala | 6 +- .../scala/tools/nsc/typechecker/Implicits.scala | 4 +- .../scala/tools/nsc/typechecker/Macros.scala | 2 +- .../scala/tools/nsc/typechecker/Typers.scala | 2 +- src/library/scala/Predef.scala | 26 ++-- src/library/scala/reflect/ClassTags.scala | 15 +- src/library/scala/reflect/TagMaterialization.scala | 42 +++--- .../scala/reflect/api/StandardDefinitions.scala | 4 +- src/library/scala/reflect/api/TypeTags.scala | 153 +++++++++++---------- src/library/scala/reflect/makro/Aliases.scala | 4 +- src/library/scala/reflect/makro/Reifiers.scala | 2 +- .../scala/reflect/makro/internal/typeTagImpl.scala | 18 +-- src/library/scala/reflect/package.scala | 16 +-- ...o-reify-groundtypetag-hktypeparams-notags.check | 8 +- .../Test.scala | 4 +- ...cro-reify-groundtypetag-typeparams-notags.check | 8 +- .../Test.scala | 4 +- .../neg/macro-reify-groundtypetag-usetypetag.check | 8 +- .../Test.scala | 4 +- test/files/neg/t3507.check | 2 +- test/files/neg/t3692.check | 4 +- test/files/run/groundtypetags_core.check | 30 ++-- test/files/run/groundtypetags_core.scala | 60 ++++---- test/files/run/macro-expand-nullary-generic.check | 10 +- test/files/run/macro-expand-tparams-explicit.check | 2 +- test/files/run/macro-expand-tparams-implicit.check | 4 +- test/files/run/macro-expand-tparams-prefix-a.check | 8 +- test/files/run/macro-expand-tparams-prefix-b.check | 4 +- .../files/run/macro-expand-tparams-prefix-c1.check | 6 +- .../files/run/macro-expand-tparams-prefix-c2.check | 6 +- .../files/run/macro-expand-tparams-prefix-d1.check | 2 +- .../macro-reify-groundtypetag-notypeparams.check | 4 +- .../Test.scala | 4 +- ...macro-reify-groundtypetag-typeparams-tags.check | 4 +- .../Test.scala | 6 +- .../run/macro-reify-typetag-notypeparams.check | 4 +- .../macro-reify-typetag-typeparams-notags.check | 4 +- .../run/macro-reify-typetag-typeparams-tags.check | 4 +- .../run/macro-reify-typetag-usegroundtypetag.check | 4 +- .../Test.scala | 2 +- .../files/run/macro-typecheck-macrosdisabled.check | 2 +- test/files/run/macro-undetparams-consfromsls.check | 6 +- test/files/run/macro-undetparams-implicitval.check | 2 +- test/files/run/macro-undetparams-macroitself.check | 4 +- test/files/run/primitive-sigs-2.check | 2 +- test/files/run/reify_newimpl_25.check | 2 +- test/files/run/reify_newimpl_26.check | 2 +- .../run/toolbox_typecheck_macrosdisabled.check | 2 +- test/files/run/typetags_core.check | 30 ++-- .../Test.scala | 6 +- 58 files changed, 320 insertions(+), 310 deletions(-) (limited to 'test/files/run/macro-expand-tparams-prefix-a.check') diff --git a/lib/scala-compiler.jar.desired.sha1 b/lib/scala-compiler.jar.desired.sha1 index d74b6353d9..3f94b85db9 100644 --- a/lib/scala-compiler.jar.desired.sha1 +++ b/lib/scala-compiler.jar.desired.sha1 @@ -1 +1 @@ -d2808836aef2cbee506f9b0b0e346c749cac9ad8 ?scala-compiler.jar +82af2cfc6a81ae12f39c55c9cf684c5ec01971d3 ?scala-compiler.jar diff --git a/lib/scala-library.jar.desired.sha1 b/lib/scala-library.jar.desired.sha1 index 78e9f0b593..bf1f4829f2 100644 --- a/lib/scala-library.jar.desired.sha1 +++ b/lib/scala-library.jar.desired.sha1 @@ -1 +1 @@ -752baeeb4a01c7c50ac0dc6e0f59f5598696a223 ?scala-library.jar +6a58ca2e4398623145c179f4ce215bfb86a065c4 ?scala-library.jar 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 = "" @@ -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 should not be used in client code. */ 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 should not be used in client code. */ - 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 should not be used in client code. */ - 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 should not be used in client code. */ 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 } diff --git a/test/files/neg/macro-reify-groundtypetag-hktypeparams-notags.check b/test/files/neg/macro-reify-groundtypetag-hktypeparams-notags.check index d9c390ba25..39e90f827e 100644 --- a/test/files/neg/macro-reify-groundtypetag-hktypeparams-notags.check +++ b/test/files/neg/macro-reify-groundtypetag-hktypeparams-notags.check @@ -1,7 +1,7 @@ -Test.scala:5: error: No GroundTypeTag available for C[T] - println(implicitly[GroundTypeTag[C[T]]]) +Test.scala:5: error: No ConcreteTypeTag available for C[T] + println(implicitly[ConcreteTypeTag[C[T]]]) ^ -Test.scala:6: error: No GroundTypeTag available for List[C[T]] - println(implicitly[GroundTypeTag[List[C[T]]]]) +Test.scala:6: error: No ConcreteTypeTag available for List[C[T]] + println(implicitly[ConcreteTypeTag[List[C[T]]]]) ^ two errors found diff --git a/test/files/neg/macro-reify-groundtypetag-hktypeparams-notags/Test.scala b/test/files/neg/macro-reify-groundtypetag-hktypeparams-notags/Test.scala index d5ee61b91d..1302999da6 100644 --- a/test/files/neg/macro-reify-groundtypetag-hktypeparams-notags/Test.scala +++ b/test/files/neg/macro-reify-groundtypetag-hktypeparams-notags/Test.scala @@ -2,8 +2,8 @@ import scala.reflect.mirror._ object Test extends App { def fooNoTypeTagHK[C[_], T] = { - println(implicitly[GroundTypeTag[C[T]]]) - println(implicitly[GroundTypeTag[List[C[T]]]]) + println(implicitly[ConcreteTypeTag[C[T]]]) + println(implicitly[ConcreteTypeTag[List[C[T]]]]) } fooNoTypeTagHK[List, Int] } \ No newline at end of file diff --git a/test/files/neg/macro-reify-groundtypetag-typeparams-notags.check b/test/files/neg/macro-reify-groundtypetag-typeparams-notags.check index c678a2a313..164ca3543f 100644 --- a/test/files/neg/macro-reify-groundtypetag-typeparams-notags.check +++ b/test/files/neg/macro-reify-groundtypetag-typeparams-notags.check @@ -1,7 +1,7 @@ -Test.scala:5: error: No GroundTypeTag available for T - println(implicitly[GroundTypeTag[T]]) +Test.scala:5: error: No ConcreteTypeTag available for T + println(implicitly[ConcreteTypeTag[T]]) ^ -Test.scala:6: error: No GroundTypeTag available for List[T] - println(implicitly[GroundTypeTag[List[T]]]) +Test.scala:6: error: No ConcreteTypeTag available for List[T] + println(implicitly[ConcreteTypeTag[List[T]]]) ^ two errors found diff --git a/test/files/neg/macro-reify-groundtypetag-typeparams-notags/Test.scala b/test/files/neg/macro-reify-groundtypetag-typeparams-notags/Test.scala index 98bdf6d67f..d2276ce333 100644 --- a/test/files/neg/macro-reify-groundtypetag-typeparams-notags/Test.scala +++ b/test/files/neg/macro-reify-groundtypetag-typeparams-notags/Test.scala @@ -2,8 +2,8 @@ import scala.reflect.mirror._ object Test extends App { def fooNoTypeTag[T] = { - println(implicitly[GroundTypeTag[T]]) - println(implicitly[GroundTypeTag[List[T]]]) + println(implicitly[ConcreteTypeTag[T]]) + println(implicitly[ConcreteTypeTag[List[T]]]) } fooNoTypeTag[Int] } \ No newline at end of file diff --git a/test/files/neg/macro-reify-groundtypetag-usetypetag.check b/test/files/neg/macro-reify-groundtypetag-usetypetag.check index c678a2a313..164ca3543f 100644 --- a/test/files/neg/macro-reify-groundtypetag-usetypetag.check +++ b/test/files/neg/macro-reify-groundtypetag-usetypetag.check @@ -1,7 +1,7 @@ -Test.scala:5: error: No GroundTypeTag available for T - println(implicitly[GroundTypeTag[T]]) +Test.scala:5: error: No ConcreteTypeTag available for T + println(implicitly[ConcreteTypeTag[T]]) ^ -Test.scala:6: error: No GroundTypeTag available for List[T] - println(implicitly[GroundTypeTag[List[T]]]) +Test.scala:6: error: No ConcreteTypeTag available for List[T] + println(implicitly[ConcreteTypeTag[List[T]]]) ^ two errors found diff --git a/test/files/neg/macro-reify-groundtypetag-usetypetag/Test.scala b/test/files/neg/macro-reify-groundtypetag-usetypetag/Test.scala index 507d03a390..d82cdc33e9 100644 --- a/test/files/neg/macro-reify-groundtypetag-usetypetag/Test.scala +++ b/test/files/neg/macro-reify-groundtypetag-usetypetag/Test.scala @@ -2,8 +2,8 @@ import scala.reflect.mirror._ object Test extends App { def fooTypeTag[T: TypeTag] = { - println(implicitly[GroundTypeTag[T]]) - println(implicitly[GroundTypeTag[List[T]]]) + println(implicitly[ConcreteTypeTag[T]]) + println(implicitly[ConcreteTypeTag[List[T]]]) } fooTypeTag[Int] } \ No newline at end of file diff --git a/test/files/neg/t3507.check b/test/files/neg/t3507.check index 6b6df6ba76..71bf295039 100644 --- a/test/files/neg/t3507.check +++ b/test/files/neg/t3507.check @@ -1,4 +1,4 @@ -t3507.scala:13: error: No GroundTypeTag available for _1.b.c.type +t3507.scala:13: error: No ConcreteTypeTag available for _1.b.c.type mani/*[object _1.b.c]*/(c) // kaboom in manifestOfType / TreeGen.mkAttributedQualifier ^ one error found diff --git a/test/files/neg/t3692.check b/test/files/neg/t3692.check index ec67e76bb4..d83abd31e2 100644 --- a/test/files/neg/t3692.check +++ b/test/files/neg/t3692.check @@ -1,7 +1,7 @@ -t3692.scala:11: warning: type Manifest in object Predef is deprecated: Use `@scala.reflect.GroundTypeTag` instead +t3692.scala:11: warning: type Manifest in object Predef is deprecated: Use `@scala.reflect.ConcreteTypeTag` instead private final def toJavaMap[T, V](map: Map[T, V])(implicit m1: Manifest[T], m2: Manifest[V]): java.util.Map[_, _] = { ^ -t3692.scala:11: warning: type Manifest in object Predef is deprecated: Use `@scala.reflect.GroundTypeTag` instead +t3692.scala:11: warning: type Manifest in object Predef is deprecated: Use `@scala.reflect.ConcreteTypeTag` instead private final def toJavaMap[T, V](map: Map[T, V])(implicit m1: Manifest[T], m2: Manifest[V]): java.util.Map[_, _] = { ^ t3692.scala:15: error: unreachable code diff --git a/test/files/run/groundtypetags_core.check b/test/files/run/groundtypetags_core.check index d1b71f0926..62fcb481ae 100644 --- a/test/files/run/groundtypetags_core.check +++ b/test/files/run/groundtypetags_core.check @@ -1,30 +1,30 @@ true -GroundTypeTag[Byte] +ConcreteTypeTag[Byte] true -GroundTypeTag[Short] +ConcreteTypeTag[Short] true -GroundTypeTag[Char] +ConcreteTypeTag[Char] true -GroundTypeTag[Int] +ConcreteTypeTag[Int] true -GroundTypeTag[Long] +ConcreteTypeTag[Long] true -GroundTypeTag[Float] +ConcreteTypeTag[Float] true -GroundTypeTag[Double] +ConcreteTypeTag[Double] true -GroundTypeTag[Boolean] +ConcreteTypeTag[Boolean] true -GroundTypeTag[Unit] +ConcreteTypeTag[Unit] true -GroundTypeTag[Any] +ConcreteTypeTag[Any] true -GroundTypeTag[Object] +ConcreteTypeTag[Object] true -GroundTypeTag[AnyVal] +ConcreteTypeTag[AnyVal] true -GroundTypeTag[AnyRef] +ConcreteTypeTag[AnyRef] true -GroundTypeTag[Null] +ConcreteTypeTag[Null] true -GroundTypeTag[Nothing] +ConcreteTypeTag[Nothing] diff --git a/test/files/run/groundtypetags_core.scala b/test/files/run/groundtypetags_core.scala index d779e3fc7e..8b81a0c795 100644 --- a/test/files/run/groundtypetags_core.scala +++ b/test/files/run/groundtypetags_core.scala @@ -1,32 +1,32 @@ object Test extends App { - println(implicitly[GroundTypeTag[Byte]] eq GroundTypeTag.Byte) - println(implicitly[GroundTypeTag[Byte]]) - println(implicitly[GroundTypeTag[Short]] eq GroundTypeTag.Short) - println(implicitly[GroundTypeTag[Short]]) - println(implicitly[GroundTypeTag[Char]] eq GroundTypeTag.Char) - println(implicitly[GroundTypeTag[Char]]) - println(implicitly[GroundTypeTag[Int]] eq GroundTypeTag.Int) - println(implicitly[GroundTypeTag[Int]]) - println(implicitly[GroundTypeTag[Long]] eq GroundTypeTag.Long) - println(implicitly[GroundTypeTag[Long]]) - println(implicitly[GroundTypeTag[Float]] eq GroundTypeTag.Float) - println(implicitly[GroundTypeTag[Float]]) - println(implicitly[GroundTypeTag[Double]] eq GroundTypeTag.Double) - println(implicitly[GroundTypeTag[Double]]) - println(implicitly[GroundTypeTag[Boolean]] eq GroundTypeTag.Boolean) - println(implicitly[GroundTypeTag[Boolean]]) - println(implicitly[GroundTypeTag[Unit]] eq GroundTypeTag.Unit) - println(implicitly[GroundTypeTag[Unit]]) - println(implicitly[GroundTypeTag[Any]] eq GroundTypeTag.Any) - println(implicitly[GroundTypeTag[Any]]) - println(implicitly[GroundTypeTag[Object]] eq GroundTypeTag.Object) - println(implicitly[GroundTypeTag[Object]]) - println(implicitly[GroundTypeTag[AnyVal]] eq GroundTypeTag.AnyVal) - println(implicitly[GroundTypeTag[AnyVal]]) - println(implicitly[GroundTypeTag[AnyRef]] eq GroundTypeTag.AnyRef) - println(implicitly[GroundTypeTag[AnyRef]]) - println(implicitly[GroundTypeTag[Null]] eq GroundTypeTag.Null) - println(implicitly[GroundTypeTag[Null]]) - println(implicitly[GroundTypeTag[Nothing]] eq GroundTypeTag.Nothing) - println(implicitly[GroundTypeTag[Nothing]]) + println(implicitly[ConcreteTypeTag[Byte]] eq ConcreteTypeTag.Byte) + println(implicitly[ConcreteTypeTag[Byte]]) + println(implicitly[ConcreteTypeTag[Short]] eq ConcreteTypeTag.Short) + println(implicitly[ConcreteTypeTag[Short]]) + println(implicitly[ConcreteTypeTag[Char]] eq ConcreteTypeTag.Char) + println(implicitly[ConcreteTypeTag[Char]]) + println(implicitly[ConcreteTypeTag[Int]] eq ConcreteTypeTag.Int) + println(implicitly[ConcreteTypeTag[Int]]) + println(implicitly[ConcreteTypeTag[Long]] eq ConcreteTypeTag.Long) + println(implicitly[ConcreteTypeTag[Long]]) + println(implicitly[ConcreteTypeTag[Float]] eq ConcreteTypeTag.Float) + println(implicitly[ConcreteTypeTag[Float]]) + println(implicitly[ConcreteTypeTag[Double]] eq ConcreteTypeTag.Double) + println(implicitly[ConcreteTypeTag[Double]]) + println(implicitly[ConcreteTypeTag[Boolean]] eq ConcreteTypeTag.Boolean) + println(implicitly[ConcreteTypeTag[Boolean]]) + println(implicitly[ConcreteTypeTag[Unit]] eq ConcreteTypeTag.Unit) + println(implicitly[ConcreteTypeTag[Unit]]) + println(implicitly[ConcreteTypeTag[Any]] eq ConcreteTypeTag.Any) + println(implicitly[ConcreteTypeTag[Any]]) + println(implicitly[ConcreteTypeTag[Object]] eq ConcreteTypeTag.Object) + println(implicitly[ConcreteTypeTag[Object]]) + println(implicitly[ConcreteTypeTag[AnyVal]] eq ConcreteTypeTag.AnyVal) + println(implicitly[ConcreteTypeTag[AnyVal]]) + println(implicitly[ConcreteTypeTag[AnyRef]] eq ConcreteTypeTag.AnyRef) + println(implicitly[ConcreteTypeTag[AnyRef]]) + println(implicitly[ConcreteTypeTag[Null]] eq ConcreteTypeTag.Null) + println(implicitly[ConcreteTypeTag[Null]]) + println(implicitly[ConcreteTypeTag[Nothing]] eq ConcreteTypeTag.Nothing) + println(implicitly[ConcreteTypeTag[Nothing]]) } \ No newline at end of file diff --git a/test/files/run/macro-expand-nullary-generic.check b/test/files/run/macro-expand-nullary-generic.check index 34a453cd3a..6dfe04af12 100644 --- a/test/files/run/macro-expand-nullary-generic.check +++ b/test/files/run/macro-expand-nullary-generic.check @@ -1,6 +1,6 @@ -it works GroundTypeTag[Int] -it works GroundTypeTag[Int] -it works GroundTypeTag[Int] -it works GroundTypeTag[Int] -it works GroundTypeTag[Int] +it works ConcreteTypeTag[Int] +it works ConcreteTypeTag[Int] +it works ConcreteTypeTag[Int] +it works ConcreteTypeTag[Int] +it works ConcreteTypeTag[Int] kkthxbai diff --git a/test/files/run/macro-expand-tparams-explicit.check b/test/files/run/macro-expand-tparams-explicit.check index 54da026aa8..5670e27c4e 100644 --- a/test/files/run/macro-expand-tparams-explicit.check +++ b/test/files/run/macro-expand-tparams-explicit.check @@ -1 +1 @@ -GroundTypeTag[Int] +ConcreteTypeTag[Int] diff --git a/test/files/run/macro-expand-tparams-implicit.check b/test/files/run/macro-expand-tparams-implicit.check index 60c021a35b..e57fc1217b 100644 --- a/test/files/run/macro-expand-tparams-implicit.check +++ b/test/files/run/macro-expand-tparams-implicit.check @@ -1,2 +1,2 @@ -GroundTypeTag[Int] -GroundTypeTag[String] +ConcreteTypeTag[Int] +ConcreteTypeTag[String] diff --git a/test/files/run/macro-expand-tparams-prefix-a.check b/test/files/run/macro-expand-tparams-prefix-a.check index 1447c2478f..922be1a6dd 100644 --- a/test/files/run/macro-expand-tparams-prefix-a.check +++ b/test/files/run/macro-expand-tparams-prefix-a.check @@ -1,4 +1,4 @@ -GroundTypeTag[Int] -GroundTypeTag[Int] -GroundTypeTag[String] -GroundTypeTag[Boolean] +ConcreteTypeTag[Int] +ConcreteTypeTag[Int] +ConcreteTypeTag[String] +ConcreteTypeTag[Boolean] diff --git a/test/files/run/macro-expand-tparams-prefix-b.check b/test/files/run/macro-expand-tparams-prefix-b.check index c7ec594b92..a336bb51ec 100644 --- a/test/files/run/macro-expand-tparams-prefix-b.check +++ b/test/files/run/macro-expand-tparams-prefix-b.check @@ -1,2 +1,2 @@ -GroundTypeTag[Boolean] GroundTypeTag[Int] -GroundTypeTag[Boolean] GroundTypeTag[String] +ConcreteTypeTag[Boolean] ConcreteTypeTag[Int] +ConcreteTypeTag[Boolean] ConcreteTypeTag[String] diff --git a/test/files/run/macro-expand-tparams-prefix-c1.check b/test/files/run/macro-expand-tparams-prefix-c1.check index fac58e9516..87f295aa49 100644 --- a/test/files/run/macro-expand-tparams-prefix-c1.check +++ b/test/files/run/macro-expand-tparams-prefix-c1.check @@ -1,3 +1,3 @@ -GroundTypeTag[Int] -GroundTypeTag[String] -GroundTypeTag[Boolean] +ConcreteTypeTag[Int] +ConcreteTypeTag[String] +ConcreteTypeTag[Boolean] diff --git a/test/files/run/macro-expand-tparams-prefix-c2.check b/test/files/run/macro-expand-tparams-prefix-c2.check index fac58e9516..87f295aa49 100644 --- a/test/files/run/macro-expand-tparams-prefix-c2.check +++ b/test/files/run/macro-expand-tparams-prefix-c2.check @@ -1,3 +1,3 @@ -GroundTypeTag[Int] -GroundTypeTag[String] -GroundTypeTag[Boolean] +ConcreteTypeTag[Int] +ConcreteTypeTag[String] +ConcreteTypeTag[Boolean] diff --git a/test/files/run/macro-expand-tparams-prefix-d1.check b/test/files/run/macro-expand-tparams-prefix-d1.check index f78ddea4f3..ca7a220475 100644 --- a/test/files/run/macro-expand-tparams-prefix-d1.check +++ b/test/files/run/macro-expand-tparams-prefix-d1.check @@ -1,3 +1,3 @@ TypeTag[T] TypeTag[U] -GroundTypeTag[Boolean] +ConcreteTypeTag[Boolean] diff --git a/test/files/run/macro-reify-groundtypetag-notypeparams.check b/test/files/run/macro-reify-groundtypetag-notypeparams.check index 24612cd4b7..d75b3c72b2 100644 --- a/test/files/run/macro-reify-groundtypetag-notypeparams.check +++ b/test/files/run/macro-reify-groundtypetag-notypeparams.check @@ -1,2 +1,2 @@ -GroundTypeTag[Int] -GroundTypeTag[List[Int]] +ConcreteTypeTag[Int] +ConcreteTypeTag[List[Int]] diff --git a/test/files/run/macro-reify-groundtypetag-notypeparams/Test.scala b/test/files/run/macro-reify-groundtypetag-notypeparams/Test.scala index 3aa40251ec..d2f8fab5ec 100644 --- a/test/files/run/macro-reify-groundtypetag-notypeparams/Test.scala +++ b/test/files/run/macro-reify-groundtypetag-notypeparams/Test.scala @@ -1,6 +1,6 @@ import scala.reflect.mirror._ object Test extends App { - println(implicitly[GroundTypeTag[Int]]) - println(implicitly[GroundTypeTag[List[Int]]]) + println(implicitly[ConcreteTypeTag[Int]]) + println(implicitly[ConcreteTypeTag[List[Int]]]) } \ No newline at end of file diff --git a/test/files/run/macro-reify-groundtypetag-typeparams-tags.check b/test/files/run/macro-reify-groundtypetag-typeparams-tags.check index 24612cd4b7..d75b3c72b2 100644 --- a/test/files/run/macro-reify-groundtypetag-typeparams-tags.check +++ b/test/files/run/macro-reify-groundtypetag-typeparams-tags.check @@ -1,2 +1,2 @@ -GroundTypeTag[Int] -GroundTypeTag[List[Int]] +ConcreteTypeTag[Int] +ConcreteTypeTag[List[Int]] diff --git a/test/files/run/macro-reify-groundtypetag-typeparams-tags/Test.scala b/test/files/run/macro-reify-groundtypetag-typeparams-tags/Test.scala index 21735c10d5..6d7eab5f9a 100644 --- a/test/files/run/macro-reify-groundtypetag-typeparams-tags/Test.scala +++ b/test/files/run/macro-reify-groundtypetag-typeparams-tags/Test.scala @@ -1,9 +1,9 @@ import scala.reflect.mirror._ object Test extends App { - def fooTypeTag[T: GroundTypeTag] = { - println(implicitly[GroundTypeTag[T]]) - println(implicitly[GroundTypeTag[List[T]]]) + def fooTypeTag[T: ConcreteTypeTag] = { + println(implicitly[ConcreteTypeTag[T]]) + println(implicitly[ConcreteTypeTag[List[T]]]) } fooTypeTag[Int] } \ No newline at end of file diff --git a/test/files/run/macro-reify-typetag-notypeparams.check b/test/files/run/macro-reify-typetag-notypeparams.check index 24612cd4b7..d75b3c72b2 100644 --- a/test/files/run/macro-reify-typetag-notypeparams.check +++ b/test/files/run/macro-reify-typetag-notypeparams.check @@ -1,2 +1,2 @@ -GroundTypeTag[Int] -GroundTypeTag[List[Int]] +ConcreteTypeTag[Int] +ConcreteTypeTag[List[Int]] diff --git a/test/files/run/macro-reify-typetag-typeparams-notags.check b/test/files/run/macro-reify-typetag-typeparams-notags.check index 3da30c71ba..af4877e205 100644 --- a/test/files/run/macro-reify-typetag-typeparams-notags.check +++ b/test/files/run/macro-reify-typetag-typeparams-notags.check @@ -1,2 +1,2 @@ -GroundTypeTag[T] -GroundTypeTag[List[T]] +ConcreteTypeTag[T] +ConcreteTypeTag[List[T]] diff --git a/test/files/run/macro-reify-typetag-typeparams-tags.check b/test/files/run/macro-reify-typetag-typeparams-tags.check index 24612cd4b7..d75b3c72b2 100644 --- a/test/files/run/macro-reify-typetag-typeparams-tags.check +++ b/test/files/run/macro-reify-typetag-typeparams-tags.check @@ -1,2 +1,2 @@ -GroundTypeTag[Int] -GroundTypeTag[List[Int]] +ConcreteTypeTag[Int] +ConcreteTypeTag[List[Int]] diff --git a/test/files/run/macro-reify-typetag-usegroundtypetag.check b/test/files/run/macro-reify-typetag-usegroundtypetag.check index 24612cd4b7..d75b3c72b2 100644 --- a/test/files/run/macro-reify-typetag-usegroundtypetag.check +++ b/test/files/run/macro-reify-typetag-usegroundtypetag.check @@ -1,2 +1,2 @@ -GroundTypeTag[Int] -GroundTypeTag[List[Int]] +ConcreteTypeTag[Int] +ConcreteTypeTag[List[Int]] diff --git a/test/files/run/macro-reify-typetag-usegroundtypetag/Test.scala b/test/files/run/macro-reify-typetag-usegroundtypetag/Test.scala index c9b210f35a..de235f51cc 100644 --- a/test/files/run/macro-reify-typetag-usegroundtypetag/Test.scala +++ b/test/files/run/macro-reify-typetag-usegroundtypetag/Test.scala @@ -1,7 +1,7 @@ import scala.reflect.mirror._ object Test extends App { - def fooTypeTag[T: GroundTypeTag] = { + def fooTypeTag[T: ConcreteTypeTag] = { println(implicitly[TypeTag[T]]) println(implicitly[TypeTag[List[T]]]) } diff --git a/test/files/run/macro-typecheck-macrosdisabled.check b/test/files/run/macro-typecheck-macrosdisabled.check index 9760c117a7..b432a539fc 100644 --- a/test/files/run/macro-typecheck-macrosdisabled.check +++ b/test/files/run/macro-typecheck-macrosdisabled.check @@ -1,5 +1,5 @@ { val $mr: reflect.mirror.type = scala.reflect.`package`.mirror; - $mr.Expr.apply[Int(2)]($mr.Literal.apply($mr.Constant.apply(2)))($mr.GroundTypeTag.apply[Int(2)]($mr.ConstantType.apply($mr.Constant.apply(2)))) + $mr.Expr.apply[Int(2)]($mr.Literal.apply($mr.Constant.apply(2)))($mr.ConcreteTypeTag.apply[Int(2)]($mr.ConstantType.apply($mr.Constant.apply(2)))) } mr.reify[Int](2) diff --git a/test/files/run/macro-undetparams-consfromsls.check b/test/files/run/macro-undetparams-consfromsls.check index 6bf9bcca5a..49e9140d5a 100644 --- a/test/files/run/macro-undetparams-consfromsls.check +++ b/test/files/run/macro-undetparams-consfromsls.check @@ -1,5 +1,5 @@ -A = GroundTypeTag[Int] -B = GroundTypeTag[Nothing] +A = ConcreteTypeTag[Int] +B = ConcreteTypeTag[Nothing] List(1) -A = GroundTypeTag[Any] +A = ConcreteTypeTag[Any] List(abc, 1) diff --git a/test/files/run/macro-undetparams-implicitval.check b/test/files/run/macro-undetparams-implicitval.check index 352a2e6480..6c2b601aa5 100644 --- a/test/files/run/macro-undetparams-implicitval.check +++ b/test/files/run/macro-undetparams-implicitval.check @@ -1 +1 @@ -GroundTypeTag[Nothing] +ConcreteTypeTag[Nothing] diff --git a/test/files/run/macro-undetparams-macroitself.check b/test/files/run/macro-undetparams-macroitself.check index 60c021a35b..e57fc1217b 100644 --- a/test/files/run/macro-undetparams-macroitself.check +++ b/test/files/run/macro-undetparams-macroitself.check @@ -1,2 +1,2 @@ -GroundTypeTag[Int] -GroundTypeTag[String] +ConcreteTypeTag[Int] +ConcreteTypeTag[String] diff --git a/test/files/run/primitive-sigs-2.check b/test/files/run/primitive-sigs-2.check index 761aa1ca72..1b6e24ed20 100644 --- a/test/files/run/primitive-sigs-2.check +++ b/test/files/run/primitive-sigs-2.check @@ -1,7 +1,7 @@ T List(A, char, class java.lang.Object) a -public java.lang.Object Arr.arr4(java.lang.Object[],scala.reflect.api.TypeTags.scala.reflect.api.TypeTags$GroundTypeTag) +public java.lang.Object Arr.arr4(java.lang.Object[],scala.reflect.api.TypeTags.scala.reflect.api.TypeTags$ConcreteTypeTag) public float[] Arr.arr3(float[][]) public scala.collection.immutable.List Arr.arr2(java.lang.Character[]) public scala.collection.immutable.List Arr.arr1(int[]) diff --git a/test/files/run/reify_newimpl_25.check b/test/files/run/reify_newimpl_25.check index 31ece627e1..37ff83c9ee 100644 --- a/test/files/run/reify_newimpl_25.check +++ b/test/files/run/reify_newimpl_25.check @@ -14,7 +14,7 @@ scala> { :13: free term: Ident(newTermName("x")) defined by res0 in :12:21 val tt = implicitly[TypeTag[x.type]] ^ -GroundTypeTag[x.type] +ConcreteTypeTag[x.type] scala> diff --git a/test/files/run/reify_newimpl_26.check b/test/files/run/reify_newimpl_26.check index 68b0ee8c99..bfbf1d653d 100644 --- a/test/files/run/reify_newimpl_26.check +++ b/test/files/run/reify_newimpl_26.check @@ -16,7 +16,7 @@ scala> def foo[T]{ foo: [T]=> Unit scala> foo[Int] -GroundTypeTag[List[T]] +ConcreteTypeTag[List[T]] scala> diff --git a/test/files/run/toolbox_typecheck_macrosdisabled.check b/test/files/run/toolbox_typecheck_macrosdisabled.check index fe2323ea06..cf2420bc17 100644 --- a/test/files/run/toolbox_typecheck_macrosdisabled.check +++ b/test/files/run/toolbox_typecheck_macrosdisabled.check @@ -1,5 +1,5 @@ { val $mr: mr.type = mr; - $mr.Expr.apply[Int(2)]($mr.Literal.apply($mr.Constant.apply(2)))($mr.GroundTypeTag.apply[Int(2)]($mr.ConstantType.apply($mr.Constant.apply(2)))) + $mr.Expr.apply[Int(2)]($mr.Literal.apply($mr.Constant.apply(2)))($mr.ConcreteTypeTag.apply[Int(2)]($mr.ConstantType.apply($mr.Constant.apply(2)))) } mr.reify[Int](2) diff --git a/test/files/run/typetags_core.check b/test/files/run/typetags_core.check index d1b71f0926..62fcb481ae 100644 --- a/test/files/run/typetags_core.check +++ b/test/files/run/typetags_core.check @@ -1,30 +1,30 @@ true -GroundTypeTag[Byte] +ConcreteTypeTag[Byte] true -GroundTypeTag[Short] +ConcreteTypeTag[Short] true -GroundTypeTag[Char] +ConcreteTypeTag[Char] true -GroundTypeTag[Int] +ConcreteTypeTag[Int] true -GroundTypeTag[Long] +ConcreteTypeTag[Long] true -GroundTypeTag[Float] +ConcreteTypeTag[Float] true -GroundTypeTag[Double] +ConcreteTypeTag[Double] true -GroundTypeTag[Boolean] +ConcreteTypeTag[Boolean] true -GroundTypeTag[Unit] +ConcreteTypeTag[Unit] true -GroundTypeTag[Any] +ConcreteTypeTag[Any] true -GroundTypeTag[Object] +ConcreteTypeTag[Object] true -GroundTypeTag[AnyVal] +ConcreteTypeTag[AnyVal] true -GroundTypeTag[AnyRef] +ConcreteTypeTag[AnyRef] true -GroundTypeTag[Null] +ConcreteTypeTag[Null] true -GroundTypeTag[Nothing] +ConcreteTypeTag[Nothing] diff --git a/test/pending/run/macro-reify-groundtypetag-hktypeparams-tags/Test.scala b/test/pending/run/macro-reify-groundtypetag-hktypeparams-tags/Test.scala index 4b264d83af..ef70a66f1a 100644 --- a/test/pending/run/macro-reify-groundtypetag-hktypeparams-tags/Test.scala +++ b/test/pending/run/macro-reify-groundtypetag-hktypeparams-tags/Test.scala @@ -1,9 +1,9 @@ import scala.reflect.mirror._ object Test extends App { - def fooTypeTagHK[C[_]: GroundTypeTag, T: GroundTypeTag] = { - println(implicitly[GroundTypeTag[C[T]]]) - println(implicitly[GroundTypeTag[List[C[T]]]]) + def fooTypeTagHK[C[_]: ConcreteTypeTag, T: ConcreteTypeTag] = { + println(implicitly[ConcreteTypeTag[C[T]]]) + println(implicitly[ConcreteTypeTag[List[C[T]]]]) } fooTypeTagHK[List, Int] } \ No newline at end of file -- cgit v1.2.3