From 5acac4d806eb45afdf1e7716c727a97130b69651 Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Thu, 7 Jun 2012 22:05:34 +0200 Subject: TypeTag => AbsTypeTag, ConcreteTypeTag => TypeTag This protects everyone from the confusion caused by stuff like this: https://issues.scala-lang.org/browse/SI-5884 --- lib/scala-compiler.jar.desired.sha1 | 2 +- lib/scala-library.jar.desired.sha1 | 2 +- lib/scala-reflect.jar.desired.sha1 | 2 +- .../scala/reflect/makro/runtime/Aliases.scala | 5 +- .../scala/reflect/makro/runtime/Exprs.scala | 2 +- .../scala/reflect/makro/runtime/TypeTags.scala | 2 +- src/compiler/scala/reflect/reify/Errors.scala | 4 +- src/compiler/scala/reflect/reify/States.scala | 2 +- src/compiler/scala/reflect/reify/Taggers.scala | 4 +- .../scala/reflect/reify/codegen/GenTypes.scala | 6 +- .../scala/reflect/reify/codegen/GenUtils.scala | 2 +- .../scala/reflect/reify/phases/Reshape.scala | 4 +- .../scala/reflect/reify/utils/Extractors.scala | 22 ++- src/compiler/scala/tools/nsc/doc/Settings.scala | 18 +- .../scala/tools/nsc/doc/html/SyntaxHigh.scala | 4 +- .../scala/tools/nsc/interpreter/ReplVals.scala | 2 +- .../scala/tools/nsc/typechecker/Implicits.scala | 8 +- .../scala/tools/nsc/typechecker/Macros.scala | 13 +- .../tools/nsc/typechecker/MethodSynthesis.scala | 22 +-- .../scala/tools/nsc/typechecker/Tags.scala | 6 +- src/compiler/scala/tools/reflect/FastTrack.scala | 4 +- src/library/scala/reflect/Manifest.scala | 4 +- src/library/scala/reflect/base/TagInterop.scala | 6 +- src/library/scala/reflect/base/TypeTags.scala | 206 +++++++++++---------- src/library/scala/reflect/compat.scala | 4 + .../scala/reflect/makro/internal/package.scala | 2 +- src/library/scala/reflect/package.scala | 21 +-- src/reflect/scala/reflect/api/Exprs.scala | 8 +- src/reflect/scala/reflect/api/TagInterop.scala | 10 +- .../scala/reflect/internal/Definitions.scala | 30 +-- src/reflect/scala/reflect/internal/StdNames.scala | 26 +-- src/reflect/scala/reflect/makro/Aliases.scala | 5 +- src/reflect/scala/reflect/makro/Exprs.scala | 2 +- src/reflect/scala/reflect/makro/TypeTags.scala | 2 +- test/files/jvm/manifests-new.check | 70 +++---- test/files/jvm/manifests-new.scala | 6 +- ...interop_abstypetags_arenot_classmanifests.check | 4 + ...interop_abstypetags_arenot_classmanifests.scala | 11 ++ .../neg/interop_abstypetags_arenot_classtags.check | 4 + .../neg/interop_abstypetags_arenot_classtags.scala | 12 ++ .../neg/interop_abstypetags_arenot_manifests.check | 4 + .../neg/interop_abstypetags_arenot_manifests.scala | 11 ++ ...op_classmanifests_arenot_concretetypetags.check | 4 - ...op_classmanifests_arenot_concretetypetags.scala | 11 -- .../interop_classmanifests_arenot_typetags.check | 4 + .../interop_classmanifests_arenot_typetags.scala | 11 ++ ...op_concretetypetags_arenot_classmanifests.check | 4 - ...op_concretetypetags_arenot_classmanifests.scala | 11 -- ...interop_concretetypetags_arenot_classtags.check | 4 - ...interop_concretetypetags_arenot_classtags.scala | 12 -- ...petags_without_classtags_arenot_manifests.check | 6 - ...petags_without_classtags_arenot_manifests.scala | 12 -- .../neg/interop_typetags_arenot_manifests.check | 4 - .../neg/interop_typetags_arenot_manifests.scala | 11 -- ...petags_without_classtags_arenot_manifests.check | 6 + ...petags_without_classtags_arenot_manifests.scala | 12 ++ ...o-reify-groundtypetag-hktypeparams-notags.check | 7 - .../Test.scala | 9 - ...cro-reify-groundtypetag-typeparams-notags.check | 7 - .../Test.scala | 9 - .../neg/macro-reify-groundtypetag-usetypetag.check | 7 - .../Test.scala | 9 - .../macro-reify-typetag-hktypeparams-notags.check | 7 + .../Test.scala | 9 + .../macro-reify-typetag-typeparams-notags.check | 7 + .../Test.scala | 9 + .../neg/macro-reify-typetag-useabstypetag.check | 7 + .../macro-reify-typetag-useabstypetag/Test.scala | 9 + test/files/neg/t3692-old.check | 2 +- test/files/pos/implicits-new.scala | 2 +- test/files/run/abstypetags_core.check | 28 +++ test/files/run/abstypetags_core.scala | 32 ++++ test/files/run/concretetypetags_core.check | 28 +-- test/files/run/concretetypetags_core.scala | 56 +++--- test/files/run/concretetypetags_multi.check | 10 +- test/files/run/concretetypetags_multi.scala | 10 +- test/files/run/existentials3-new.scala | 4 +- .../interop_classmanifests_arenot_typetags.check | 3 - .../interop_classmanifests_arenot_typetags.scala | 11 -- .../interop_concretetypetags_are_manifests.check | 3 - .../interop_concretetypetags_are_manifests.scala | 12 -- .../run/interop_manifests_are_abstypetags.check | 3 + .../run/interop_manifests_are_abstypetags.scala | 11 ++ .../interop_manifests_are_concretetypetags.check | 3 - .../interop_manifests_are_concretetypetags.scala | 11 -- .../files/run/interop_typetags_are_manifests.check | 3 + .../files/run/interop_typetags_are_manifests.scala | 12 ++ 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 | 6 +- .../macro-expand-tparams-prefix-d1/Impls_1.scala | 4 +- .../run/macro-reify-abstypetag-notypeparams.check | 2 + .../macro-reify-abstypetag-notypeparams/Test.scala | 6 + .../macro-reify-abstypetag-typeparams-notags.check | 2 + .../Test.scala | 9 + .../macro-reify-abstypetag-typeparams-tags.check | 2 + .../Test.scala | 9 + .../run/macro-reify-abstypetag-usetypetag.check | 2 + .../macro-reify-abstypetag-usetypetag/Test.scala | 9 + .../macro-reify-groundtypetag-notypeparams.check | 2 - .../Test.scala | 6 - ...macro-reify-groundtypetag-typeparams-tags.check | 2 - .../Test.scala | 9 - .../run/macro-reify-typetag-notypeparams.check | 4 +- .../macro-reify-typetag-typeparams-notags.check | 2 - .../Test.scala | 9 - .../run/macro-reify-typetag-typeparams-tags.check | 2 +- .../run/macro-reify-typetag-usegroundtypetag.check | 2 - .../Test.scala | 9 - test/files/run/macro-undetparams-consfromsls.check | 6 +- .../Impls_Macros_1.scala | 8 +- test/files/run/macro-undetparams-implicitval.check | 2 +- test/files/run/macro-undetparams-macroitself.check | 4 +- test/files/run/newTags.check | 2 +- test/files/run/reify_newimpl_25.check | 2 +- test/files/run/reify_newimpl_26.check | 6 +- test/files/run/reify_newimpl_26.scala | 2 +- test/files/run/typetags_core.check | 28 --- test/files/run/typetags_core.scala | 32 ---- test/files/run/typetags_multi.check | 5 - test/files/run/typetags_multi.scala | 9 - ...and-implicit-macro-defeats-type-inference.check | 4 +- .../Test.scala | 6 +- 128 files changed, 636 insertions(+), 654 deletions(-) create mode 100644 test/files/neg/interop_abstypetags_arenot_classmanifests.check create mode 100644 test/files/neg/interop_abstypetags_arenot_classmanifests.scala create mode 100644 test/files/neg/interop_abstypetags_arenot_classtags.check create mode 100644 test/files/neg/interop_abstypetags_arenot_classtags.scala create mode 100644 test/files/neg/interop_abstypetags_arenot_manifests.check create mode 100644 test/files/neg/interop_abstypetags_arenot_manifests.scala delete mode 100644 test/files/neg/interop_classmanifests_arenot_concretetypetags.check delete mode 100644 test/files/neg/interop_classmanifests_arenot_concretetypetags.scala create mode 100644 test/files/neg/interop_classmanifests_arenot_typetags.check create mode 100644 test/files/neg/interop_classmanifests_arenot_typetags.scala delete mode 100644 test/files/neg/interop_concretetypetags_arenot_classmanifests.check delete mode 100644 test/files/neg/interop_concretetypetags_arenot_classmanifests.scala delete mode 100644 test/files/neg/interop_concretetypetags_arenot_classtags.check delete mode 100644 test/files/neg/interop_concretetypetags_arenot_classtags.scala delete mode 100644 test/files/neg/interop_concretetypetags_without_classtags_arenot_manifests.check delete mode 100644 test/files/neg/interop_concretetypetags_without_classtags_arenot_manifests.scala delete mode 100644 test/files/neg/interop_typetags_arenot_manifests.check delete mode 100644 test/files/neg/interop_typetags_arenot_manifests.scala create mode 100644 test/files/neg/interop_typetags_without_classtags_arenot_manifests.check create mode 100644 test/files/neg/interop_typetags_without_classtags_arenot_manifests.scala delete mode 100644 test/files/neg/macro-reify-groundtypetag-hktypeparams-notags.check delete mode 100644 test/files/neg/macro-reify-groundtypetag-hktypeparams-notags/Test.scala delete mode 100644 test/files/neg/macro-reify-groundtypetag-typeparams-notags.check delete mode 100644 test/files/neg/macro-reify-groundtypetag-typeparams-notags/Test.scala delete mode 100644 test/files/neg/macro-reify-groundtypetag-usetypetag.check delete mode 100644 test/files/neg/macro-reify-groundtypetag-usetypetag/Test.scala create mode 100644 test/files/neg/macro-reify-typetag-hktypeparams-notags.check create mode 100644 test/files/neg/macro-reify-typetag-hktypeparams-notags/Test.scala create mode 100644 test/files/neg/macro-reify-typetag-typeparams-notags.check create mode 100644 test/files/neg/macro-reify-typetag-typeparams-notags/Test.scala create mode 100644 test/files/neg/macro-reify-typetag-useabstypetag.check create mode 100644 test/files/neg/macro-reify-typetag-useabstypetag/Test.scala create mode 100644 test/files/run/abstypetags_core.check create mode 100644 test/files/run/abstypetags_core.scala delete mode 100644 test/files/run/interop_classmanifests_arenot_typetags.check delete mode 100644 test/files/run/interop_classmanifests_arenot_typetags.scala delete mode 100644 test/files/run/interop_concretetypetags_are_manifests.check delete mode 100644 test/files/run/interop_concretetypetags_are_manifests.scala create mode 100644 test/files/run/interop_manifests_are_abstypetags.check create mode 100644 test/files/run/interop_manifests_are_abstypetags.scala delete mode 100644 test/files/run/interop_manifests_are_concretetypetags.check delete mode 100644 test/files/run/interop_manifests_are_concretetypetags.scala create mode 100644 test/files/run/interop_typetags_are_manifests.check create mode 100644 test/files/run/interop_typetags_are_manifests.scala create mode 100644 test/files/run/macro-reify-abstypetag-notypeparams.check create mode 100644 test/files/run/macro-reify-abstypetag-notypeparams/Test.scala create mode 100644 test/files/run/macro-reify-abstypetag-typeparams-notags.check create mode 100644 test/files/run/macro-reify-abstypetag-typeparams-notags/Test.scala create mode 100644 test/files/run/macro-reify-abstypetag-typeparams-tags.check create mode 100644 test/files/run/macro-reify-abstypetag-typeparams-tags/Test.scala create mode 100644 test/files/run/macro-reify-abstypetag-usetypetag.check create mode 100644 test/files/run/macro-reify-abstypetag-usetypetag/Test.scala delete mode 100644 test/files/run/macro-reify-groundtypetag-notypeparams.check delete mode 100644 test/files/run/macro-reify-groundtypetag-notypeparams/Test.scala delete mode 100644 test/files/run/macro-reify-groundtypetag-typeparams-tags.check delete mode 100644 test/files/run/macro-reify-groundtypetag-typeparams-tags/Test.scala delete mode 100644 test/files/run/macro-reify-typetag-typeparams-notags.check delete mode 100644 test/files/run/macro-reify-typetag-typeparams-notags/Test.scala delete mode 100644 test/files/run/macro-reify-typetag-usegroundtypetag.check delete mode 100644 test/files/run/macro-reify-typetag-usegroundtypetag/Test.scala delete mode 100644 test/files/run/typetags_core.check delete mode 100644 test/files/run/typetags_core.scala delete mode 100644 test/files/run/typetags_multi.check delete mode 100644 test/files/run/typetags_multi.scala diff --git a/lib/scala-compiler.jar.desired.sha1 b/lib/scala-compiler.jar.desired.sha1 index f92b9d05cc..8664d8de5b 100644 --- a/lib/scala-compiler.jar.desired.sha1 +++ b/lib/scala-compiler.jar.desired.sha1 @@ -1 +1 @@ -cd208e55a800a1b4fcc623f13b44e9df551b617d ?scala-compiler.jar +78aea1d6d86525ce869139f66bfb98505dab6c76 ?scala-compiler.jar diff --git a/lib/scala-library.jar.desired.sha1 b/lib/scala-library.jar.desired.sha1 index b731a1f97e..7a288e4086 100644 --- a/lib/scala-library.jar.desired.sha1 +++ b/lib/scala-library.jar.desired.sha1 @@ -1 +1 @@ -5d4aa46eabd2a034a3102fb1de168547ef7d977b ?scala-library.jar +935553e8d1dfb5d71652c195ce25314c3af2442c ?scala-library.jar diff --git a/lib/scala-reflect.jar.desired.sha1 b/lib/scala-reflect.jar.desired.sha1 index 5839bf5380..321ac0752b 100644 --- a/lib/scala-reflect.jar.desired.sha1 +++ b/lib/scala-reflect.jar.desired.sha1 @@ -1 +1 @@ -cebf7edbff7931c4b3d6ef1504b2bf66f1abf6fd ?scala-reflect.jar +d3a859a035f849d334732b12518715e7c9f4a475 ?scala-reflect.jar diff --git a/src/compiler/scala/reflect/makro/runtime/Aliases.scala b/src/compiler/scala/reflect/makro/runtime/Aliases.scala index 76c2834102..760f7fc54d 100644 --- a/src/compiler/scala/reflect/makro/runtime/Aliases.scala +++ b/src/compiler/scala/reflect/makro/runtime/Aliases.scala @@ -17,11 +17,10 @@ trait Aliases { override type Expr[+T] = universe.Expr[T] override val Expr = universe.Expr + override type AbsTypeTag[T] = universe.AbsTypeTag[T] override type TypeTag[T] = universe.TypeTag[T] - override type ConcreteTypeTag[T] = universe.ConcreteTypeTag[T] + override val AbsTypeTag = universe.AbsTypeTag override val TypeTag = universe.TypeTag - override val ConcreteTypeTag = universe.ConcreteTypeTag override def typeTag[T](implicit ttag: TypeTag[T]) = ttag - override def concreteTypeTag[T](implicit cttag: ConcreteTypeTag[T]) = cttag override def typeOf[T](implicit ttag: TypeTag[T]): Type = ttag.tpe } \ No newline at end of file diff --git a/src/compiler/scala/reflect/makro/runtime/Exprs.scala b/src/compiler/scala/reflect/makro/runtime/Exprs.scala index df2ea0c3ea..b680b56bab 100644 --- a/src/compiler/scala/reflect/makro/runtime/Exprs.scala +++ b/src/compiler/scala/reflect/makro/runtime/Exprs.scala @@ -4,5 +4,5 @@ package runtime trait Exprs { self: Context => - def Expr[T: TypeTag](tree: Tree): Expr[T] = universe.Expr[T](mirror, universe.FixedMirrorTreeCreator(mirror, tree)) + def Expr[T: AbsTypeTag](tree: Tree): Expr[T] = universe.Expr[T](mirror, universe.FixedMirrorTreeCreator(mirror, tree)) } diff --git a/src/compiler/scala/reflect/makro/runtime/TypeTags.scala b/src/compiler/scala/reflect/makro/runtime/TypeTags.scala index b4ac01eedf..4f9b287674 100644 --- a/src/compiler/scala/reflect/makro/runtime/TypeTags.scala +++ b/src/compiler/scala/reflect/makro/runtime/TypeTags.scala @@ -4,6 +4,6 @@ package runtime trait TypeTags { self: Context => + def AbsTypeTag[T](tpe: Type): AbsTypeTag[T] = universe.AbsTypeTag[T](mirror, universe.FixedMirrorTypeCreator(mirror, tpe)) def TypeTag[T](tpe: Type): TypeTag[T] = universe.TypeTag[T](mirror, universe.FixedMirrorTypeCreator(mirror, tpe)) - def ConcreteTypeTag[T](tpe: Type): ConcreteTypeTag[T] = universe.ConcreteTypeTag[T](mirror, universe.FixedMirrorTypeCreator(mirror, tpe)) } diff --git a/src/compiler/scala/reflect/reify/Errors.scala b/src/compiler/scala/reflect/reify/Errors.scala index 7f255dab44..714795503b 100644 --- a/src/compiler/scala/reflect/reify/Errors.scala +++ b/src/compiler/scala/reflect/reify/Errors.scala @@ -32,8 +32,8 @@ trait Errors { throw new ReificationError(defaultErrorPosition, msg) } - def CannotReifyConcreteTypeTagHavingUnresolvedTypeParameters(tpe: Type) = { - val msg = "cannot reify ConcreteTypeTag having unresolved type parameter %s".format(tpe) + def CannotReifyTypeTagHavingUnresolvedTypeParameters(tpe: Type) = { + val msg = "cannot reify TypeTag having unresolved type parameter %s".format(tpe) throw new ReificationError(defaultErrorPosition, msg) } diff --git a/src/compiler/scala/reflect/reify/States.scala b/src/compiler/scala/reflect/reify/States.scala index 97b703d32b..a01cfe5d74 100644 --- a/src/compiler/scala/reflect/reify/States.scala +++ b/src/compiler/scala/reflect/reify/States.scala @@ -36,7 +36,7 @@ trait States { if (!value && concrete) { assert(current.isInstanceOf[Type], current) val offender = current.asInstanceOf[Type] - CannotReifyConcreteTypeTagHavingUnresolvedTypeParameters(offender) + CannotReifyTypeTagHavingUnresolvedTypeParameters(offender) } } var reifyStack = reifee :: Nil diff --git a/src/compiler/scala/reflect/reify/Taggers.scala b/src/compiler/scala/reflect/reify/Taggers.scala index 0dfbc775e3..b70c3f44a3 100644 --- a/src/compiler/scala/reflect/reify/Taggers.scala +++ b/src/compiler/scala/reflect/reify/Taggers.scala @@ -43,14 +43,14 @@ abstract class Taggers { val Select(prefix, _) = universe c.materializeTypeTagForMacroContext(prefix, tpe, concrete) } else { - val tagType = if (concrete) ConcreteTypeTagClass else TypeTagClass + val tagType = if (concrete) TypeTagClass else AbsTypeTagClass val unaffiliatedTagTpe = TypeRef(BaseUniverseClass.asTypeConstructor, tagType, List(tpe)) val unaffiliatedTag = c.inferImplicitValue(unaffiliatedTagTpe, silent = true, withMacrosDisabled = true) unaffiliatedTag match { case success if !success.isEmpty => Apply(Select(success, nme.in), List(mirror orElse mkDefaultMirrorRef(c.universe)(universe, c.callsiteTyper))) case _ => - val tagModule = if (concrete) ConcreteTypeTagModule else TypeTagModule + val tagModule = if (concrete) TypeTagModule else AbsTypeTagModule materializeTag(universe, tpe, tagModule, c.reifyType(universe, mirror, tpe, concrete = concrete)) } } diff --git a/src/compiler/scala/reflect/reify/codegen/GenTypes.scala b/src/compiler/scala/reflect/reify/codegen/GenTypes.scala index 25928651c8..f4e2200edc 100644 --- a/src/compiler/scala/reflect/reify/codegen/GenTypes.scala +++ b/src/compiler/scala/reflect/reify/codegen/GenTypes.scala @@ -76,7 +76,7 @@ trait GenTypes { if (tpe.isSpliceable && !(quantified contains tpe.typeSymbol)) { if (reifyDebug) println("splicing " + tpe) - val tagFlavor = if (concrete) tpnme.ConcreteTypeTag.toString else tpnme.TypeTag.toString + val tagFlavor = if (concrete) tpnme.TypeTag.toString else tpnme.AbsTypeTag.toString val key = (tagFlavor, tpe.typeSymbol) // if this fails, it might produce the dreaded "erroneous or inaccessible type" error // to find out the whereabouts of the error run scalac with -Ydebug @@ -96,7 +96,7 @@ trait GenTypes { } case success => if (reifyDebug) println("implicit search has produced a result: " + success) - state.reificationIsConcrete &= concrete || success.tpe <:< ConcreteTypeTagClass.asTypeConstructor + state.reificationIsConcrete &= concrete || success.tpe <:< TypeTagClass.asTypeConstructor Select(Apply(Select(success, nme.in), List(Ident(nme.MIRROR_SHORT))), nme.tpe) } if (result != EmptyTree) return result @@ -124,7 +124,7 @@ trait GenTypes { // todo. write a test for this if (ReflectRuntimeUniverse == NoSymbol) CannotConvertManifestToTagWithoutScalaReflect(tpe, manifestInScope) val cm = typer.typed(Ident(ReflectRuntimeCurrentMirror)) - val tagTree = gen.mkMethodCall(ReflectRuntimeUniverse, nme.manifestToConcreteTypeTag, List(tpe), List(cm, manifestInScope)) + val tagTree = gen.mkMethodCall(ReflectRuntimeUniverse, nme.manifestToTypeTag, List(tpe), List(cm, manifestInScope)) Select(Apply(Select(tagTree, nme.in), List(Ident(nme.MIRROR_SHORT))), nme.tpe) case _ => EmptyTree diff --git a/src/compiler/scala/reflect/reify/codegen/GenUtils.scala b/src/compiler/scala/reflect/reify/codegen/GenUtils.scala index e7fa858346..2b7733fb6c 100644 --- a/src/compiler/scala/reflect/reify/codegen/GenUtils.scala +++ b/src/compiler/scala/reflect/reify/codegen/GenUtils.scala @@ -131,7 +131,7 @@ trait GenUtils { def isCrossStageTypeBearer(tree: Tree): Boolean = tree match { case TypeApply(hk, _) => isCrossStageTypeBearer(hk) - case Select(sym @ Select(_, ctor), nme.apply) if ctor == nme.TypeTag || ctor == nme.ConcreteTypeTag || ctor == nme.Expr => true + case Select(sym @ Select(_, ctor), nme.apply) if ctor == nme.AbsTypeTag || ctor == nme.TypeTag || ctor == nme.Expr => true case _ => false } diff --git a/src/compiler/scala/reflect/reify/phases/Reshape.scala b/src/compiler/scala/reflect/reify/phases/Reshape.scala index de46145e49..e26dd7e227 100644 --- a/src/compiler/scala/reflect/reify/phases/Reshape.scala +++ b/src/compiler/scala/reflect/reify/phases/Reshape.scala @@ -103,10 +103,10 @@ trait Reshape { // of, say, ClassTag or TypeTag case Apply(TypeApply(_, List(tt)), _) if original.symbol == MacroInternal_materializeClassTag => gen.mkNullaryCall(Predef_implicitly, List(appliedType(ClassTagClass, tt.tpe))) + case Apply(TypeApply(_, List(tt)), List(pre)) if original.symbol == MacroInternal_materializeAbsTypeTag => + gen.mkNullaryCall(Predef_implicitly, List(typeRef(pre.tpe, AbsTypeTagClass, List(tt.tpe)))) case Apply(TypeApply(_, List(tt)), List(pre)) if original.symbol == MacroInternal_materializeTypeTag => gen.mkNullaryCall(Predef_implicitly, List(typeRef(pre.tpe, TypeTagClass, List(tt.tpe)))) - case Apply(TypeApply(_, List(tt)), List(pre)) if original.symbol == MacroInternal_materializeConcreteTypeTag => - gen.mkNullaryCall(Predef_implicitly, List(typeRef(pre.tpe, ConcreteTypeTagClass, List(tt.tpe)))) case _ => original } diff --git a/src/compiler/scala/reflect/reify/utils/Extractors.scala b/src/compiler/scala/reflect/reify/utils/Extractors.scala index 1fdc015325..52e4ff08c1 100644 --- a/src/compiler/scala/reflect/reify/utils/Extractors.scala +++ b/src/compiler/scala/reflect/reify/utils/Extractors.scala @@ -31,7 +31,7 @@ trait Extractors { // } // }; // new $treecreator1() - // })($u.ConcreteTypeTag[List[Int]]($m, { + // })($u.TypeTag[List[Int]]($m, { // final class $typecreator1 extends scala.reflect.base.TypeCreator { // def (): $typecreator1 = { // $typecreator1.super.(); @@ -116,7 +116,7 @@ trait Extractors { object ReifiedTree { def apply(universe: Tree, mirror: Tree, symtab: SymbolTable, rtree: Tree, tpe: Type, rtpe: Tree, concrete: Boolean): Tree = { - val tagFactory = if (concrete) nme.ConcreteTypeTag else nme.TypeTag + val tagFactory = if (concrete) nme.TypeTag else nme.AbsTypeTag val tagCtor = TypeApply(Select(Select(Ident(nme.UNIVERSE_SHORT), tagFactory), nme.apply), List(TypeTree(tpe))) val exprCtor = TypeApply(Select(Select(Ident(nme.UNIVERSE_SHORT), nme.Expr), nme.apply), List(TypeTree(tpe))) val tagArgs = List(Ident(nme.MIRROR_SHORT), mkCreator(tpnme.REIFY_TYPECREATOR_PREFIX, symtab, rtpe)) @@ -130,9 +130,13 @@ trait Extractors { Apply( Apply(TypeApply(_, List(ttpe @ TypeTree())), List(_, Block(List(ClassDef(_, _, _, Template(_, _, List(_, _, DefDef(_, _, _, _, _, Block(_ :: _ :: symbolTable1, rtree)))))), _))), // todo. doesn't take into account optimizations such as $u.TypeTag.Int or the upcoming closure optimization - List(Apply(TypeApply(Select(_, tagFlavor), _), List(_, Block(List(ClassDef(_, _, _, Template(_, _, List(_, DefDef(_, _, _, _, _, Block(_ :: _ :: symbolTable2, rtpe)))))), _)))))) + List(Apply(TypeApply(tagFactory @ Select(_, _), _), List(_, Block(List(ClassDef(_, _, _, Template(_, _, List(_, DefDef(_, _, _, _, _, Block(_ :: _ :: symbolTable2, rtpe)))))), _)))))) if udef.name == nme.UNIVERSE_SHORT && mdef.name == nme.MIRROR_SHORT => - Some(universe, mirror, SymbolTable(symbolTable1 ++ symbolTable2), rtree, ttpe.tpe, rtpe, tagFlavor == nme.ConcreteTypeTag) + val tagFlavor = tagFactory match { + case Select(Select(_, tagFlavor), _) => tagFlavor + case Select(_, tagFlavor) => tagFlavor + } + Some(universe, mirror, SymbolTable(symbolTable1 ++ symbolTable2), rtree, ttpe.tpe, rtpe, tagFlavor == nme.TypeTag) case _ => None } @@ -140,7 +144,7 @@ trait Extractors { object ReifiedType { def apply(universe: Tree, mirror: Tree, symtab: SymbolTable, tpe: Type, rtpe: Tree, concrete: Boolean) = { - val tagFactory = if (concrete) nme.ConcreteTypeTag else nme.TypeTag + val tagFactory = if (concrete) nme.TypeTag else nme.AbsTypeTag val ctor = TypeApply(Select(Select(Ident(nme.UNIVERSE_SHORT), tagFactory), nme.apply), List(TypeTree(tpe))) val args = List(Ident(nme.MIRROR_SHORT), mkCreator(tpnme.REIFY_TYPECREATOR_PREFIX, symtab, rtpe)) val unwrapped = Apply(ctor, args) @@ -151,9 +155,13 @@ trait Extractors { case Block( List(udef @ ValDef(_, _, _, universe), mdef @ ValDef(_, _, _, mirror)), // todo. doesn't take into account optimizations such as $u.TypeTag.Int or the upcoming closure optimization - Apply(TypeApply(Select(_, tagFlavor), List(ttpe @ TypeTree())), List(_, Block(List(ClassDef(_, _, _, Template(_, _, List(_, DefDef(_, _, _, _, _, Block(_ :: _ :: symtab, rtpe)))))), _)))) + Apply(TypeApply(tagFactory @ Select(_, _), List(ttpe @ TypeTree())), List(_, Block(List(ClassDef(_, _, _, Template(_, _, List(_, DefDef(_, _, _, _, _, Block(_ :: _ :: symtab, rtpe)))))), _)))) if udef.name == nme.UNIVERSE_SHORT && mdef.name == nme.MIRROR_SHORT => - Some(universe, mirror, SymbolTable(symtab), ttpe.tpe, rtpe, tagFlavor == nme.ConcreteTypeTag) + val tagFlavor = tagFactory match { + case Select(Select(_, tagFlavor), _) => tagFlavor + case Select(_, tagFlavor) => tagFlavor + } + Some(universe, mirror, SymbolTable(symtab), ttpe.tpe, rtpe, tagFlavor == nme.TypeTag) case _ => None } diff --git a/src/compiler/scala/tools/nsc/doc/Settings.scala b/src/compiler/scala/tools/nsc/doc/Settings.scala index 27aba41c33..9a732c308f 100644 --- a/src/compiler/scala/tools/nsc/doc/Settings.scala +++ b/src/compiler/scala/tools/nsc/doc/Settings.scala @@ -158,15 +158,15 @@ class Settings(error: String => Unit) extends scala.tools.nsc.Settings(error) { * the function result should be a humanly-understandable description of the type class */ val knownTypeClasses: Map[String, String => String] = Map() + - (".scala.package.Numeric" -> ((tparam: String) => tparam + " is a numeric class, such as Int, Long, Float or Double")) + - (".scala.package.Integral" -> ((tparam: String) => tparam + " is an integral numeric class, such as Int or Long")) + - (".scala.package.Fractional" -> ((tparam: String) => tparam + " is a fractional numeric class, such as Float or Double")) + - (".scala.reflect.Manifest" -> ((tparam: String) => tparam + " is accompanied by a Manifest, which is a runtime representation of its type that survives erasure")) + - (".scala.reflect.ClassManifest" -> ((tparam: String) => tparam + " is accompanied by a ClassManifest, which is a runtime representation of its type that survives erasure")) + - (".scala.reflect.OptManifest" -> ((tparam: String) => tparam + " is accompanied by an OptManifest, which can be either a runtime representation of its type or the NoManifest, which means the runtime type is not available")) + - (".scala.reflect.ClassTag" -> ((tparam: String) => tparam + " is accompanied by a ClassTag, which is a runtime representation of its type that survives erasure")) + - (".scala.reflect.TypeTag" -> ((tparam: String) => tparam + " is accompanied by a TypeTag, which is a runtime representation of its type that survives erasure")) + - (".scala.reflect.ConcreteTypeTag" -> ((tparam: String) => tparam + " is accompanied by an ConcreteTypeTag, which is a runtime representation of a concrete type that survives erasure")) + (".scala.package.Numeric" -> ((tparam: String) => tparam + " is a numeric class, such as Int, Long, Float or Double")) + + (".scala.package.Integral" -> ((tparam: String) => tparam + " is an integral numeric class, such as Int or Long")) + + (".scala.package.Fractional" -> ((tparam: String) => tparam + " is a fractional numeric class, such as Float or Double")) + + (".scala.reflect.Manifest" -> ((tparam: String) => tparam + " is accompanied by a Manifest, which is a runtime representation of its type that survives erasure")) + + (".scala.reflect.ClassManifest" -> ((tparam: String) => tparam + " is accompanied by a ClassManifest, which is a runtime representation of its type that survives erasure")) + + (".scala.reflect.OptManifest" -> ((tparam: String) => tparam + " is accompanied by an OptManifest, which can be either a runtime representation of its type or the NoManifest, which means the runtime type is not available")) + + (".scala.reflect.ClassTag" -> ((tparam: String) => tparam + " is accompanied by a ClassTag, which is a runtime representation of its type that survives erasure")) + + (".scala.reflect.AbsTypeTag" -> ((tparam: String) => tparam + " is accompanied by an AbsTypeTag, which is a runtime representation of its type that survives erasure")) + + (".scala.reflect.TypeTag" -> ((tparam: String) => tparam + " is accompanied by a TypeTag, which is a runtime representation of its type that survives erasure")) /** * Set of classes to exclude from index and diagrams diff --git a/src/compiler/scala/tools/nsc/doc/html/SyntaxHigh.scala b/src/compiler/scala/tools/nsc/doc/html/SyntaxHigh.scala index 3ff973ec66..629ac84b34 100644 --- a/src/compiler/scala/tools/nsc/doc/html/SyntaxHigh.scala +++ b/src/compiler/scala/tools/nsc/doc/html/SyntaxHigh.scala @@ -40,8 +40,8 @@ private[html] object SyntaxHigh { /** Standard library classes/objects, sorted alphabetically */ val standards = Array ( - "Any", "AnyRef", "AnyVal", "App", "Application", "Array", - "Boolean", "Byte", "Char", "Class", "ClassTag", "ClassManifest", "ConcreteTypeTag", + "AbsTypeTag", "Any", "AnyRef", "AnyVal", "App", "Application", "Array", + "Boolean", "Byte", "Char", "Class", "ClassTag", "ClassManifest", "Console", "Double", "Enumeration", "Float", "Function", "Int", "List", "Long", "Manifest", "Map", "NoManifest", "None", "Nothing", "Null", "Object", "Option", "OptManifest", diff --git a/src/compiler/scala/tools/nsc/interpreter/ReplVals.scala b/src/compiler/scala/tools/nsc/interpreter/ReplVals.scala index ff99cd47da..588d0647d2 100644 --- a/src/compiler/scala/tools/nsc/interpreter/ReplVals.scala +++ b/src/compiler/scala/tools/nsc/interpreter/ReplVals.scala @@ -65,7 +65,7 @@ object ReplVals { * I have this forwarder which widens the type and then cast the result back * to the dependent type. */ - def compilerTypeFromTag(t: BaseUniverse # TypeTag[_]): Global#Type = + def compilerTypeFromTag(t: BaseUniverse # AbsTypeTag[_]): Global#Type = definitions.compilerTypeFromTag(t) class AppliedTypeFromTags(sym: Symbol) { diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala index 6d8ddab743..aa63f3ec31 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala @@ -1133,9 +1133,9 @@ trait Implicits { private def TagSymbols = TagMaterializers.keySet private val TagMaterializers = Map[Symbol, Symbol]( - ClassTagClass -> MacroInternal_materializeClassTag, - TypeTagClass -> MacroInternal_materializeTypeTag, - ConcreteTypeTagClass -> MacroInternal_materializeConcreteTypeTag + ClassTagClass -> MacroInternal_materializeClassTag, + AbsTypeTagClass -> MacroInternal_materializeAbsTypeTag, + TypeTagClass -> MacroInternal_materializeTypeTag ) /** Creates a tree will produce a tag of the requested flavor. @@ -1318,7 +1318,7 @@ trait Implicits { val interop = if (full) { val cm = typed(Ident(ReflectRuntimeCurrentMirror)) - gen.mkMethodCall(ReflectRuntimeUniverse, nme.concreteTypeTagToManifest, List(tp), List(cm, tagInScope)) + gen.mkMethodCall(ReflectRuntimeUniverse, nme.typeTagToManifest, List(tp), List(cm, tagInScope)) } else gen.mkMethodCall(ReflectRuntimeUniverse, nme.classTagToClassManifest, List(tp), List(tagInScope)) wrapResult(interop) } diff --git a/src/compiler/scala/tools/nsc/typechecker/Macros.scala b/src/compiler/scala/tools/nsc/typechecker/Macros.scala index 7b55ea6c72..ec14476d1a 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Macros.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Macros.scala @@ -104,7 +104,7 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { RepeatedParamClass.typeConstructor, List(implType(isType, sigma(origTpe.typeArgs.head)))) else { - val tsym = getMember(MacroContextClass, if (isType) tpnme.TypeTag else tpnme.Expr) + val tsym = getMember(MacroContextClass, if (isType) tpnme.AbsTypeTag else tpnme.Expr) typeRef(singleType(NoPrefix, ctxParam), tsym, List(sigma(origTpe))) } val paramCache = collection.mutable.Map[Symbol, Symbol]() @@ -155,7 +155,7 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { case TypeRef(SingleType(NoPrefix, contextParam), sym, List(tparam)) => var wannabe = sym while (wannabe.isAliasType) wannabe = wannabe.info.typeSymbol - if (wannabe != definitions.TypeTagClass && wannabe != definitions.ConcreteTypeTagClass) + if (wannabe != definitions.AbsTypeTagClass && wannabe != definitions.TypeTagClass) List(param) else transform(param, tparam.typeSymbol) map (_ :: Nil) getOrElse Nil @@ -200,6 +200,7 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { implicit class AugmentedString(s: String) { def abbreviateCoreAliases: String = { // hack! var result = s + result = result.replace("c.universe.AbsTypeTag", "c.AbsTypeTag") result = result.replace("c.universe.TypeTag", "c.TypeTag") result = result.replace("c.universe.Expr", "c.Expr") result @@ -884,17 +885,17 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { macroLogVerbose("resolved tparam %s as %s".format(tparam, tpe)) resolved(tparam) = tpe param.tpe.typeSymbol match { - case definitions.TypeTagClass => + case definitions.AbsTypeTagClass => // do nothing - case definitions.ConcreteTypeTagClass => - if (!tpe.isConcrete) context.abort(context.enclosingPosition, "cannot create ConcreteTypeTag from a type %s having unresolved type parameters".format(tpe)) + case definitions.TypeTagClass => + if (!tpe.isConcrete) context.abort(context.enclosingPosition, "cannot create TypeTag from a type %s having unresolved type parameters".format(tpe)) // otherwise do nothing case _ => throw new Error("unsupported tpe: " + tpe) } Some(tparam) }) - val tags = paramss.last takeWhile (_.isType) map (resolved(_)) map (tpe => if (tpe.isConcrete) context.ConcreteTypeTag(tpe) else context.TypeTag(tpe)) + val tags = paramss.last takeWhile (_.isType) map (resolved(_)) map (tpe => if (tpe.isConcrete) context.TypeTag(tpe) else context.AbsTypeTag(tpe)) if (paramss.lastOption map (params => !params.isEmpty && params.forall(_.isType)) getOrElse false) argss = argss :+ Nil argss = argss.dropRight(1) :+ (tags ++ argss.last) // todo. add support for context bounds in argss diff --git a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala index 465b1007cb..95d0369707 100644 --- a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala +++ b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala @@ -23,14 +23,14 @@ trait MethodSynthesis { import CODE._ object synthesisUtil { - type CTT[T] = ru.ConcreteTypeTag[T] + type TT[T] = ru.TypeTag[T] type CT[T] = ClassTag[T] def ValOrDefDef(sym: Symbol, body: Tree) = if (sym.isLazy) ValDef(sym, body) else DefDef(sym, body) - def applyTypeInternal(tags: List[CTT[_]]): Type = { + def applyTypeInternal(tags: List[TT[_]]): Type = { // [Eugene++ to Paul] needs review!! val symbols = tags map compilerSymbolFromTag val container :: args = symbols @@ -49,26 +49,26 @@ trait MethodSynthesis { rootMirror.getRequiredModule(ct.runtimeClass.getName).tpe // Use these like `applyType[List, Int]` or `applyType[Map, Int, String]` - def applyType[CC](implicit t1: CTT[CC]): Type = + def applyType[CC](implicit t1: TT[CC]): Type = applyTypeInternal(List(t1)) - def applyType[CC[X1], X1](implicit t1: CTT[CC[_]], t2: CTT[X1]): Type = - applyTypeInternal(List[CTT[_]](t1, t2)) + def applyType[CC[X1], X1](implicit t1: TT[CC[_]], t2: TT[X1]): Type = + applyTypeInternal(List[TT[_]](t1, t2)) - def applyType[CC[X1, X2], X1, X2](implicit t1: CTT[CC[_,_]], t2: CTT[X1], t3: CTT[X2]): Type = + def applyType[CC[X1, X2], X1, X2](implicit t1: TT[CC[_,_]], t2: TT[X1], t3: TT[X2]): Type = // [Eugene++] without an explicit type annotation for List, we get this: - // [scalacfork] C:\Projects\KeplerUnderRefactoring\src\compiler\scala\tools\nsc\typechecker\MethodSynthesis.scala:59: error: no type parameters for method apply: (xs: A*)List[A] in object List exist so that it can be applied to arguments (scala.tools.nsc.typechecker.MethodSynthesis.synthesisUtil.CTT[CC[_, _]], scala.tools.nsc.typechecker.MethodSynthesis.synthesisUtil.CTT[X1], scala.tools.nsc.typechecker.MethodSynthesis.synthesisUtil.CTT[X2]) + // [scalacfork] C:\Projects\KeplerUnderRefactoring\src\compiler\scala\tools\nsc\typechecker\MethodSynthesis.scala:59: error: no type parameters for method apply: (xs: A*)List[A] in object List exist so that it can be applied to arguments (scala.tools.nsc.typechecker.MethodSynthesis.synthesisUtil.TT[CC[_, _]], scala.tools.nsc.typechecker.MethodSynthesis.synthesisUtil.TT[X1], scala.tools.nsc.typechecker.MethodSynthesis.synthesisUtil.TT[X2]) // [scalacfork] --- because --- // [scalacfork] undetermined type // [scalacfork] applyTypeInternal(List(t1, t2, t3)) - applyTypeInternal(List[CTT[_]](t1, t2, t3)) + applyTypeInternal(List[TT[_]](t1, t2, t3)) - def applyType[CC[X1, X2, X3], X1, X2, X3](implicit t1: CTT[CC[_,_,_]], t2: CTT[X1], t3: CTT[X2], t4: CTT[X3]): Type = - applyTypeInternal(List[CTT[_]](t1, t2, t3, t4)) + def applyType[CC[X1, X2, X3], X1, X2, X3](implicit t1: TT[CC[_,_,_]], t2: TT[X1], t3: TT[X2], t4: TT[X3]): Type = + applyTypeInternal(List[TT[_]](t1, t2, t3, t4)) // [Martin->Eugene] !!! reinstantiate when typeables are in. // [Eugene++->Martin] now this compiles, will soon check it out - def newMethodType[F](owner: Symbol)(implicit t: CTT[F]): Type = { + def newMethodType[F](owner: Symbol)(implicit t: TT[F]): Type = { val fnSymbol = compilerSymbolFromTag(t) assert(fnSymbol isSubClass FunctionClass(t.tpe.typeArguments.size - 1), (owner, t)) // [Eugene++ to Paul] needs review!! diff --git a/src/compiler/scala/tools/nsc/typechecker/Tags.scala b/src/compiler/scala/tools/nsc/typechecker/Tags.scala index 753dbb8978..052484e8e1 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Tags.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Tags.scala @@ -26,7 +26,7 @@ trait Tags { /** Finds in scope or materializes a ClassTag. * Should be used instead of ClassManifest every time compiler needs to persist an erasure. * - * Once upon a time, we had an `ErasureTag` which was to `ClassTag` the same that `TypeTag` is for `ConcreteTypeTag`. + * Once upon a time, we had an `ErasureTag` which was to `ClassTag` the same that `AbsTypeTag` is for `TypeTag`. * However we found out that we don't really need this concept, so it got removed. * * @param pos Position for error reporting. Please, provide meaningful value. @@ -43,7 +43,7 @@ trait Tags { resolveTag(pos, taggedTp, allowMaterialization) } - /** Finds in scope or materializes a TypeTag (if `concrete` is false) or a ConcreteTypeTag (if `concrete` is true). + /** Finds in scope or materializes an AbsTypeTag (if `concrete` is false) or a TypeTag (if `concrete` is true). * * @param pos Position for error reporting. Please, provide meaningful value. * @param pre Prefix that represents a universe this type tag will be bound to. @@ -60,7 +60,7 @@ trait Tags { * EmptyTree if `allowMaterialization` is false, and there is no array tag in scope. */ def resolveTypeTag(pos: Position, pre: Type, tp: Type, concrete: Boolean, allowMaterialization: Boolean = true): Tree = { - val tagSym = if (concrete) ConcreteTypeTagClass else TypeTagClass + val tagSym = if (concrete) TypeTagClass else AbsTypeTagClass val tagTp = if (pre == NoType) TypeRef(BaseUniverseClass.asTypeConstructor, tagSym, List(tp)) else singleType(pre, pre member tagSym.name) val taggedTp = appliedType(tagTp, List(tp)) resolveTag(pos, taggedTp, allowMaterialization) diff --git a/src/compiler/scala/tools/reflect/FastTrack.scala b/src/compiler/scala/tools/reflect/FastTrack.scala index 2706087faa..59160f87d0 100644 --- a/src/compiler/scala/tools/reflect/FastTrack.scala +++ b/src/compiler/scala/tools/reflect/FastTrack.scala @@ -37,8 +37,8 @@ trait FastTrack { var registry = Map[Symbol, FastTrackEntry]() implicit class BindTo(sym: Symbol) { def bindTo(expander: FastTrackExpander): Unit = if (sym != NoSymbol) registry += sym -> FastTrackEntry(sym, expander) } MacroInternal_materializeClassTag bindTo { case (c, Apply(TypeApply(_, List(tt)), List(u))) => c.materializeClassTag(u, tt.tpe) } - MacroInternal_materializeTypeTag bindTo { case (c, Apply(TypeApply(_, List(tt)), List(u))) => c.materializeTypeTag(u, EmptyTree, tt.tpe, concrete = false) } - MacroInternal_materializeConcreteTypeTag bindTo { case (c, Apply(TypeApply(_, List(tt)), List(u))) => c.materializeTypeTag(u, EmptyTree, tt.tpe, concrete = true) } + MacroInternal_materializeAbsTypeTag bindTo { case (c, Apply(TypeApply(_, List(tt)), List(u))) => c.materializeTypeTag(u, EmptyTree, tt.tpe, concrete = false) } + MacroInternal_materializeTypeTag bindTo { case (c, Apply(TypeApply(_, List(tt)), List(u))) => c.materializeTypeTag(u, EmptyTree, tt.tpe, concrete = true) } ApiUniverseReify bindTo { case (c, Apply(TypeApply(_, List(tt)), List(expr))) => c.materializeExpr(c.prefix.tree, EmptyTree, expr) } MacroContextReify bindTo { case (c, Apply(TypeApply(_, List(tt)), List(expr))) => c.materializeExprForMacroContext(c.prefix.tree, expr) } ReflectRuntimeCurrentMirror bindTo { case (c, _) => scala.reflect.runtime.Macros.currentMirror(c).tree } diff --git a/src/library/scala/reflect/Manifest.scala b/src/library/scala/reflect/Manifest.scala index 559b82b177..7e320b42eb 100644 --- a/src/library/scala/reflect/Manifest.scala +++ b/src/library/scala/reflect/Manifest.scala @@ -39,7 +39,7 @@ import scala.collection.mutable.{ ArrayBuilder, WrappedArray } * */ @annotation.implicitNotFound(msg = "No Manifest available for ${T}.") -@deprecated("Use `@scala.reflect.ConcreteTypeTag` instead", "2.10.0") +@deprecated("Use TypeTag instead", "2.10.0") trait Manifest[T] extends ClassManifest[T] with Equals { override def typeArguments: List[Manifest[_]] = Nil @@ -76,7 +76,7 @@ abstract class AnyValManifest[T <: AnyVal](override val toString: String) extend * It is intended for use by the compiler and should not be used * in client code. */ -@deprecated("Use `@scala.reflect.ConcreteTypeTag` instead", "2.10.0") +@deprecated("Use TypeTag instead", "2.10.0") object Manifest { def valueManifests: List[AnyValManifest[_]] = List(Byte, Short, Char, Int, Long, Float, Double, Boolean, Unit) diff --git a/src/library/scala/reflect/base/TagInterop.scala b/src/library/scala/reflect/base/TagInterop.scala index 9c4159f1d8..158d1979e5 100644 --- a/src/library/scala/reflect/base/TagInterop.scala +++ b/src/library/scala/reflect/base/TagInterop.scala @@ -16,14 +16,14 @@ trait TagInterop { self: Universe => } // [Eugene++] `mirror` parameters are now of type `Any`, because I can't make these path-dependent types work - // if you're brave enough, replace `Any` with `Mirror`, recompile and run interop_concretetypetags_are_manifests.scala + // if you're brave enough, replace `Any` with `Mirror`, recompile and run interop_typetags_are_manifests.scala // [Eugene++] would be great if we could approximate the interop without any mirrors // todo. think how to implement that - def concreteTypeTagToManifest[T: ClassTag](mirror: Any, tag: base.Universe # ConcreteTypeTag[T]): Manifest[T] = + def typeTagToManifest[T: ClassTag](mirror: Any, tag: base.Universe # TypeTag[T]): Manifest[T] = throw new UnsupportedOperationException("This universe does not support tag -> manifest conversions. Use scala.reflect.runtime.universe from scala-reflect.jar.") - def manifestToConcreteTypeTag[T](mirror: Any, manifest: Manifest[T]): base.Universe # ConcreteTypeTag[T] = + def manifestToTypeTag[T](mirror: Any, manifest: Manifest[T]): base.Universe # TypeTag[T] = throw new UnsupportedOperationException("This universe does not support manifest -> tag conversions. Use scala.reflect.runtime.universe from scala-reflect.jar.") } diff --git a/src/library/scala/reflect/base/TypeTags.scala b/src/library/scala/reflect/base/TypeTags.scala index ed927fd889..774bc6ebea 100644 --- a/src/library/scala/reflect/base/TypeTags.scala +++ b/src/library/scala/reflect/base/TypeTags.scala @@ -17,15 +17,15 @@ import language.implicitConversions * === Overview === * * Type tags are organized in a hierarchy of three classes: - * [[scala.reflect.ClassTag]], [[scala.reflect.base.Universe#TypeTag]] and [[scala.reflect.base.Universe#ConcreteTypeTag]]. + * [[scala.reflect.ClassTag]], [[scala.reflect.base.Universe#TypeTag]] and [[scala.reflect.base.Universe#AbsTypeTag]]. * * A [[scala.reflect.ClassTag]] carries a runtime class that corresponds to the source type T. * As of such, it possesses the knowledge about how to build single- and multi-dimensional arrays of elements of that type. * It guarantees that the source type T did not to contain any references to type parameters or abstract types. * [[scala.reflect.ClassTag]] corresponds to a previous notion of [[scala.reflect.ClassManifest]]. * - * A [[scala.reflect.base.Universe#TypeTag]] value wraps a full Scala type in its tpe field. - * A [[scala.reflect.base.Universe#ConcreteTypeTag]] value is a [[scala.reflect.base.Universe#TypeTag]] + * A [[scala.reflect.base.Universe#AbsTypeTag]] value wraps a full Scala type in its tpe field. + * A [[scala.reflect.base.Universe#TypeTag]] value is an [[scala.reflect.base.Universe#AbsTypeTag]] * that is guaranteed not to contain any references to type parameters or abstract types. * * [Eugene++] also mention sensitivity to prefixes, i.e. that rb.TypeTag is different from ru.TypeTag @@ -40,49 +40,50 @@ import language.implicitConversions * import reflect.mirror._ * def f[T: TypeTag, U] = { * type L = T => U - * implicitly[TypeTag[L]] + * implicitly[AbsTypeTag[L]] * } * * Then a call of f[String, Int] will yield a result of the form * - * TypeTag(<[ String => U ]>). + * AbsTypeTag(<[ String => U ]>). * * Note that T has been replaced by String, because it comes with a TypeTag in f, whereas U was left as a type parameter. * - * === TypeTag vs ConcreteTypeTag === + * === AbsTypeTag vs TypeTag === * - * Be careful with TypeTag, because it will reify types even if these types are abstract. + * Be careful with AbsTypeTag, because it will reify types even if these types are abstract. * This makes it easy to forget to tag one of the methods in the call chain and discover it much later in the runtime * by getting cryptic errors far away from their source. For example, consider the following snippet: * - * def bind[T: TypeTag](name: String, value: T): IR.Result = bind((name, value)) - * def bind(p: NamedParam): IR.Result = bind(p.name, p.tpe, p.value) + * def bind[T: AbsTypeTag](name: String, value: T): IR.Result = bind((name, value)) + * def bind(p: NamedParam): IR.Result = bind(p.name, p.tpe, p.value) * object NamedParam { - * implicit def namedValue[T: TypeTag](name: String, x: T): NamedParam = apply(name, x) - * def apply[T: TypeTag](name: String, x: T): NamedParam = new Typed[T](name, x) + * implicit def namedValue[T: AbsTypeTag](name: String, x: T): NamedParam = apply(name, x) + * def apply[T: AbsTypeTag](name: String, x: T): NamedParam = new Typed[T](name, x) * } * * This fragment of Scala REPL implementation defines a `bind` function that carries a named value along with its type - * into the heart of the REPL. Using a [[scala.reflect.base.Universe#TypeTag]] here is reasonable, because it is desirable + * into the heart of the REPL. Using a [[scala.reflect.base.Universe#AbsTypeTag]] here is reasonable, because it is desirable * to work with all types, even if they are type parameters or abstract type members. * - * However if any of the three `TypeTag` context bounds is omitted, the resulting code will be incorrect, - * because the missing `TypeTag` will be transparently generated by the compiler, carrying meaningless information. + * However if any of the three `AbsTypeTag` context bounds is omitted, the resulting code will be incorrect, + * because the missing `AbsTypeTag` will be transparently generated by the compiler, carrying meaningless information. * Most likely, this problem will manifest itself elsewhere, making debugging complicated. - * If `TypeTag` context bounds were replaced with `ConcreteTypeTag`, then such errors would be reported statically. + * If `AbsTypeTag` context bounds were replaced with `TypeTag`, then such errors would be reported statically. * But in that case we wouldn't be able to use `bind` in arbitrary contexts. * * === Backward compatibility === * - * TypeTags correspond loosely to Manifests. More precisely: + * Type tags correspond loosely to manifests. + * + * More precisely: * The previous notion of a [[scala.reflect.ClassManifest]] corresponds to a scala.reflect.ClassTag, - * The previous notion of a [[scala.reflect.Manifest]] corresponds to scala.reflect.mirror.ConcreteTypeTag, - * Whereas scala.reflect.mirror.TypeTag is approximated by the previous notion of [[scala.reflect.OptManifest]]. + * The previous notion of a [[scala.reflect.Manifest]] corresponds to scala.reflect.runtime.universe.TypeTag, * * In Scala 2.10, manifests are deprecated, so it's adviseable to migrate them to tags, * because manifests might be removed in the next major release. * - * In most cases it will be enough to replace ClassManifests with ClassTags and Manifests with ConcreteTypeTags, + * In most cases it will be enough to replace ClassManifests with ClassTags and Manifests with TypeTags, * however there are a few caveats: * * 1) The notion of OptManifest is no longer supported. Tags can reify arbitrary types, so they are always available. @@ -102,19 +103,82 @@ import language.implicitConversions trait TypeTags { self: Universe => /** - * If an implicit value of type u.TypeTag[T] is required, the compiler will make one up on demand. + * If an implicit value of type u.AbsTypeTag[T] is required, the compiler will make one up on demand. * The implicitly created value contains in its tpe field a value of type u.Type that is a reflective representation of T. * In that value, any occurrences of type parameters or abstract types U * which come themselves with a TypeTag are represented by the type referenced by that TypeTag. * * @see [[scala.reflect.base.TypeTags]] */ - @annotation.implicitNotFound(msg = "No TypeTag available for ${T}") - trait TypeTag[T] extends Equals with Serializable { + @annotation.implicitNotFound(msg = "No AbsTypeTag available for ${T}") + trait AbsTypeTag[T] extends Equals with Serializable { val mirror: Mirror - def in[U <: Universe with Singleton](otherMirror: MirrorOf[U]): U # TypeTag[T] + def in[U <: Universe with Singleton](otherMirror: MirrorOf[U]): U # AbsTypeTag[T] def tpe: Type + /** case class accessories */ + override def canEqual(x: Any) = x.isInstanceOf[AbsTypeTag[_]] + override def equals(x: Any) = x.isInstanceOf[AbsTypeTag[_]] && this.mirror == x.asInstanceOf[AbsTypeTag[_]].mirror && this.tpe == x.asInstanceOf[AbsTypeTag[_]].tpe + override def hashCode = mirror.hashCode * 31 + tpe.hashCode + override def toString = "AbsTypeTag[" + tpe + "]" + } + + object AbsTypeTag { + val Byte : AbsTypeTag[scala.Byte] = TypeTag.Byte + val Short : AbsTypeTag[scala.Short] = TypeTag.Short + val Char : AbsTypeTag[scala.Char] = TypeTag.Char + val Int : AbsTypeTag[scala.Int] = TypeTag.Int + val Long : AbsTypeTag[scala.Long] = TypeTag.Long + val Float : AbsTypeTag[scala.Float] = TypeTag.Float + val Double : AbsTypeTag[scala.Double] = TypeTag.Double + val Boolean : AbsTypeTag[scala.Boolean] = TypeTag.Boolean + val Unit : AbsTypeTag[scala.Unit] = TypeTag.Unit + val Any : AbsTypeTag[scala.Any] = TypeTag.Any + val Object : AbsTypeTag[java.lang.Object] = TypeTag.Object + val Nothing : AbsTypeTag[scala.Nothing] = TypeTag.Nothing + val Null : AbsTypeTag[scala.Null] = TypeTag.Null + val String : AbsTypeTag[java.lang.String] = TypeTag.String + + def apply[T](mirror1: MirrorOf[self.type], tpec1: TypeCreator): AbsTypeTag[T] = + tpec1(mirror1) match { + case ByteTpe => AbsTypeTag.Byte.asInstanceOf[AbsTypeTag[T]] + case ShortTpe => AbsTypeTag.Short.asInstanceOf[AbsTypeTag[T]] + case CharTpe => AbsTypeTag.Char.asInstanceOf[AbsTypeTag[T]] + case IntTpe => AbsTypeTag.Int.asInstanceOf[AbsTypeTag[T]] + case LongTpe => AbsTypeTag.Long.asInstanceOf[AbsTypeTag[T]] + case FloatTpe => AbsTypeTag.Float.asInstanceOf[AbsTypeTag[T]] + case DoubleTpe => AbsTypeTag.Double.asInstanceOf[AbsTypeTag[T]] + case BooleanTpe => AbsTypeTag.Boolean.asInstanceOf[AbsTypeTag[T]] + case UnitTpe => AbsTypeTag.Unit.asInstanceOf[AbsTypeTag[T]] + case AnyTpe => AbsTypeTag.Any.asInstanceOf[AbsTypeTag[T]] + case ObjectTpe => AbsTypeTag.Object.asInstanceOf[AbsTypeTag[T]] + case NothingTpe => AbsTypeTag.Nothing.asInstanceOf[AbsTypeTag[T]] + case NullTpe => AbsTypeTag.Null.asInstanceOf[AbsTypeTag[T]] + case StringTpe => AbsTypeTag.String.asInstanceOf[AbsTypeTag[T]] + case _ => new AbsTypeTagImpl[T](mirror1.asInstanceOf[Mirror], tpec1) + } + + def unapply[T](ttag: AbsTypeTag[T]): Option[Type] = Some(ttag.tpe) + } + + private class AbsTypeTagImpl[T](val mirror: Mirror, val tpec: TypeCreator) extends AbsTypeTag[T] { + lazy val tpe: Type = tpec[self.type](mirror) + def in[U <: Universe with Singleton](otherMirror: MirrorOf[U]): U # AbsTypeTag[T] = { + val otherMirror1 = otherMirror.asInstanceOf[MirrorOf[otherMirror.universe.type]] + otherMirror.universe.AbsTypeTag[T](otherMirror1, tpec) + } + } + + /** + * If an implicit value of type u.TypeTag[T] is required, the compiler will make one up on demand following the same procedure as for TypeTags. + * However, if the resulting type still contains references to type parameters or abstract types, a static error results. + * + * @see [[scala.reflect.base.TypeTags]] + */ + @annotation.implicitNotFound(msg = "No TypeTag available for ${T}") + trait TypeTag[T] extends AbsTypeTag[T] with Equals with Serializable { + override def in[U <: Universe with Singleton](otherMirror: MirrorOf[U]): U # TypeTag[T] + /** case class accessories */ override def canEqual(x: Any) = x.isInstanceOf[TypeTag[_]] override def equals(x: Any) = x.isInstanceOf[TypeTag[_]] && this.mirror == x.asInstanceOf[TypeTag[_]].mirror && this.tpe == x.asInstanceOf[TypeTag[_]].tpe @@ -123,20 +187,20 @@ trait TypeTags { self: Universe => } object TypeTag { - val Byte : TypeTag[scala.Byte] = ConcreteTypeTag.Byte - val Short : TypeTag[scala.Short] = ConcreteTypeTag.Short - val Char : TypeTag[scala.Char] = ConcreteTypeTag.Char - val Int : TypeTag[scala.Int] = ConcreteTypeTag.Int - val Long : TypeTag[scala.Long] = ConcreteTypeTag.Long - val Float : TypeTag[scala.Float] = ConcreteTypeTag.Float - val Double : TypeTag[scala.Double] = ConcreteTypeTag.Double - val Boolean : TypeTag[scala.Boolean] = ConcreteTypeTag.Boolean - val Unit : TypeTag[scala.Unit] = ConcreteTypeTag.Unit - val Any : TypeTag[scala.Any] = ConcreteTypeTag.Any - val Object : TypeTag[java.lang.Object] = ConcreteTypeTag.Object - val Nothing : TypeTag[scala.Nothing] = ConcreteTypeTag.Nothing - val Null : TypeTag[scala.Null] = ConcreteTypeTag.Null - val String : TypeTag[java.lang.String] = ConcreteTypeTag.String + val Byte: TypeTag[scala.Byte] = new PredefTypeTag[scala.Byte] (ByteTpe, _.TypeTag.Byte) + val Short: TypeTag[scala.Short] = new PredefTypeTag[scala.Short] (ShortTpe, _.TypeTag.Short) + val Char: TypeTag[scala.Char] = new PredefTypeTag[scala.Char] (CharTpe, _.TypeTag.Char) + val Int: TypeTag[scala.Int] = new PredefTypeTag[scala.Int] (IntTpe, _.TypeTag.Int) + val Long: TypeTag[scala.Long] = new PredefTypeTag[scala.Long] (LongTpe, _.TypeTag.Long) + val Float: TypeTag[scala.Float] = new PredefTypeTag[scala.Float] (FloatTpe, _.TypeTag.Float) + val Double: TypeTag[scala.Double] = new PredefTypeTag[scala.Double] (DoubleTpe, _.TypeTag.Double) + val Boolean: TypeTag[scala.Boolean] = new PredefTypeTag[scala.Boolean] (BooleanTpe, _.TypeTag.Boolean) + val Unit: TypeTag[scala.Unit] = new PredefTypeTag[scala.Unit] (UnitTpe, _.TypeTag.Unit) + val Any: TypeTag[scala.Any] = new PredefTypeTag[scala.Any] (AnyTpe, _.TypeTag.Any) + val Object: TypeTag[java.lang.Object] = new PredefTypeTag[java.lang.Object] (ObjectTpe, _.TypeTag.Object) + val Nothing: TypeTag[scala.Nothing] = new PredefTypeTag[scala.Nothing] (NothingTpe, _.TypeTag.Nothing) + val Null: TypeTag[scala.Null] = new PredefTypeTag[scala.Null] (NullTpe, _.TypeTag.Null) + val String: TypeTag[java.lang.String] = new PredefTypeTag[java.lang.String] (StringTpe, _.TypeTag.String) def apply[T](mirror1: MirrorOf[self.type], tpec1: TypeCreator): TypeTag[T] = tpec1(mirror1) match { @@ -160,75 +224,14 @@ trait TypeTags { self: Universe => def unapply[T](ttag: TypeTag[T]): Option[Type] = Some(ttag.tpe) } - private class TypeTagImpl[T](val mirror: Mirror, val tpec: TypeCreator) extends TypeTag[T] { - lazy val tpe: Type = tpec[self.type](mirror) - def in[U <: Universe with Singleton](otherMirror: MirrorOf[U]): U # TypeTag[T] = { - val otherMirror1 = otherMirror.asInstanceOf[MirrorOf[otherMirror.universe.type]] - otherMirror.universe.TypeTag[T](otherMirror1, tpec) - } - } - - /** - * If an implicit value of type u.ConcreteTypeTag[T] is required, the compiler will make one up on demand following the same procedure as for TypeTags. - * However, if the resulting type still contains references to type parameters or abstract types, a static error results. - * - * @see [[scala.reflect.base.TypeTags]] - */ - @annotation.implicitNotFound(msg = "No ConcreteTypeTag available for ${T}") - trait ConcreteTypeTag[T] extends TypeTag[T] with Equals with Serializable { - /** case class accessories */ - override def canEqual(x: Any) = x.isInstanceOf[ConcreteTypeTag[_]] - override def equals(x: Any) = x.isInstanceOf[ConcreteTypeTag[_]] && this.mirror == x.asInstanceOf[ConcreteTypeTag[_]].mirror && this.tpe == x.asInstanceOf[ConcreteTypeTag[_]].tpe - override def hashCode = mirror.hashCode * 31 + tpe.hashCode - override def toString = "ConcreteTypeTag[" + tpe + "]" - } - - object ConcreteTypeTag { - val Byte: ConcreteTypeTag[scala.Byte] = new PredefConcreteTypeTag[scala.Byte] (ByteTpe, _.ConcreteTypeTag.Byte) - val Short: ConcreteTypeTag[scala.Short] = new PredefConcreteTypeTag[scala.Short] (ShortTpe, _.ConcreteTypeTag.Short) - val Char: ConcreteTypeTag[scala.Char] = new PredefConcreteTypeTag[scala.Char] (CharTpe, _.ConcreteTypeTag.Char) - val Int: ConcreteTypeTag[scala.Int] = new PredefConcreteTypeTag[scala.Int] (IntTpe, _.ConcreteTypeTag.Int) - val Long: ConcreteTypeTag[scala.Long] = new PredefConcreteTypeTag[scala.Long] (LongTpe, _.ConcreteTypeTag.Long) - val Float: ConcreteTypeTag[scala.Float] = new PredefConcreteTypeTag[scala.Float] (FloatTpe, _.ConcreteTypeTag.Float) - val Double: ConcreteTypeTag[scala.Double] = new PredefConcreteTypeTag[scala.Double] (DoubleTpe, _.ConcreteTypeTag.Double) - val Boolean: ConcreteTypeTag[scala.Boolean] = new PredefConcreteTypeTag[scala.Boolean] (BooleanTpe, _.ConcreteTypeTag.Boolean) - val Unit: ConcreteTypeTag[scala.Unit] = new PredefConcreteTypeTag[scala.Unit] (UnitTpe, _.ConcreteTypeTag.Unit) - val Any: ConcreteTypeTag[scala.Any] = new PredefConcreteTypeTag[scala.Any] (AnyTpe, _.ConcreteTypeTag.Any) - val Object: ConcreteTypeTag[java.lang.Object] = new PredefConcreteTypeTag[java.lang.Object] (ObjectTpe, _.ConcreteTypeTag.Object) - val Nothing: ConcreteTypeTag[scala.Nothing] = new PredefConcreteTypeTag[scala.Nothing] (NothingTpe, _.ConcreteTypeTag.Nothing) - val Null: ConcreteTypeTag[scala.Null] = new PredefConcreteTypeTag[scala.Null] (NullTpe, _.ConcreteTypeTag.Null) - val String: ConcreteTypeTag[java.lang.String] = new PredefConcreteTypeTag[java.lang.String] (StringTpe, _.ConcreteTypeTag.String) - - def apply[T](mirror1: MirrorOf[self.type], tpec1: TypeCreator): ConcreteTypeTag[T] = - tpec1(mirror1) match { - case ByteTpe => ConcreteTypeTag.Byte.asInstanceOf[ConcreteTypeTag[T]] - case ShortTpe => ConcreteTypeTag.Short.asInstanceOf[ConcreteTypeTag[T]] - case CharTpe => ConcreteTypeTag.Char.asInstanceOf[ConcreteTypeTag[T]] - case IntTpe => ConcreteTypeTag.Int.asInstanceOf[ConcreteTypeTag[T]] - case LongTpe => ConcreteTypeTag.Long.asInstanceOf[ConcreteTypeTag[T]] - case FloatTpe => ConcreteTypeTag.Float.asInstanceOf[ConcreteTypeTag[T]] - case DoubleTpe => ConcreteTypeTag.Double.asInstanceOf[ConcreteTypeTag[T]] - case BooleanTpe => ConcreteTypeTag.Boolean.asInstanceOf[ConcreteTypeTag[T]] - case UnitTpe => ConcreteTypeTag.Unit.asInstanceOf[ConcreteTypeTag[T]] - case AnyTpe => ConcreteTypeTag.Any.asInstanceOf[ConcreteTypeTag[T]] - case ObjectTpe => ConcreteTypeTag.Object.asInstanceOf[ConcreteTypeTag[T]] - case NothingTpe => ConcreteTypeTag.Nothing.asInstanceOf[ConcreteTypeTag[T]] - case NullTpe => ConcreteTypeTag.Null.asInstanceOf[ConcreteTypeTag[T]] - case StringTpe => ConcreteTypeTag.String.asInstanceOf[ConcreteTypeTag[T]] - case _ => new ConcreteTypeTagImpl[T](mirror1.asInstanceOf[Mirror], tpec1) - } - - def unapply[T](ttag: ConcreteTypeTag[T]): Option[Type] = Some(ttag.tpe) - } - - private class ConcreteTypeTagImpl[T](mirror: Mirror, tpec: TypeCreator) extends TypeTagImpl[T](mirror, tpec) with ConcreteTypeTag[T] { + private class TypeTagImpl[T](mirror: Mirror, tpec: TypeCreator) extends AbsTypeTagImpl[T](mirror, tpec) with TypeTag[T] { override def in[U <: Universe with Singleton](otherMirror: MirrorOf[U]): U # TypeTag[T] = { val otherMirror1 = otherMirror.asInstanceOf[MirrorOf[otherMirror.universe.type]] - otherMirror.universe.ConcreteTypeTag[T](otherMirror1, tpec) + otherMirror.universe.TypeTag[T](otherMirror1, tpec) } } - private class PredefConcreteTypeTag[T](_tpe: Type, copyIn: Universe => Universe # TypeTag[T]) extends ConcreteTypeTagImpl[T](rootMirror, null) { + private class PredefTypeTag[T](_tpe: Type, copyIn: Universe => Universe # TypeTag[T]) extends TypeTagImpl[T](rootMirror, null) { override lazy val tpe: Type = _tpe override def in[U <: Universe with Singleton](otherMirror: MirrorOf[U]): U # TypeTag[T] = copyIn(otherMirror.universe).asInstanceOf[U # TypeTag[T]] @@ -237,7 +240,6 @@ trait TypeTags { self: Universe => // incantations def typeTag[T](implicit ttag: TypeTag[T]) = ttag - def concreteTypeTag[T](implicit cttag: ConcreteTypeTag[T]) = cttag // big thanks to Viktor Klang for this brilliant idea! def typeOf[T](implicit ttag: TypeTag[T]): Type = ttag.tpe diff --git a/src/library/scala/reflect/compat.scala b/src/library/scala/reflect/compat.scala index 7bfe9f38e1..fc0e5fbf9c 100644 --- a/src/library/scala/reflect/compat.scala +++ b/src/library/scala/reflect/compat.scala @@ -1,7 +1,9 @@ // [Eugene++] delete this once we merge with trunk and have a working IDE package scala.reflect { + trait ArrayTag[T] trait ErasureTag[T] + trait ConcreteTypeTag[T] } package scala.reflect.api { @@ -24,6 +26,8 @@ package scala.reflect { import scala.reflect.base.{Universe => BaseUniverse} trait internal_compat { + private[scala] def materializeArrayTag[T](u: BaseUniverse): ArrayTag[T] = ??? private[scala] def materializeErasureTag[T](u: BaseUniverse): ErasureTag[T] = ??? + private[scala] def materializeConcreteTypeTag[T](u: BaseUniverse): ConcreteTypeTag[T] = ??? } } \ No newline at end of file diff --git a/src/library/scala/reflect/makro/internal/package.scala b/src/library/scala/reflect/makro/internal/package.scala index f98177542a..d31a0f0d14 100644 --- a/src/library/scala/reflect/makro/internal/package.scala +++ b/src/library/scala/reflect/makro/internal/package.scala @@ -11,6 +11,6 @@ import scala.reflect.base.{Universe => BaseUniverse} // [Eugene++] how do I hide this from scaladoc? package object internal extends scala.reflect.internal_compat { private[scala] def materializeClassTag[T](u: BaseUniverse): ClassTag[T] = macro ??? + private[scala] def materializeAbsTypeTag[T](u: BaseUniverse): u.AbsTypeTag[T] = macro ??? private[scala] def materializeTypeTag[T](u: BaseUniverse): u.TypeTag[T] = macro ??? - private[scala] def materializeConcreteTypeTag[T](u: BaseUniverse): u.ConcreteTypeTag[T] = macro ??? } diff --git a/src/library/scala/reflect/package.scala b/src/library/scala/reflect/package.scala index 49374a552c..0ee58df2cd 100644 --- a/src/library/scala/reflect/package.scala +++ b/src/library/scala/reflect/package.scala @@ -4,6 +4,15 @@ package object reflect extends reflect_compat { lazy val basis: base.Universe = new base.Base + def classTag[T](implicit ctag: ClassTag[T]) = ctag + // typeTag incantation is defined inside scala.reflect.basis and scala.reflect.runtime.universe + + // ClassTag class is defined in ClassTag.scala + type TypeTag[T] = scala.reflect.basis.TypeTag[T] + + // ClassTag object is defined in ClassTag.scala + lazy val TypeTag = scala.reflect.basis.TypeTag + @deprecated("Use `@scala.beans.BeanDescription` instead", "2.10.0") type BeanDescription = scala.beans.BeanDescription @deprecated("Use `@scala.beans.BeanDisplayName` instead", "2.10.0") @@ -18,16 +27,4 @@ package object reflect extends reflect_compat { type BooleanBeanProperty = scala.beans.BooleanBeanProperty @deprecated("Use `@scala.beans.ScalaBeanInfo` instead", "2.10.0") type ScalaBeanInfo = scala.beans.ScalaBeanInfo - - // ClassTag class is defined outside the basis - def classTag[T](implicit ctag: ClassTag[T]) = ctag - // typeTag incantation is defined inside the basis - // concreteTypeTag incantation is defined inside the basis - - type TypeTag[T] = scala.reflect.basis.TypeTag[T] - type ConcreteTypeTag[T] = scala.reflect.basis.ConcreteTypeTag[T] - - // ClassTag object is defined outside the basis - lazy val TypeTag = scala.reflect.basis.TypeTag - lazy val ConcreteTypeTag = scala.reflect.basis.ConcreteTypeTag } diff --git a/src/reflect/scala/reflect/api/Exprs.scala b/src/reflect/scala/reflect/api/Exprs.scala index bda125a1a1..8b2a3b4ea8 100644 --- a/src/reflect/scala/reflect/api/Exprs.scala +++ b/src/reflect/scala/reflect/api/Exprs.scala @@ -30,14 +30,14 @@ trait Exprs { self: Universe => } object Expr { - def apply[T: TypeTag](mirror: MirrorOf[self.type], treec: TreeCreator): Expr[T] = new ExprImpl[T](mirror.asInstanceOf[Mirror], treec) + def apply[T: AbsTypeTag](mirror: MirrorOf[self.type], treec: TreeCreator): Expr[T] = new ExprImpl[T](mirror.asInstanceOf[Mirror], treec) def unapply[T](expr: Expr[T]): Option[Tree] = Some(expr.tree) } - private class ExprImpl[+T: TypeTag](val mirror: Mirror, val treec: TreeCreator) extends Expr[T] { + private class ExprImpl[+T: AbsTypeTag](val mirror: Mirror, val treec: TreeCreator) extends Expr[T] { def in[U <: Universe with Singleton](otherMirror: MirrorOf[U]): U # Expr[T] = { val otherMirror1 = otherMirror.asInstanceOf[MirrorOf[otherMirror.universe.type]] - val tag1 = (implicitly[TypeTag[T]] in otherMirror).asInstanceOf[otherMirror.universe.TypeTag[T]] + val tag1 = (implicitly[AbsTypeTag[T]] in otherMirror).asInstanceOf[otherMirror.universe.AbsTypeTag[T]] otherMirror.universe.Expr[T](otherMirror1, treec)(tag1) } @@ -45,7 +45,7 @@ trait Exprs { self: Universe => // [Eugene++] this is important // !!! remove when we have improved type inference for singletons // search for .type] to find other instances - lazy val staticTpe: Type = implicitly[TypeTag[T]].tpe + lazy val staticTpe: Type = implicitly[AbsTypeTag[T]].tpe def actualTpe: Type = tree.tpe def splice: T = throw new UnsupportedOperationException(""" diff --git a/src/reflect/scala/reflect/api/TagInterop.scala b/src/reflect/scala/reflect/api/TagInterop.scala index e10b89d1c6..95c4e78cf4 100644 --- a/src/reflect/scala/reflect/api/TagInterop.scala +++ b/src/reflect/scala/reflect/api/TagInterop.scala @@ -11,7 +11,7 @@ trait TagInterop { self: JavaUniverse => // [Eugene++] would be great if we could approximate the interop without any mirrors // todo. think how to implement that - override def concreteTypeTagToManifest[T: ClassTag](mirror0: Any, tag: base.Universe # ConcreteTypeTag[T]): Manifest[T] = { + override def typeTagToManifest[T: ClassTag](mirror0: Any, tag: base.Universe # TypeTag[T]): Manifest[T] = { // [Eugene++] implement more sophisticated logic // Martin said it'd be okay to simply copypaste `Implicits.manifestOfType` val mirror = mirror0.asInstanceOf[Mirror] @@ -19,8 +19,8 @@ trait TagInterop { self: JavaUniverse => Manifest.classType(runtimeClass).asInstanceOf[Manifest[T]] } - override def manifestToConcreteTypeTag[T](mirror0: Any, manifest: Manifest[T]): base.Universe # ConcreteTypeTag[T] = - ConcreteTypeTag(mirror0.asInstanceOf[Mirror], new TypeCreator { + override def manifestToTypeTag[T](mirror0: Any, manifest: Manifest[T]): base.Universe # TypeTag[T] = + TypeTag(mirror0.asInstanceOf[Mirror], new TypeCreator { def apply[U <: BaseUniverse with Singleton](mirror: MirrorOf[U]): U # Type = { mirror.universe match { case ju: JavaUniverse => @@ -28,10 +28,10 @@ trait TagInterop { self: JavaUniverse => val sym = jm.reflectClass(manifest.erasure).symbol val tpe = if (manifest.typeArguments.isEmpty) sym.asType - else ju.appliedType(sym.asTypeConstructor, manifest.typeArguments map (targ => ju.manifestToConcreteTypeTag(jm, targ)) map (_.in(jm).tpe)) + else ju.appliedType(sym.asTypeConstructor, manifest.typeArguments map (targ => ju.manifestToTypeTag(jm, targ)) map (_.in(jm).tpe)) tpe.asInstanceOf[U # Type] case u => - u.manifestToConcreteTypeTag(mirror.asInstanceOf[u.Mirror], manifest).in(mirror).tpe + u.manifestToTypeTag(mirror.asInstanceOf[u.Mirror], manifest).in(mirror).tpe } } }) diff --git a/src/reflect/scala/reflect/internal/Definitions.scala b/src/reflect/scala/reflect/internal/Definitions.scala index e4a2623c31..a9d9b06621 100644 --- a/src/reflect/scala/reflect/internal/Definitions.scala +++ b/src/reflect/scala/reflect/internal/Definitions.scala @@ -470,10 +470,10 @@ trait Definitions extends api.StandardDefinitions { lazy val ClassTagModule = requiredModule[scala.reflect.ClassTag[_]] lazy val ClassTagClass = requiredClass[scala.reflect.ClassTag[_]] lazy val TypeTagsClass = requiredClass[scala.reflect.base.TypeTags] + lazy val AbsTypeTagClass = getMemberClass(TypeTagsClass, tpnme.AbsTypeTag) + lazy val AbsTypeTagModule = getMemberModule(TypeTagsClass, nme.AbsTypeTag) lazy val TypeTagClass = getMemberClass(TypeTagsClass, tpnme.TypeTag) lazy val TypeTagModule = getMemberModule(TypeTagsClass, nme.TypeTag) - lazy val ConcreteTypeTagClass = getMemberClass(TypeTagsClass, tpnme.ConcreteTypeTag) - lazy val ConcreteTypeTagModule = getMemberModule(TypeTagsClass, nme.ConcreteTypeTag) lazy val BaseUniverseClass = requiredClass[scala.reflect.base.Universe] lazy val ApiUniverseClass = getClassIfDefined("scala.reflect.api.Universe") // defined in scala-reflect.jar, so we need to be careful @@ -485,17 +485,17 @@ trait Definitions extends api.StandardDefinitions { lazy val TypeCreatorClass = requiredClass[scala.reflect.base.TypeCreator] lazy val TreeCreatorClass = requiredClass[scala.reflect.base.TreeCreator] - lazy val MacroContextClass = getClassIfDefined("scala.reflect.makro.Context") // defined in scala-reflect.jar, so we need to be careful - def MacroContextPrefix = if (MacroContextClass != NoSymbol) getMemberMethod(MacroContextClass, nme.prefix) else NoSymbol - def MacroContextPrefixType = if (MacroContextClass != NoSymbol) getMemberType(MacroContextClass, tpnme.PrefixType) else NoSymbol - def MacroContextUniverse = if (MacroContextClass != NoSymbol) getMemberMethod(MacroContextClass, nme.universe) else NoSymbol - def MacroContextMirror = if (MacroContextClass != NoSymbol) getMemberMethod(MacroContextClass, nme.mirror) else NoSymbol - def MacroContextReify = if (MacroContextClass != NoSymbol) getMemberMethod(MacroContextClass, nme.reify) else NoSymbol - lazy val MacroImplAnnotation = requiredClass[scala.reflect.makro.internal.macroImpl] - lazy val MacroInternalPackage = getPackageObject("scala.reflect.makro.internal") - def MacroInternal_materializeClassTag = getMemberMethod(MacroInternalPackage, nme.materializeClassTag) - def MacroInternal_materializeTypeTag = getMemberMethod(MacroInternalPackage, nme.materializeTypeTag) - def MacroInternal_materializeConcreteTypeTag = getMemberMethod(MacroInternalPackage, nme.materializeConcreteTypeTag) + lazy val MacroContextClass = getClassIfDefined("scala.reflect.makro.Context") // defined in scala-reflect.jar, so we need to be careful + def MacroContextPrefix = if (MacroContextClass != NoSymbol) getMemberMethod(MacroContextClass, nme.prefix) else NoSymbol + def MacroContextPrefixType = if (MacroContextClass != NoSymbol) getMemberType(MacroContextClass, tpnme.PrefixType) else NoSymbol + def MacroContextUniverse = if (MacroContextClass != NoSymbol) getMemberMethod(MacroContextClass, nme.universe) else NoSymbol + def MacroContextMirror = if (MacroContextClass != NoSymbol) getMemberMethod(MacroContextClass, nme.mirror) else NoSymbol + def MacroContextReify = if (MacroContextClass != NoSymbol) getMemberMethod(MacroContextClass, nme.reify) else NoSymbol + lazy val MacroImplAnnotation = requiredClass[scala.reflect.makro.internal.macroImpl] + lazy val MacroInternalPackage = getPackageObject("scala.reflect.makro.internal") + def MacroInternal_materializeClassTag = getMemberMethod(MacroInternalPackage, nme.materializeClassTag) + def MacroInternal_materializeAbsTypeTag = getMemberMethod(MacroInternalPackage, nme.materializeAbsTypeTag) + def MacroInternal_materializeTypeTag = getMemberMethod(MacroInternalPackage, nme.materializeTypeTag) lazy val ScalaSignatureAnnotation = requiredClass[scala.reflect.ScalaSignature] lazy val ScalaLongSignatureAnnotation = requiredClass[scala.reflect.ScalaLongSignature] @@ -506,8 +506,8 @@ trait Definitions extends api.StandardDefinitions { lazy val NoneModule: ModuleSymbol = requiredModule[scala.None.type] lazy val SomeModule: ModuleSymbol = requiredModule[scala.Some.type] - def compilerTypeFromTag(tt: BaseUniverse # TypeTag[_]): Type = tt.in(rootMirror).tpe - def compilerSymbolFromTag(tt: BaseUniverse # TypeTag[_]): Symbol = tt.in(rootMirror).tpe.typeSymbol + def compilerTypeFromTag(tt: BaseUniverse # AbsTypeTag[_]): Type = tt.in(rootMirror).tpe + def compilerSymbolFromTag(tt: BaseUniverse # AbsTypeTag[_]): Symbol = tt.in(rootMirror).tpe.typeSymbol // The given symbol represents either String.+ or StringAdd.+ def isStringAddition(sym: Symbol) = sym == String_+ || sym == StringAdd_+ diff --git a/src/reflect/scala/reflect/internal/StdNames.scala b/src/reflect/scala/reflect/internal/StdNames.scala index 5ff02bab82..bd02013037 100644 --- a/src/reflect/scala/reflect/internal/StdNames.scala +++ b/src/reflect/scala/reflect/internal/StdNames.scala @@ -122,16 +122,16 @@ trait StdNames { scala.List(Byte, Char, Short, Int, Long, Float, Double, Boolean, Unit) // some types whose companions we utilize - final val AnyRef: NameType = "AnyRef" - final val Array: NameType = "Array" - final val List: NameType = "List" - final val Seq: NameType = "Seq" - final val Symbol: NameType = "Symbol" - final val ClassTag: NameType = "ClassTag" - final val TypeTag : NameType = "TypeTag" - final val ConcreteTypeTag: NameType = "ConcreteTypeTag" - final val Expr: NameType = "Expr" - final val String: NameType = "String" + final val AnyRef: NameType = "AnyRef" + final val Array: NameType = "Array" + final val List: NameType = "List" + final val Seq: NameType = "Seq" + final val Symbol: NameType = "Symbol" + final val ClassTag: NameType = "ClassTag" + final val AbsTypeTag: NameType = "AbsTypeTag" + final val TypeTag : NameType = "TypeTag" + final val Expr: NameType = "Expr" + final val String: NameType = "String" // fictions we use as both types and terms final val ERROR: NameType = "" @@ -642,7 +642,6 @@ trait StdNames { val classOf: NameType = "classOf" val classTagToClassManifest: NameType = "classTagToClassManifest" val clone_ : NameType = if (forMSIL) "MemberwiseClone" else "clone" // sn.OClone causes checkinit failure - val concreteTypeTagToManifest: NameType = "concreteTypeTagToManifest" val conforms: NameType = "conforms" val copy: NameType = "copy" val currentMirror: NameType = "currentMirror" @@ -697,10 +696,10 @@ trait StdNames { val macroContext : NameType = "c" val main: NameType = "main" val manifest: NameType = "manifest" - val manifestToConcreteTypeTag: NameType = "manifestToConcreteTypeTag" + val manifestToTypeTag: NameType = "manifestToTypeTag" val map: NameType = "map" val materializeClassTag: NameType = "materializeClassTag" - val materializeConcreteTypeTag: NameType = "materializeConcreteTypeTag" + val materializeAbsTypeTag: NameType = "materializeAbsTypeTag" val materializeTypeTag: NameType = "materializeTypeTag" val mirror : NameType = "mirror" val moduleClass : NameType = "moduleClass" @@ -764,6 +763,7 @@ trait StdNames { val tree : NameType = "tree" val true_ : NameType = "true" val typedProductIterator: NameType = "typedProductIterator" + val typeTagToManifest: NameType = "typeTagToManifest" val unapply: NameType = "unapply" val unapplySeq: NameType = "unapplySeq" val unbox: NameType = "unbox" diff --git a/src/reflect/scala/reflect/makro/Aliases.scala b/src/reflect/scala/reflect/makro/Aliases.scala index c78c9a6a04..4bd246572f 100644 --- a/src/reflect/scala/reflect/makro/Aliases.scala +++ b/src/reflect/scala/reflect/makro/Aliases.scala @@ -17,11 +17,10 @@ trait Aliases { type Expr[+T] = universe.Expr[T] val Expr = universe.Expr + type AbsTypeTag[T] = universe.AbsTypeTag[T] type TypeTag[T] = universe.TypeTag[T] - type ConcreteTypeTag[T] = universe.ConcreteTypeTag[T] + val AbsTypeTag = universe.AbsTypeTag val TypeTag = universe.TypeTag - val ConcreteTypeTag = universe.ConcreteTypeTag def typeTag[T](implicit ttag: TypeTag[T]) = ttag - def concreteTypeTag[T](implicit cttag: ConcreteTypeTag[T]) = cttag def typeOf[T](implicit ttag: TypeTag[T]): Type = ttag.tpe } diff --git a/src/reflect/scala/reflect/makro/Exprs.scala b/src/reflect/scala/reflect/makro/Exprs.scala index b4f8e7ac4e..91d3dafbf2 100644 --- a/src/reflect/scala/reflect/makro/Exprs.scala +++ b/src/reflect/scala/reflect/makro/Exprs.scala @@ -4,5 +4,5 @@ package makro trait Exprs { self: Context => - def Expr[T: TypeTag](tree: Tree): Expr[T] + def Expr[T: AbsTypeTag](tree: Tree): Expr[T] } diff --git a/src/reflect/scala/reflect/makro/TypeTags.scala b/src/reflect/scala/reflect/makro/TypeTags.scala index 3251c27908..53a9b116e3 100644 --- a/src/reflect/scala/reflect/makro/TypeTags.scala +++ b/src/reflect/scala/reflect/makro/TypeTags.scala @@ -4,6 +4,6 @@ package makro trait TypeTags { self: Context => + def AbsTypeTag[T](tpe: Type): AbsTypeTag[T] def TypeTag[T](tpe: Type): TypeTag[T] - def ConcreteTypeTag[T](tpe: Type): ConcreteTypeTag[T] } diff --git a/test/files/jvm/manifests-new.check b/test/files/jvm/manifests-new.check index 43e24fb73c..9ff49ef8b4 100644 --- a/test/files/jvm/manifests-new.check +++ b/test/files/jvm/manifests-new.check @@ -1,38 +1,38 @@ -x=(), t=ConcreteTypeTag[Unit], k=TypeRef, s=class Unit -x=true, t=ConcreteTypeTag[Boolean], k=TypeRef, s=class Boolean -x=a, t=ConcreteTypeTag[Char], k=TypeRef, s=class Char -x=1, t=ConcreteTypeTag[Int], k=TypeRef, s=class Int -x=abc, t=ConcreteTypeTag[java.lang.String], k=TypeRef, s=class String -x='abc, t=ConcreteTypeTag[Symbol], k=TypeRef, s=class Symbol - -x=List(()), t=ConcreteTypeTag[List[Unit]], k=TypeRef, s=class List -x=List(true), t=ConcreteTypeTag[List[Boolean]], k=TypeRef, s=class List -x=List(1), t=ConcreteTypeTag[List[Int]], k=TypeRef, s=class List -x=List(abc), t=ConcreteTypeTag[List[java.lang.String]], k=TypeRef, s=class List -x=List('abc), t=ConcreteTypeTag[List[Symbol]], k=TypeRef, s=class List - -x=[Z, t=ConcreteTypeTag[Array[Boolean]], k=TypeRef, s=class Array -x=[C, t=ConcreteTypeTag[Array[Char]], k=TypeRef, s=class Array -x=[I, t=ConcreteTypeTag[Array[Int]], k=TypeRef, s=class Array -x=[Ljava.lang.String;, t=ConcreteTypeTag[Array[java.lang.String]], k=TypeRef, s=class Array -x=[Lscala.Symbol;, t=ConcreteTypeTag[Array[Symbol]], k=TypeRef, s=class Array - -x=((),()), t=ConcreteTypeTag[(Unit, Unit)], k=TypeRef, s=class Tuple2 -x=(true,false), t=ConcreteTypeTag[(Boolean, Boolean)], k=TypeRef, s=class Tuple2 -x=(1,2), t=ConcreteTypeTag[(Int, Int)], k=TypeRef, s=class Tuple2 -x=(abc,xyz), t=ConcreteTypeTag[(java.lang.String, java.lang.String)], k=TypeRef, s=class Tuple2 -x=('abc,'xyz), t=ConcreteTypeTag[(Symbol, Symbol)], k=TypeRef, s=class Tuple2 - -x=Test$, t=ConcreteTypeTag[Test.type], k=SingleType, s=object Test -x=scala.collection.immutable.List$, t=ConcreteTypeTag[scala.collection.immutable.List.type], k=SingleType, s=object List - -x=Foo, t=ConcreteTypeTag[Foo[Int]], k=TypeRef, s=class Foo -x=Foo, t=ConcreteTypeTag[Foo[List[Int]]], k=TypeRef, s=class Foo -x=Foo, t=ConcreteTypeTag[Foo[Foo[Int]]], k=TypeRef, s=class Foo -x=Foo, t=ConcreteTypeTag[Foo[List[Foo[Int]]]], k=TypeRef, s=class Foo - -x=Test1$$anon$1, t=ConcreteTypeTag[Bar[java.lang.String]], k=RefinedType, s= -x=Test1$$anon$2, t=ConcreteTypeTag[Bar[java.lang.String]], k=RefinedType, s= +x=(), t=TypeTag[Unit], k=TypeRef, s=class Unit +x=true, t=TypeTag[Boolean], k=TypeRef, s=class Boolean +x=a, t=TypeTag[Char], k=TypeRef, s=class Char +x=1, t=TypeTag[Int], k=TypeRef, s=class Int +x=abc, t=TypeTag[java.lang.String], k=TypeRef, s=class String +x='abc, t=TypeTag[Symbol], k=TypeRef, s=class Symbol + +x=List(()), t=TypeTag[List[Unit]], k=TypeRef, s=class List +x=List(true), t=TypeTag[List[Boolean]], k=TypeRef, s=class List +x=List(1), t=TypeTag[List[Int]], k=TypeRef, s=class List +x=List(abc), t=TypeTag[List[java.lang.String]], k=TypeRef, s=class List +x=List('abc), t=TypeTag[List[Symbol]], k=TypeRef, s=class List + +x=[Z, t=TypeTag[Array[Boolean]], k=TypeRef, s=class Array +x=[C, t=TypeTag[Array[Char]], k=TypeRef, s=class Array +x=[I, t=TypeTag[Array[Int]], k=TypeRef, s=class Array +x=[Ljava.lang.String;, t=TypeTag[Array[java.lang.String]], k=TypeRef, s=class Array +x=[Lscala.Symbol;, t=TypeTag[Array[Symbol]], k=TypeRef, s=class Array + +x=((),()), t=TypeTag[(Unit, Unit)], k=TypeRef, s=class Tuple2 +x=(true,false), t=TypeTag[(Boolean, Boolean)], k=TypeRef, s=class Tuple2 +x=(1,2), t=TypeTag[(Int, Int)], k=TypeRef, s=class Tuple2 +x=(abc,xyz), t=TypeTag[(java.lang.String, java.lang.String)], k=TypeRef, s=class Tuple2 +x=('abc,'xyz), t=TypeTag[(Symbol, Symbol)], k=TypeRef, s=class Tuple2 + +x=Test$, t=TypeTag[Test.type], k=SingleType, s=object Test +x=scala.collection.immutable.List$, t=TypeTag[scala.collection.immutable.List.type], k=SingleType, s=object List + +x=Foo, t=TypeTag[Foo[Int]], k=TypeRef, s=class Foo +x=Foo, t=TypeTag[Foo[List[Int]]], k=TypeRef, s=class Foo +x=Foo, t=TypeTag[Foo[Foo[Int]]], k=TypeRef, s=class Foo +x=Foo, t=TypeTag[Foo[List[Foo[Int]]]], k=TypeRef, s=class Foo + +x=Test1$$anon$1, t=TypeTag[Bar[java.lang.String]], k=RefinedType, s= +x=Test1$$anon$2, t=TypeTag[Bar[java.lang.String]], k=RefinedType, s= ()=() true=true diff --git a/test/files/jvm/manifests-new.scala b/test/files/jvm/manifests-new.scala index b5d0e0f7d7..8706881640 100644 --- a/test/files/jvm/manifests-new.scala +++ b/test/files/jvm/manifests-new.scala @@ -101,10 +101,10 @@ trait TestUtil { val in = new ObjectInputStream(new ByteArrayInputStream(buffer)) in.readObject().asInstanceOf[A] } - def print[T](x: T)(implicit t: ConcreteTypeTag[T]) { + def print[T](x: T)(implicit t: TypeTag[T]) { // todo. type tags are not yet serializable -// val t1: ConcreteTypeTag[T] = read(write(t)) - val t1: ConcreteTypeTag[T] = t +// val t1: TypeTag[T] = read(write(t)) + val t1: TypeTag[T] = t val x1 = x.toString.replaceAll("@[0-9a-z]+$", "") println("x="+x1+", t="+t1+", k="+t1.tpe.kind+", s="+t1.tpe.typeSymbol.toString) } diff --git a/test/files/neg/interop_abstypetags_arenot_classmanifests.check b/test/files/neg/interop_abstypetags_arenot_classmanifests.check new file mode 100644 index 0000000000..3134aadb58 --- /dev/null +++ b/test/files/neg/interop_abstypetags_arenot_classmanifests.check @@ -0,0 +1,4 @@ +interop_abstypetags_arenot_classmanifests.scala:5: error: could not find implicit value for parameter m: ClassManifest[T] + println(classManifest[T]) + ^ +one error found diff --git a/test/files/neg/interop_abstypetags_arenot_classmanifests.scala b/test/files/neg/interop_abstypetags_arenot_classmanifests.scala new file mode 100644 index 0000000000..c8567be5d4 --- /dev/null +++ b/test/files/neg/interop_abstypetags_arenot_classmanifests.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + def absTypeTagIsnotClassManifest[T: AbsTypeTag] = { + println(classManifest[T]) + } + + absTypeTagIsnotClassManifest[Int] + absTypeTagIsnotClassManifest[String] + absTypeTagIsnotClassManifest[Array[Int]] +} \ No newline at end of file diff --git a/test/files/neg/interop_abstypetags_arenot_classtags.check b/test/files/neg/interop_abstypetags_arenot_classtags.check new file mode 100644 index 0000000000..637db83e57 --- /dev/null +++ b/test/files/neg/interop_abstypetags_arenot_classtags.check @@ -0,0 +1,4 @@ +interop_abstypetags_arenot_classtags.scala:6: error: No ClassTag available for T + println(classTag[T]) + ^ +one error found diff --git a/test/files/neg/interop_abstypetags_arenot_classtags.scala b/test/files/neg/interop_abstypetags_arenot_classtags.scala new file mode 100644 index 0000000000..e3911c1588 --- /dev/null +++ b/test/files/neg/interop_abstypetags_arenot_classtags.scala @@ -0,0 +1,12 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.{ClassTag, classTag} + +object Test extends App { + def absTypeTagIsnotClassTag[T: AbsTypeTag] = { + println(classTag[T]) + } + + absTypeTagIsnotClassTag[Int] + absTypeTagIsnotClassTag[String] + absTypeTagIsnotClassTag[Array[Int]] +} \ No newline at end of file diff --git a/test/files/neg/interop_abstypetags_arenot_manifests.check b/test/files/neg/interop_abstypetags_arenot_manifests.check new file mode 100644 index 0000000000..c80635543f --- /dev/null +++ b/test/files/neg/interop_abstypetags_arenot_manifests.check @@ -0,0 +1,4 @@ +interop_abstypetags_arenot_manifests.scala:5: error: No Manifest available for T. + println(manifest[T]) + ^ +one error found diff --git a/test/files/neg/interop_abstypetags_arenot_manifests.scala b/test/files/neg/interop_abstypetags_arenot_manifests.scala new file mode 100644 index 0000000000..77a95048fd --- /dev/null +++ b/test/files/neg/interop_abstypetags_arenot_manifests.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + def absTypeTagIsnotManifest[T: AbsTypeTag] = { + println(manifest[T]) + } + + absTypeTagIsnotManifest[Int] + absTypeTagIsnotManifest[String] + absTypeTagIsnotManifest[Array[Int]] +} \ No newline at end of file diff --git a/test/files/neg/interop_classmanifests_arenot_concretetypetags.check b/test/files/neg/interop_classmanifests_arenot_concretetypetags.check deleted file mode 100644 index e51324f241..0000000000 --- a/test/files/neg/interop_classmanifests_arenot_concretetypetags.check +++ /dev/null @@ -1,4 +0,0 @@ -interop_classmanifests_arenot_concretetypetags.scala:5: error: No ConcreteTypeTag available for T - println(implicitly[ConcreteTypeTag[T]]) - ^ -one error found diff --git a/test/files/neg/interop_classmanifests_arenot_concretetypetags.scala b/test/files/neg/interop_classmanifests_arenot_concretetypetags.scala deleted file mode 100644 index f130f162cd..0000000000 --- a/test/files/neg/interop_classmanifests_arenot_concretetypetags.scala +++ /dev/null @@ -1,11 +0,0 @@ -import scala.reflect.runtime.universe._ - -object Test extends App { - def classManifestIsnotConcreteTypeTag[T: ClassManifest] = { - println(implicitly[ConcreteTypeTag[T]]) - } - - classManifestIsnotConcreteTypeTag[Int] - classManifestIsnotConcreteTypeTag[String] - classManifestIsnotConcreteTypeTag[Array[Int]] -} \ No newline at end of file diff --git a/test/files/neg/interop_classmanifests_arenot_typetags.check b/test/files/neg/interop_classmanifests_arenot_typetags.check new file mode 100644 index 0000000000..6675fd9eae --- /dev/null +++ b/test/files/neg/interop_classmanifests_arenot_typetags.check @@ -0,0 +1,4 @@ +interop_classmanifests_arenot_typetags.scala:5: error: No TypeTag available for T + println(implicitly[TypeTag[T]]) + ^ +one error found diff --git a/test/files/neg/interop_classmanifests_arenot_typetags.scala b/test/files/neg/interop_classmanifests_arenot_typetags.scala new file mode 100644 index 0000000000..29d03a8ec8 --- /dev/null +++ b/test/files/neg/interop_classmanifests_arenot_typetags.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + def classManifestIsnotTypeTag[T: ClassManifest] = { + println(implicitly[TypeTag[T]]) + } + + classManifestIsnotTypeTag[Int] + classManifestIsnotTypeTag[String] + classManifestIsnotTypeTag[Array[Int]] +} \ No newline at end of file diff --git a/test/files/neg/interop_concretetypetags_arenot_classmanifests.check b/test/files/neg/interop_concretetypetags_arenot_classmanifests.check deleted file mode 100644 index e2dacad6c2..0000000000 --- a/test/files/neg/interop_concretetypetags_arenot_classmanifests.check +++ /dev/null @@ -1,4 +0,0 @@ -interop_concretetypetags_arenot_classmanifests.scala:5: error: could not find implicit value for parameter m: ClassManifest[T] - println(classManifest[T]) - ^ -one error found diff --git a/test/files/neg/interop_concretetypetags_arenot_classmanifests.scala b/test/files/neg/interop_concretetypetags_arenot_classmanifests.scala deleted file mode 100644 index 70c87a78a6..0000000000 --- a/test/files/neg/interop_concretetypetags_arenot_classmanifests.scala +++ /dev/null @@ -1,11 +0,0 @@ -import scala.reflect.runtime.universe._ - -object Test extends App { - def concreteTypeTagIsnotClassManifest[T: ConcreteTypeTag] = { - println(classManifest[T]) - } - - concreteTypeTagIsnotClassManifest[Int] - concreteTypeTagIsnotClassManifest[String] - concreteTypeTagIsnotClassManifest[Array[Int]] -} \ No newline at end of file diff --git a/test/files/neg/interop_concretetypetags_arenot_classtags.check b/test/files/neg/interop_concretetypetags_arenot_classtags.check deleted file mode 100644 index 7a7d3bcef5..0000000000 --- a/test/files/neg/interop_concretetypetags_arenot_classtags.check +++ /dev/null @@ -1,4 +0,0 @@ -interop_concretetypetags_arenot_classtags.scala:6: error: No ClassTag available for T - println(classTag[T]) - ^ -one error found diff --git a/test/files/neg/interop_concretetypetags_arenot_classtags.scala b/test/files/neg/interop_concretetypetags_arenot_classtags.scala deleted file mode 100644 index 74e51e8a7a..0000000000 --- a/test/files/neg/interop_concretetypetags_arenot_classtags.scala +++ /dev/null @@ -1,12 +0,0 @@ -import scala.reflect.runtime.universe._ -import scala.reflect.{ClassTag, classTag} - -object Test extends App { - def concreteTypeTagIsnotClassTag[T: ConcreteTypeTag] = { - println(classTag[T]) - } - - concreteTypeTagIsnotClassTag[Int] - concreteTypeTagIsnotClassTag[String] - concreteTypeTagIsnotClassTag[Array[Int]] -} \ No newline at end of file diff --git a/test/files/neg/interop_concretetypetags_without_classtags_arenot_manifests.check b/test/files/neg/interop_concretetypetags_without_classtags_arenot_manifests.check deleted file mode 100644 index fc550abb4d..0000000000 --- a/test/files/neg/interop_concretetypetags_without_classtags_arenot_manifests.check +++ /dev/null @@ -1,6 +0,0 @@ -interop_concretetypetags_without_classtags_arenot_manifests.scala:6: error: to create a manifest here, it is necessary to interoperate with the type tag `evidence$1` in scope. -however typetag -> manifest conversion requires a class tag for the corresponding type to be present. -to proceed add a class tag to the type `T` (e.g. by introducing a context bound) and recompile. - println(manifest[T]) - ^ -one error found diff --git a/test/files/neg/interop_concretetypetags_without_classtags_arenot_manifests.scala b/test/files/neg/interop_concretetypetags_without_classtags_arenot_manifests.scala deleted file mode 100644 index b9db4ac121..0000000000 --- a/test/files/neg/interop_concretetypetags_without_classtags_arenot_manifests.scala +++ /dev/null @@ -1,12 +0,0 @@ -import scala.reflect.runtime.universe._ -import scala.reflect.ClassTag - -object Test extends App { - def concreteTypeTagIsManifest[T: ConcreteTypeTag] = { - println(manifest[T]) - } - - concreteTypeTagIsManifest[Int] - concreteTypeTagIsManifest[String] - concreteTypeTagIsManifest[Array[Int]] -} \ No newline at end of file diff --git a/test/files/neg/interop_typetags_arenot_manifests.check b/test/files/neg/interop_typetags_arenot_manifests.check deleted file mode 100644 index e5a7adf340..0000000000 --- a/test/files/neg/interop_typetags_arenot_manifests.check +++ /dev/null @@ -1,4 +0,0 @@ -interop_typetags_arenot_manifests.scala:5: error: No Manifest available for T. - println(manifest[T]) - ^ -one error found diff --git a/test/files/neg/interop_typetags_arenot_manifests.scala b/test/files/neg/interop_typetags_arenot_manifests.scala deleted file mode 100644 index 7ed1f3857b..0000000000 --- a/test/files/neg/interop_typetags_arenot_manifests.scala +++ /dev/null @@ -1,11 +0,0 @@ -import scala.reflect.runtime.universe._ - -object Test extends App { - def typeTagIsnotManifest[T: TypeTag] = { - println(manifest[T]) - } - - typeTagIsnotManifest[Int] - typeTagIsnotManifest[String] - typeTagIsnotManifest[Array[Int]] -} \ No newline at end of file diff --git a/test/files/neg/interop_typetags_without_classtags_arenot_manifests.check b/test/files/neg/interop_typetags_without_classtags_arenot_manifests.check new file mode 100644 index 0000000000..a95f1ad308 --- /dev/null +++ b/test/files/neg/interop_typetags_without_classtags_arenot_manifests.check @@ -0,0 +1,6 @@ +interop_typetags_without_classtags_arenot_manifests.scala:6: error: to create a manifest here, it is necessary to interoperate with the type tag `evidence$1` in scope. +however typetag -> manifest conversion requires a class tag for the corresponding type to be present. +to proceed add a class tag to the type `T` (e.g. by introducing a context bound) and recompile. + println(manifest[T]) + ^ +one error found diff --git a/test/files/neg/interop_typetags_without_classtags_arenot_manifests.scala b/test/files/neg/interop_typetags_without_classtags_arenot_manifests.scala new file mode 100644 index 0000000000..0d48ae5cd0 --- /dev/null +++ b/test/files/neg/interop_typetags_without_classtags_arenot_manifests.scala @@ -0,0 +1,12 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.ClassTag + +object Test extends App { + def typeTagWithoutClassTagIsnotManifest[T: TypeTag] = { + println(manifest[T]) + } + + typeTagWithoutClassTagIsnotManifest[Int] + typeTagWithoutClassTagIsnotManifest[String] + typeTagWithoutClassTagIsnotManifest[Array[Int]] +} \ No newline at end of file diff --git a/test/files/neg/macro-reify-groundtypetag-hktypeparams-notags.check b/test/files/neg/macro-reify-groundtypetag-hktypeparams-notags.check deleted file mode 100644 index 39e90f827e..0000000000 --- a/test/files/neg/macro-reify-groundtypetag-hktypeparams-notags.check +++ /dev/null @@ -1,7 +0,0 @@ -Test.scala:5: error: No ConcreteTypeTag available for C[T] - println(implicitly[ConcreteTypeTag[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 deleted file mode 100644 index c0c9156b60..0000000000 --- a/test/files/neg/macro-reify-groundtypetag-hktypeparams-notags/Test.scala +++ /dev/null @@ -1,9 +0,0 @@ -import scala.reflect.runtime.universe._ - -object Test extends App { - def fooNoTypeTagHK[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 deleted file mode 100644 index 164ca3543f..0000000000 --- a/test/files/neg/macro-reify-groundtypetag-typeparams-notags.check +++ /dev/null @@ -1,7 +0,0 @@ -Test.scala:5: error: No ConcreteTypeTag available for T - println(implicitly[ConcreteTypeTag[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 deleted file mode 100644 index a247c3fe7b..0000000000 --- a/test/files/neg/macro-reify-groundtypetag-typeparams-notags/Test.scala +++ /dev/null @@ -1,9 +0,0 @@ -import scala.reflect.runtime.universe._ - -object Test extends App { - def fooNoTypeTag[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 deleted file mode 100644 index 164ca3543f..0000000000 --- a/test/files/neg/macro-reify-groundtypetag-usetypetag.check +++ /dev/null @@ -1,7 +0,0 @@ -Test.scala:5: error: No ConcreteTypeTag available for T - println(implicitly[ConcreteTypeTag[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 deleted file mode 100644 index 52b5c1078d..0000000000 --- a/test/files/neg/macro-reify-groundtypetag-usetypetag/Test.scala +++ /dev/null @@ -1,9 +0,0 @@ -import scala.reflect.runtime.universe._ - -object Test extends App { - def fooTypeTag[T: TypeTag] = { - println(implicitly[ConcreteTypeTag[T]]) - println(implicitly[ConcreteTypeTag[List[T]]]) - } - fooTypeTag[Int] -} \ No newline at end of file diff --git a/test/files/neg/macro-reify-typetag-hktypeparams-notags.check b/test/files/neg/macro-reify-typetag-hktypeparams-notags.check new file mode 100644 index 0000000000..742d87b0a4 --- /dev/null +++ b/test/files/neg/macro-reify-typetag-hktypeparams-notags.check @@ -0,0 +1,7 @@ +Test.scala:5: error: No TypeTag available for C[T] + println(implicitly[TypeTag[C[T]]]) + ^ +Test.scala:6: error: No TypeTag available for List[C[T]] + println(implicitly[TypeTag[List[C[T]]]]) + ^ +two errors found diff --git a/test/files/neg/macro-reify-typetag-hktypeparams-notags/Test.scala b/test/files/neg/macro-reify-typetag-hktypeparams-notags/Test.scala new file mode 100644 index 0000000000..c7b1cedcd2 --- /dev/null +++ b/test/files/neg/macro-reify-typetag-hktypeparams-notags/Test.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + def fooNoTypeTagHK[C[_], T] = { + println(implicitly[TypeTag[C[T]]]) + println(implicitly[TypeTag[List[C[T]]]]) + } + fooNoTypeTagHK[List, Int] +} \ No newline at end of file diff --git a/test/files/neg/macro-reify-typetag-typeparams-notags.check b/test/files/neg/macro-reify-typetag-typeparams-notags.check new file mode 100644 index 0000000000..db88260047 --- /dev/null +++ b/test/files/neg/macro-reify-typetag-typeparams-notags.check @@ -0,0 +1,7 @@ +Test.scala:5: error: No TypeTag available for T + println(implicitly[TypeTag[T]]) + ^ +Test.scala:6: error: No TypeTag available for List[T] + println(implicitly[TypeTag[List[T]]]) + ^ +two errors found diff --git a/test/files/neg/macro-reify-typetag-typeparams-notags/Test.scala b/test/files/neg/macro-reify-typetag-typeparams-notags/Test.scala new file mode 100644 index 0000000000..6d849cde3f --- /dev/null +++ b/test/files/neg/macro-reify-typetag-typeparams-notags/Test.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + def fooNoTypeTag[T] = { + println(implicitly[TypeTag[T]]) + println(implicitly[TypeTag[List[T]]]) + } + fooNoTypeTag[Int] +} \ No newline at end of file diff --git a/test/files/neg/macro-reify-typetag-useabstypetag.check b/test/files/neg/macro-reify-typetag-useabstypetag.check new file mode 100644 index 0000000000..db88260047 --- /dev/null +++ b/test/files/neg/macro-reify-typetag-useabstypetag.check @@ -0,0 +1,7 @@ +Test.scala:5: error: No TypeTag available for T + println(implicitly[TypeTag[T]]) + ^ +Test.scala:6: error: No TypeTag available for List[T] + println(implicitly[TypeTag[List[T]]]) + ^ +two errors found diff --git a/test/files/neg/macro-reify-typetag-useabstypetag/Test.scala b/test/files/neg/macro-reify-typetag-useabstypetag/Test.scala new file mode 100644 index 0000000000..b66ad6c523 --- /dev/null +++ b/test/files/neg/macro-reify-typetag-useabstypetag/Test.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + def fooTypeTag[T: AbsTypeTag] = { + println(implicitly[TypeTag[T]]) + println(implicitly[TypeTag[List[T]]]) + } + fooTypeTag[Int] +} \ No newline at end of file diff --git a/test/files/neg/t3692-old.check b/test/files/neg/t3692-old.check index 9da7033239..a97a7d31ec 100644 --- a/test/files/neg/t3692-old.check +++ b/test/files/neg/t3692-old.check @@ -1,4 +1,4 @@ -t3692-old.scala:6: warning: object Manifest in package reflect is deprecated: Use `@scala.reflect.ConcreteTypeTag` instead +t3692-old.scala:6: warning: object Manifest in package reflect is deprecated: Use TypeTag instead new ManifestTester().toJavaMap(map) ^ t3692-old.scala:15: error: unreachable code diff --git a/test/files/pos/implicits-new.scala b/test/files/pos/implicits-new.scala index b46ed36082..ffc387132a 100644 --- a/test/files/pos/implicits-new.scala +++ b/test/files/pos/implicits-new.scala @@ -88,5 +88,5 @@ package foo2709 { // Problem with specs object specsProblem { - println(implicitly[ConcreteTypeTag[Class[_]]]) + println(implicitly[TypeTag[Class[_]]]) } \ No newline at end of file diff --git a/test/files/run/abstypetags_core.check b/test/files/run/abstypetags_core.check new file mode 100644 index 0000000000..55c8cb7e89 --- /dev/null +++ b/test/files/run/abstypetags_core.check @@ -0,0 +1,28 @@ +true +TypeTag[Byte] +true +TypeTag[Short] +true +TypeTag[Char] +true +TypeTag[Int] +true +TypeTag[Long] +true +TypeTag[Float] +true +TypeTag[Double] +true +TypeTag[Boolean] +true +TypeTag[Unit] +true +TypeTag[Any] +true +TypeTag[java.lang.Object] +true +TypeTag[Null] +true +TypeTag[Nothing] +true +TypeTag[java.lang.String] diff --git a/test/files/run/abstypetags_core.scala b/test/files/run/abstypetags_core.scala new file mode 100644 index 0000000000..a49817f4d4 --- /dev/null +++ b/test/files/run/abstypetags_core.scala @@ -0,0 +1,32 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + println(implicitly[AbsTypeTag[Byte]] eq AbsTypeTag.Byte) + println(implicitly[AbsTypeTag[Byte]]) + println(implicitly[AbsTypeTag[Short]] eq AbsTypeTag.Short) + println(implicitly[AbsTypeTag[Short]]) + println(implicitly[AbsTypeTag[Char]] eq AbsTypeTag.Char) + println(implicitly[AbsTypeTag[Char]]) + println(implicitly[AbsTypeTag[Int]] eq AbsTypeTag.Int) + println(implicitly[AbsTypeTag[Int]]) + println(implicitly[AbsTypeTag[Long]] eq AbsTypeTag.Long) + println(implicitly[AbsTypeTag[Long]]) + println(implicitly[AbsTypeTag[Float]] eq AbsTypeTag.Float) + println(implicitly[AbsTypeTag[Float]]) + println(implicitly[AbsTypeTag[Double]] eq AbsTypeTag.Double) + println(implicitly[AbsTypeTag[Double]]) + println(implicitly[AbsTypeTag[Boolean]] eq AbsTypeTag.Boolean) + println(implicitly[AbsTypeTag[Boolean]]) + println(implicitly[AbsTypeTag[Unit]] eq AbsTypeTag.Unit) + println(implicitly[AbsTypeTag[Unit]]) + println(implicitly[AbsTypeTag[Any]] eq AbsTypeTag.Any) + println(implicitly[AbsTypeTag[Any]]) + println(implicitly[AbsTypeTag[Object]] eq AbsTypeTag.Object) + println(implicitly[AbsTypeTag[Object]]) + println(implicitly[AbsTypeTag[Null]] eq AbsTypeTag.Null) + println(implicitly[AbsTypeTag[Null]]) + println(implicitly[AbsTypeTag[Nothing]] eq AbsTypeTag.Nothing) + println(implicitly[AbsTypeTag[Nothing]]) + println(implicitly[AbsTypeTag[String]] eq AbsTypeTag.String) + println(implicitly[AbsTypeTag[String]]) +} \ No newline at end of file diff --git a/test/files/run/concretetypetags_core.check b/test/files/run/concretetypetags_core.check index e5308bf9c7..d042e0900d 100644 --- a/test/files/run/concretetypetags_core.check +++ b/test/files/run/concretetypetags_core.check @@ -1,28 +1,28 @@ true -ConcreteTypeTag[Byte] +TypeTag[Byte] true -ConcreteTypeTag[Short] +TypeTag[Short] true -ConcreteTypeTag[Char] +TypeTag[Char] true -ConcreteTypeTag[Int] +TypeTag[Int] true -ConcreteTypeTag[Long] +TypeTag[Long] true -ConcreteTypeTag[Float] +TypeTag[Float] true -ConcreteTypeTag[Double] +TypeTag[Double] true -ConcreteTypeTag[Boolean] +TypeTag[Boolean] true -ConcreteTypeTag[Unit] +TypeTag[Unit] true -ConcreteTypeTag[Any] +TypeTag[Any] true -ConcreteTypeTag[java.lang.Object] +TypeTag[java.lang.Object] true -ConcreteTypeTag[Null] +TypeTag[Null] true -ConcreteTypeTag[Nothing] +TypeTag[Nothing] true -ConcreteTypeTag[java.lang.String] +TypeTag[java.lang.String] diff --git a/test/files/run/concretetypetags_core.scala b/test/files/run/concretetypetags_core.scala index ea7060ec6c..a870f77c5f 100644 --- a/test/files/run/concretetypetags_core.scala +++ b/test/files/run/concretetypetags_core.scala @@ -1,32 +1,32 @@ import scala.reflect.runtime.universe._ object Test extends App { - 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[Null]] eq ConcreteTypeTag.Null) - println(implicitly[ConcreteTypeTag[Null]]) - println(implicitly[ConcreteTypeTag[Nothing]] eq ConcreteTypeTag.Nothing) - println(implicitly[ConcreteTypeTag[Nothing]]) - println(implicitly[ConcreteTypeTag[String]] eq ConcreteTypeTag.String) - println(implicitly[ConcreteTypeTag[String]]) + println(implicitly[TypeTag[Byte]] eq TypeTag.Byte) + println(implicitly[TypeTag[Byte]]) + println(implicitly[TypeTag[Short]] eq TypeTag.Short) + println(implicitly[TypeTag[Short]]) + println(implicitly[TypeTag[Char]] eq TypeTag.Char) + println(implicitly[TypeTag[Char]]) + println(implicitly[TypeTag[Int]] eq TypeTag.Int) + println(implicitly[TypeTag[Int]]) + println(implicitly[TypeTag[Long]] eq TypeTag.Long) + println(implicitly[TypeTag[Long]]) + println(implicitly[TypeTag[Float]] eq TypeTag.Float) + println(implicitly[TypeTag[Float]]) + println(implicitly[TypeTag[Double]] eq TypeTag.Double) + println(implicitly[TypeTag[Double]]) + println(implicitly[TypeTag[Boolean]] eq TypeTag.Boolean) + println(implicitly[TypeTag[Boolean]]) + println(implicitly[TypeTag[Unit]] eq TypeTag.Unit) + println(implicitly[TypeTag[Unit]]) + println(implicitly[TypeTag[Any]] eq TypeTag.Any) + println(implicitly[TypeTag[Any]]) + println(implicitly[TypeTag[Object]] eq TypeTag.Object) + println(implicitly[TypeTag[Object]]) + println(implicitly[TypeTag[Null]] eq TypeTag.Null) + println(implicitly[TypeTag[Null]]) + println(implicitly[TypeTag[Nothing]] eq TypeTag.Nothing) + println(implicitly[TypeTag[Nothing]]) + println(implicitly[TypeTag[String]] eq TypeTag.String) + println(implicitly[TypeTag[String]]) } \ No newline at end of file diff --git a/test/files/run/concretetypetags_multi.check b/test/files/run/concretetypetags_multi.check index 613106985c..6110252c36 100644 --- a/test/files/run/concretetypetags_multi.check +++ b/test/files/run/concretetypetags_multi.check @@ -1,5 +1,5 @@ -ConcreteTypeTag[Int] -ConcreteTypeTag[Array[Int]] -ConcreteTypeTag[Array[Array[Int]]] -ConcreteTypeTag[Array[Array[Array[Int]]]] -ConcreteTypeTag[Array[Array[Array[Array[Int]]]]] +TypeTag[Int] +TypeTag[Array[Int]] +TypeTag[Array[Array[Int]]] +TypeTag[Array[Array[Array[Int]]]] +TypeTag[Array[Array[Array[Array[Int]]]]] diff --git a/test/files/run/concretetypetags_multi.scala b/test/files/run/concretetypetags_multi.scala index 0b5d648877..b30aac80a6 100644 --- a/test/files/run/concretetypetags_multi.scala +++ b/test/files/run/concretetypetags_multi.scala @@ -1,9 +1,9 @@ import scala.reflect.runtime.universe._ object Test extends App { - println(implicitly[ConcreteTypeTag[Int]]) - println(implicitly[ConcreteTypeTag[Array[Int]]]) - println(implicitly[ConcreteTypeTag[Array[Array[Int]]]]) - println(implicitly[ConcreteTypeTag[Array[Array[Array[Int]]]]]) - println(implicitly[ConcreteTypeTag[Array[Array[Array[Array[Int]]]]]]) + println(implicitly[TypeTag[Int]]) + println(implicitly[TypeTag[Array[Int]]]) + println(implicitly[TypeTag[Array[Array[Int]]]]) + println(implicitly[TypeTag[Array[Array[Array[Int]]]]]) + println(implicitly[TypeTag[Array[Array[Array[Array[Int]]]]]]) } \ No newline at end of file diff --git a/test/files/run/existentials3-new.scala b/test/files/run/existentials3-new.scala index 5e1490b778..649fac8327 100644 --- a/test/files/run/existentials3-new.scala +++ b/test/files/run/existentials3-new.scala @@ -37,8 +37,8 @@ object Test { val s = if (t.typeSymbol.isFreeType) t.typeSymbol.typeSignature.toString else t.typeSymbol.toString println("%s, t=%s, s=%s".format(t, t.kind, s)) } - def m[T: ConcreteTypeTag](x: T) = printTpe(typeOf[T]) - def m2[T: TypeTag](x: T) = printTpe(typeOf[T]) + def m[T: TypeTag](x: T) = printTpe(typeOf[T]) + def m2[T: AbsTypeTag](x: T) = printTpe(implicitly[AbsTypeTag[T]].tpe) // tags do work for f10/g10 def main(args: Array[String]): Unit = { diff --git a/test/files/run/interop_classmanifests_arenot_typetags.check b/test/files/run/interop_classmanifests_arenot_typetags.check deleted file mode 100644 index d67491ed75..0000000000 --- a/test/files/run/interop_classmanifests_arenot_typetags.check +++ /dev/null @@ -1,3 +0,0 @@ -T -T -T diff --git a/test/files/run/interop_classmanifests_arenot_typetags.scala b/test/files/run/interop_classmanifests_arenot_typetags.scala deleted file mode 100644 index d65a5124d7..0000000000 --- a/test/files/run/interop_classmanifests_arenot_typetags.scala +++ /dev/null @@ -1,11 +0,0 @@ -import scala.reflect.runtime.universe._ - -object Test extends App { - def classManifestIsnotTypeTag[T: ClassManifest] = { - println(typeOf[T]) - } - - classManifestIsnotTypeTag[Int] - classManifestIsnotTypeTag[String] - classManifestIsnotTypeTag[Array[Int]] -} \ No newline at end of file diff --git a/test/files/run/interop_concretetypetags_are_manifests.check b/test/files/run/interop_concretetypetags_are_manifests.check deleted file mode 100644 index 871167e3ab..0000000000 --- a/test/files/run/interop_concretetypetags_are_manifests.check +++ /dev/null @@ -1,3 +0,0 @@ -int -java.lang.String -Array[Int] diff --git a/test/files/run/interop_concretetypetags_are_manifests.scala b/test/files/run/interop_concretetypetags_are_manifests.scala deleted file mode 100644 index 84647a3a5a..0000000000 --- a/test/files/run/interop_concretetypetags_are_manifests.scala +++ /dev/null @@ -1,12 +0,0 @@ -import scala.reflect.runtime.universe._ -import scala.reflect.ClassTag - -object Test extends App { - def concreteTypeTagIsManifest[T: ConcreteTypeTag : ClassTag] = { - println(manifest[T]) - } - - concreteTypeTagIsManifest[Int] - concreteTypeTagIsManifest[String] - concreteTypeTagIsManifest[Array[Int]] -} \ No newline at end of file diff --git a/test/files/run/interop_manifests_are_abstypetags.check b/test/files/run/interop_manifests_are_abstypetags.check new file mode 100644 index 0000000000..c59e92d4eb --- /dev/null +++ b/test/files/run/interop_manifests_are_abstypetags.check @@ -0,0 +1,3 @@ +Int +java.lang.String +Array[Int] diff --git a/test/files/run/interop_manifests_are_abstypetags.scala b/test/files/run/interop_manifests_are_abstypetags.scala new file mode 100644 index 0000000000..1cba2fdb4b --- /dev/null +++ b/test/files/run/interop_manifests_are_abstypetags.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + def manifestIsAbsTypeTag[T: Manifest] = { + println(implicitly[AbsTypeTag[T]].tpe) + } + + manifestIsAbsTypeTag[Int] + manifestIsAbsTypeTag[String] + manifestIsAbsTypeTag[Array[Int]] +} \ No newline at end of file diff --git a/test/files/run/interop_manifests_are_concretetypetags.check b/test/files/run/interop_manifests_are_concretetypetags.check deleted file mode 100644 index c59e92d4eb..0000000000 --- a/test/files/run/interop_manifests_are_concretetypetags.check +++ /dev/null @@ -1,3 +0,0 @@ -Int -java.lang.String -Array[Int] diff --git a/test/files/run/interop_manifests_are_concretetypetags.scala b/test/files/run/interop_manifests_are_concretetypetags.scala deleted file mode 100644 index 85ad748173..0000000000 --- a/test/files/run/interop_manifests_are_concretetypetags.scala +++ /dev/null @@ -1,11 +0,0 @@ -import scala.reflect.runtime.universe._ - -object Test extends App { - def manifestIsConcreteTypeTag[T: Manifest] = { - println(implicitly[ConcreteTypeTag[T]].tpe) - } - - manifestIsConcreteTypeTag[Int] - manifestIsConcreteTypeTag[String] - manifestIsConcreteTypeTag[Array[Int]] -} \ No newline at end of file diff --git a/test/files/run/interop_typetags_are_manifests.check b/test/files/run/interop_typetags_are_manifests.check new file mode 100644 index 0000000000..871167e3ab --- /dev/null +++ b/test/files/run/interop_typetags_are_manifests.check @@ -0,0 +1,3 @@ +int +java.lang.String +Array[Int] diff --git a/test/files/run/interop_typetags_are_manifests.scala b/test/files/run/interop_typetags_are_manifests.scala new file mode 100644 index 0000000000..1aca7f52cc --- /dev/null +++ b/test/files/run/interop_typetags_are_manifests.scala @@ -0,0 +1,12 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.ClassTag + +object Test extends App { + def typeTagIsManifest[T: TypeTag : ClassTag] = { + println(manifest[T]) + } + + typeTagIsManifest[Int] + typeTagIsManifest[String] + typeTagIsManifest[Array[Int]] +} \ 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 6dfe04af12..0895c30c3f 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 ConcreteTypeTag[Int] -it works ConcreteTypeTag[Int] -it works ConcreteTypeTag[Int] -it works ConcreteTypeTag[Int] -it works ConcreteTypeTag[Int] +it works TypeTag[Int] +it works TypeTag[Int] +it works TypeTag[Int] +it works TypeTag[Int] +it works TypeTag[Int] kkthxbai diff --git a/test/files/run/macro-expand-tparams-explicit.check b/test/files/run/macro-expand-tparams-explicit.check index 5670e27c4e..19e6d39bc8 100644 --- a/test/files/run/macro-expand-tparams-explicit.check +++ b/test/files/run/macro-expand-tparams-explicit.check @@ -1 +1 @@ -ConcreteTypeTag[Int] +TypeTag[Int] diff --git a/test/files/run/macro-expand-tparams-implicit.check b/test/files/run/macro-expand-tparams-implicit.check index e57fc1217b..80c6b826ba 100644 --- a/test/files/run/macro-expand-tparams-implicit.check +++ b/test/files/run/macro-expand-tparams-implicit.check @@ -1,2 +1,2 @@ -ConcreteTypeTag[Int] -ConcreteTypeTag[String] +TypeTag[Int] +TypeTag[String] diff --git a/test/files/run/macro-expand-tparams-prefix-a.check b/test/files/run/macro-expand-tparams-prefix-a.check index 922be1a6dd..6c23b47d64 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 @@ -ConcreteTypeTag[Int] -ConcreteTypeTag[Int] -ConcreteTypeTag[String] -ConcreteTypeTag[Boolean] +TypeTag[Int] +TypeTag[Int] +TypeTag[String] +TypeTag[Boolean] diff --git a/test/files/run/macro-expand-tparams-prefix-b.check b/test/files/run/macro-expand-tparams-prefix-b.check index a336bb51ec..67dabff11e 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 @@ -ConcreteTypeTag[Boolean] ConcreteTypeTag[Int] -ConcreteTypeTag[Boolean] ConcreteTypeTag[String] +TypeTag[Boolean] TypeTag[Int] +TypeTag[Boolean] TypeTag[String] diff --git a/test/files/run/macro-expand-tparams-prefix-c1.check b/test/files/run/macro-expand-tparams-prefix-c1.check index 87f295aa49..8d1c4e3416 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 @@ -ConcreteTypeTag[Int] -ConcreteTypeTag[String] -ConcreteTypeTag[Boolean] +TypeTag[Int] +TypeTag[String] +TypeTag[Boolean] diff --git a/test/files/run/macro-expand-tparams-prefix-c2.check b/test/files/run/macro-expand-tparams-prefix-c2.check index 87f295aa49..8d1c4e3416 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 @@ -ConcreteTypeTag[Int] -ConcreteTypeTag[String] -ConcreteTypeTag[Boolean] +TypeTag[Int] +TypeTag[String] +TypeTag[Boolean] diff --git a/test/files/run/macro-expand-tparams-prefix-d1.check b/test/files/run/macro-expand-tparams-prefix-d1.check index ca7a220475..319edfbed0 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] -ConcreteTypeTag[Boolean] +AbsTypeTag[T] +AbsTypeTag[U] +TypeTag[Boolean] diff --git a/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala index a834d809da..f497e5f7a9 100644 --- a/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala @@ -2,11 +2,11 @@ import scala.reflect.runtime.universe._ import scala.reflect.makro.{Context => Ctx} object Impls { - def foo[T, U: c.TypeTag, V](c: Ctx)(implicit T: c.TypeTag[T], V: c.TypeTag[V]): c.Expr[Unit] = { + def foo[T, U: c.AbsTypeTag, V](c: Ctx)(implicit T: c.AbsTypeTag[T], V: c.AbsTypeTag[V]): c.Expr[Unit] = { import c.universe._ c.Expr(Block(List( Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.TypeTag[U]].toString)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.AbsTypeTag[U]].toString)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))), Literal(Constant(())))) } diff --git a/test/files/run/macro-reify-abstypetag-notypeparams.check b/test/files/run/macro-reify-abstypetag-notypeparams.check new file mode 100644 index 0000000000..aadd713bef --- /dev/null +++ b/test/files/run/macro-reify-abstypetag-notypeparams.check @@ -0,0 +1,2 @@ +TypeTag[Int] +TypeTag[List[Int]] diff --git a/test/files/run/macro-reify-abstypetag-notypeparams/Test.scala b/test/files/run/macro-reify-abstypetag-notypeparams/Test.scala new file mode 100644 index 0000000000..34f742b9fb --- /dev/null +++ b/test/files/run/macro-reify-abstypetag-notypeparams/Test.scala @@ -0,0 +1,6 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + println(implicitly[AbsTypeTag[Int]]) + println(implicitly[AbsTypeTag[List[Int]]]) +} \ No newline at end of file diff --git a/test/files/run/macro-reify-abstypetag-typeparams-notags.check b/test/files/run/macro-reify-abstypetag-typeparams-notags.check new file mode 100644 index 0000000000..be62b59a69 --- /dev/null +++ b/test/files/run/macro-reify-abstypetag-typeparams-notags.check @@ -0,0 +1,2 @@ +AbsTypeTag[T] +AbsTypeTag[List[T]] diff --git a/test/files/run/macro-reify-abstypetag-typeparams-notags/Test.scala b/test/files/run/macro-reify-abstypetag-typeparams-notags/Test.scala new file mode 100644 index 0000000000..0b42cc07b5 --- /dev/null +++ b/test/files/run/macro-reify-abstypetag-typeparams-notags/Test.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + def fooNoTypeTag[T] = { + println(implicitly[AbsTypeTag[T]]) + println(implicitly[AbsTypeTag[List[T]]]) + } + fooNoTypeTag[Int] +} \ No newline at end of file diff --git a/test/files/run/macro-reify-abstypetag-typeparams-tags.check b/test/files/run/macro-reify-abstypetag-typeparams-tags.check new file mode 100644 index 0000000000..d6ca5a85ef --- /dev/null +++ b/test/files/run/macro-reify-abstypetag-typeparams-tags.check @@ -0,0 +1,2 @@ +TypeTag[Int] +AbsTypeTag[List[Int]] diff --git a/test/files/run/macro-reify-abstypetag-typeparams-tags/Test.scala b/test/files/run/macro-reify-abstypetag-typeparams-tags/Test.scala new file mode 100644 index 0000000000..82a7b7971d --- /dev/null +++ b/test/files/run/macro-reify-abstypetag-typeparams-tags/Test.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + def fooTypeTag[T: AbsTypeTag] = { + println(implicitly[AbsTypeTag[T]]) + println(implicitly[AbsTypeTag[List[T]]]) + } + fooTypeTag[Int] +} \ No newline at end of file diff --git a/test/files/run/macro-reify-abstypetag-usetypetag.check b/test/files/run/macro-reify-abstypetag-usetypetag.check new file mode 100644 index 0000000000..d6ca5a85ef --- /dev/null +++ b/test/files/run/macro-reify-abstypetag-usetypetag.check @@ -0,0 +1,2 @@ +TypeTag[Int] +AbsTypeTag[List[Int]] diff --git a/test/files/run/macro-reify-abstypetag-usetypetag/Test.scala b/test/files/run/macro-reify-abstypetag-usetypetag/Test.scala new file mode 100644 index 0000000000..3c62725c42 --- /dev/null +++ b/test/files/run/macro-reify-abstypetag-usetypetag/Test.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + def fooTypeTag[T: TypeTag] = { + println(implicitly[AbsTypeTag[T]]) + println(implicitly[AbsTypeTag[List[T]]]) + } + fooTypeTag[Int] +} \ No newline at end of file diff --git a/test/files/run/macro-reify-groundtypetag-notypeparams.check b/test/files/run/macro-reify-groundtypetag-notypeparams.check deleted file mode 100644 index d75b3c72b2..0000000000 --- a/test/files/run/macro-reify-groundtypetag-notypeparams.check +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 2bead07dd9..0000000000 --- a/test/files/run/macro-reify-groundtypetag-notypeparams/Test.scala +++ /dev/null @@ -1,6 +0,0 @@ -import scala.reflect.runtime.universe._ - -object Test extends App { - 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 deleted file mode 100644 index d75b3c72b2..0000000000 --- a/test/files/run/macro-reify-groundtypetag-typeparams-tags.check +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 245bbe98e1..0000000000 --- a/test/files/run/macro-reify-groundtypetag-typeparams-tags/Test.scala +++ /dev/null @@ -1,9 +0,0 @@ -import scala.reflect.runtime.universe._ - -object Test extends App { - 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 d75b3c72b2..aadd713bef 100644 --- a/test/files/run/macro-reify-typetag-notypeparams.check +++ b/test/files/run/macro-reify-typetag-notypeparams.check @@ -1,2 +1,2 @@ -ConcreteTypeTag[Int] -ConcreteTypeTag[List[Int]] +TypeTag[Int] +TypeTag[List[Int]] diff --git a/test/files/run/macro-reify-typetag-typeparams-notags.check b/test/files/run/macro-reify-typetag-typeparams-notags.check deleted file mode 100644 index 11d78ece41..0000000000 --- a/test/files/run/macro-reify-typetag-typeparams-notags.check +++ /dev/null @@ -1,2 +0,0 @@ -TypeTag[T] -TypeTag[List[T]] diff --git a/test/files/run/macro-reify-typetag-typeparams-notags/Test.scala b/test/files/run/macro-reify-typetag-typeparams-notags/Test.scala deleted file mode 100644 index 6d849cde3f..0000000000 --- a/test/files/run/macro-reify-typetag-typeparams-notags/Test.scala +++ /dev/null @@ -1,9 +0,0 @@ -import scala.reflect.runtime.universe._ - -object Test extends App { - def fooNoTypeTag[T] = { - println(implicitly[TypeTag[T]]) - println(implicitly[TypeTag[List[T]]]) - } - fooNoTypeTag[Int] -} \ No newline at end of file diff --git a/test/files/run/macro-reify-typetag-typeparams-tags.check b/test/files/run/macro-reify-typetag-typeparams-tags.check index 5fd767d565..aadd713bef 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 @@ -ConcreteTypeTag[Int] +TypeTag[Int] TypeTag[List[Int]] diff --git a/test/files/run/macro-reify-typetag-usegroundtypetag.check b/test/files/run/macro-reify-typetag-usegroundtypetag.check deleted file mode 100644 index 5fd767d565..0000000000 --- a/test/files/run/macro-reify-typetag-usegroundtypetag.check +++ /dev/null @@ -1,2 +0,0 @@ -ConcreteTypeTag[Int] -TypeTag[List[Int]] diff --git a/test/files/run/macro-reify-typetag-usegroundtypetag/Test.scala b/test/files/run/macro-reify-typetag-usegroundtypetag/Test.scala deleted file mode 100644 index 6363c5d472..0000000000 --- a/test/files/run/macro-reify-typetag-usegroundtypetag/Test.scala +++ /dev/null @@ -1,9 +0,0 @@ -import scala.reflect.runtime.universe._ - -object Test extends App { - def fooTypeTag[T: ConcreteTypeTag] = { - println(implicitly[TypeTag[T]]) - println(implicitly[TypeTag[List[T]]]) - } - fooTypeTag[Int] -} \ No newline at end of file diff --git a/test/files/run/macro-undetparams-consfromsls.check b/test/files/run/macro-undetparams-consfromsls.check index 49e9140d5a..4b83c55437 100644 --- a/test/files/run/macro-undetparams-consfromsls.check +++ b/test/files/run/macro-undetparams-consfromsls.check @@ -1,5 +1,5 @@ -A = ConcreteTypeTag[Int] -B = ConcreteTypeTag[Nothing] +A = TypeTag[Int] +B = TypeTag[Nothing] List(1) -A = ConcreteTypeTag[Any] +A = TypeTag[Any] List(abc, 1) diff --git a/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala b/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala index bd3cd3009a..b9bb2cfcca 100644 --- a/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala +++ b/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala @@ -2,13 +2,13 @@ import scala.reflect.runtime.universe._ import scala.reflect.makro.Context object Macros { - def cons_impl[A: c.TypeTag](c: Context)(x: c.Expr[A], xs: c.Expr[List[A]]): c.Expr[List[A]] = c.reify { - println("A = " + c.literal(implicitly[c.TypeTag[A]].toString).splice) + def cons_impl[A: c.AbsTypeTag](c: Context)(x: c.Expr[A], xs: c.Expr[List[A]]): c.Expr[List[A]] = c.reify { + println("A = " + c.literal(implicitly[c.AbsTypeTag[A]].toString).splice) x.splice :: xs.splice } - def nil_impl[B: c.TypeTag](c: Context): c.Expr[List[B]] = c.reify { - println("B = " + c.literal(implicitly[c.TypeTag[B]].toString).splice) + def nil_impl[B: c.AbsTypeTag](c: Context): c.Expr[List[B]] = c.reify { + println("B = " + c.literal(implicitly[c.AbsTypeTag[B]].toString).splice) Nil } diff --git a/test/files/run/macro-undetparams-implicitval.check b/test/files/run/macro-undetparams-implicitval.check index 6c2b601aa5..30681fa40d 100644 --- a/test/files/run/macro-undetparams-implicitval.check +++ b/test/files/run/macro-undetparams-implicitval.check @@ -1 +1 @@ -ConcreteTypeTag[Nothing] +TypeTag[Nothing] diff --git a/test/files/run/macro-undetparams-macroitself.check b/test/files/run/macro-undetparams-macroitself.check index e57fc1217b..80c6b826ba 100644 --- a/test/files/run/macro-undetparams-macroitself.check +++ b/test/files/run/macro-undetparams-macroitself.check @@ -1,2 +1,2 @@ -ConcreteTypeTag[Int] -ConcreteTypeTag[String] +TypeTag[Int] +TypeTag[String] diff --git a/test/files/run/newTags.check b/test/files/run/newTags.check index 3ef7254f87..d83740c40c 100644 --- a/test/files/run/newTags.check +++ b/test/files/run/newTags.check @@ -2,4 +2,4 @@ TypeRef(ThisType(class immutable),class List,List(TypeRef(ThisType(class scala), List[Int] TypeRef(ThisType(class immutable),class Map,List(TypeRef(ThisType(class lang),class String,List()), TypeRef(ThisType(class lang),class String,List()))) scala.collection.immutable.Map[java.lang.String,java.lang.String] -ConcreteTypeTag[TypeRef(ThisType(class immutable),class Map,List(TypeRef(ThisType(class lang),class String,List()), TypeRef(ThisType(class lang),class String,List())))] +TypeTag[TypeRef(ThisType(class immutable),class Map,List(TypeRef(ThisType(class lang),class String,List()), TypeRef(ThisType(class lang),class String,List())))] diff --git a/test/files/run/reify_newimpl_25.check b/test/files/run/reify_newimpl_25.check index 1ba001fb59..a688a98fbc 100644 --- a/test/files/run/reify_newimpl_25.check +++ b/test/files/run/reify_newimpl_25.check @@ -12,7 +12,7 @@ scala> { :11: free term: Ident(newTermName("x")) defined by res0 in :10:21 val tt = implicitly[TypeTag[x.type]] ^ -ConcreteTypeTag[x.type] +TypeTag[x.type] scala> diff --git a/test/files/run/reify_newimpl_26.check b/test/files/run/reify_newimpl_26.check index 1cedc43f74..6c5f124960 100644 --- a/test/files/run/reify_newimpl_26.check +++ b/test/files/run/reify_newimpl_26.check @@ -5,16 +5,16 @@ scala> scala> def foo[T]{ import scala.reflect.runtime.universe._ - val tt = implicitly[TypeTag[List[T]]] + val tt = implicitly[AbsTypeTag[List[T]]] println(tt) } :9: free type: Ident(newTypeName("T")) defined by foo in :7:16 - val tt = implicitly[TypeTag[List[T]]] + val tt = implicitly[AbsTypeTag[List[T]]] ^ foo: [T]=> Unit scala> foo[Int] -TypeTag[List[T]] +AbsTypeTag[List[T]] scala> diff --git a/test/files/run/reify_newimpl_26.scala b/test/files/run/reify_newimpl_26.scala index bb36c91d0e..a12d8a2970 100644 --- a/test/files/run/reify_newimpl_26.scala +++ b/test/files/run/reify_newimpl_26.scala @@ -5,7 +5,7 @@ object Test extends ReplTest { def code = """ def foo[T]{ import scala.reflect.runtime.universe._ - val tt = implicitly[TypeTag[List[T]]] + val tt = implicitly[AbsTypeTag[List[T]]] println(tt) } foo[Int] diff --git a/test/files/run/typetags_core.check b/test/files/run/typetags_core.check deleted file mode 100644 index e5308bf9c7..0000000000 --- a/test/files/run/typetags_core.check +++ /dev/null @@ -1,28 +0,0 @@ -true -ConcreteTypeTag[Byte] -true -ConcreteTypeTag[Short] -true -ConcreteTypeTag[Char] -true -ConcreteTypeTag[Int] -true -ConcreteTypeTag[Long] -true -ConcreteTypeTag[Float] -true -ConcreteTypeTag[Double] -true -ConcreteTypeTag[Boolean] -true -ConcreteTypeTag[Unit] -true -ConcreteTypeTag[Any] -true -ConcreteTypeTag[java.lang.Object] -true -ConcreteTypeTag[Null] -true -ConcreteTypeTag[Nothing] -true -ConcreteTypeTag[java.lang.String] diff --git a/test/files/run/typetags_core.scala b/test/files/run/typetags_core.scala deleted file mode 100644 index a870f77c5f..0000000000 --- a/test/files/run/typetags_core.scala +++ /dev/null @@ -1,32 +0,0 @@ -import scala.reflect.runtime.universe._ - -object Test extends App { - println(implicitly[TypeTag[Byte]] eq TypeTag.Byte) - println(implicitly[TypeTag[Byte]]) - println(implicitly[TypeTag[Short]] eq TypeTag.Short) - println(implicitly[TypeTag[Short]]) - println(implicitly[TypeTag[Char]] eq TypeTag.Char) - println(implicitly[TypeTag[Char]]) - println(implicitly[TypeTag[Int]] eq TypeTag.Int) - println(implicitly[TypeTag[Int]]) - println(implicitly[TypeTag[Long]] eq TypeTag.Long) - println(implicitly[TypeTag[Long]]) - println(implicitly[TypeTag[Float]] eq TypeTag.Float) - println(implicitly[TypeTag[Float]]) - println(implicitly[TypeTag[Double]] eq TypeTag.Double) - println(implicitly[TypeTag[Double]]) - println(implicitly[TypeTag[Boolean]] eq TypeTag.Boolean) - println(implicitly[TypeTag[Boolean]]) - println(implicitly[TypeTag[Unit]] eq TypeTag.Unit) - println(implicitly[TypeTag[Unit]]) - println(implicitly[TypeTag[Any]] eq TypeTag.Any) - println(implicitly[TypeTag[Any]]) - println(implicitly[TypeTag[Object]] eq TypeTag.Object) - println(implicitly[TypeTag[Object]]) - println(implicitly[TypeTag[Null]] eq TypeTag.Null) - println(implicitly[TypeTag[Null]]) - println(implicitly[TypeTag[Nothing]] eq TypeTag.Nothing) - println(implicitly[TypeTag[Nothing]]) - println(implicitly[TypeTag[String]] eq TypeTag.String) - println(implicitly[TypeTag[String]]) -} \ No newline at end of file diff --git a/test/files/run/typetags_multi.check b/test/files/run/typetags_multi.check deleted file mode 100644 index f3ac592f5a..0000000000 --- a/test/files/run/typetags_multi.check +++ /dev/null @@ -1,5 +0,0 @@ -Int -Array[Int] -Array[Array[Int]] -Array[Array[Array[Int]]] -Array[Array[Array[Array[Int]]]] diff --git a/test/files/run/typetags_multi.scala b/test/files/run/typetags_multi.scala deleted file mode 100644 index a989662160..0000000000 --- a/test/files/run/typetags_multi.scala +++ /dev/null @@ -1,9 +0,0 @@ -import scala.reflect.runtime.universe._ - -object Test extends App { - println(typeOf[Int]) - println(typeOf[Array[Int]]) - println(typeOf[Array[Array[Int]]]) - println(typeOf[Array[Array[Array[Int]]]]) - println(typeOf[Array[Array[Array[Array[Int]]]]]) -} \ No newline at end of file diff --git a/test/pending/run/macro-expand-implicit-macro-defeats-type-inference.check b/test/pending/run/macro-expand-implicit-macro-defeats-type-inference.check index 08f7cb9e3e..5af32f38e0 100644 --- a/test/pending/run/macro-expand-implicit-macro-defeats-type-inference.check +++ b/test/pending/run/macro-expand-implicit-macro-defeats-type-inference.check @@ -1,6 +1,6 @@ openImplicits are: List() enclosingImplicits are: List((List[Int],scala.this.Predef.implicitly[List[Int]])) -typetag is: ConcreteTypeTag[Nothing] +typetag is: TypeTag[Nothing] openImplicits are: List() enclosingImplicits are: List((List[String],Test.this.bar[String])) -typetag is: ConcreteTypeTag[Nothing] +typetag is: TypeTag[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 6c1461af8d..3252423375 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.runtime.universe._ object Test extends App { - def fooTypeTagHK[C[_]: ConcreteTypeTag, T: ConcreteTypeTag] = { - println(implicitly[ConcreteTypeTag[C[T]]]) - println(implicitly[ConcreteTypeTag[List[C[T]]]]) + def fooTypeTagHK[C[_]: TypeTag, T: TypeTag] = { + println(implicitly[TypeTag[C[T]]]) + println(implicitly[TypeTag[List[C[T]]]]) } fooTypeTagHK[List, Int] } \ No newline at end of file -- cgit v1.2.3