Permalink
Browse files

TypeTag => AbsTypeTag, ConcreteTypeTag => TypeTag

This protects everyone from the confusion caused by stuff like this:
https://issues.scala-lang.org/browse/SI-5884
  • Loading branch information...
xeno-by committed Jun 7, 2012
1 parent bc5f42f commit 5acac4d806eb45afdf1e7716c727a97130b69651
Showing with 577 additions and 595 deletions.
  1. +1 −1 lib/scala-compiler.jar.desired.sha1
  2. +1 −1 lib/scala-library.jar.desired.sha1
  3. +1 −1 lib/scala-reflect.jar.desired.sha1
  4. +2 −3 src/compiler/scala/reflect/makro/runtime/Aliases.scala
  5. +1 −1 src/compiler/scala/reflect/makro/runtime/Exprs.scala
  6. +1 −1 src/compiler/scala/reflect/makro/runtime/TypeTags.scala
  7. +2 −2 src/compiler/scala/reflect/reify/Errors.scala
  8. +1 −1 src/compiler/scala/reflect/reify/States.scala
  9. +2 −2 src/compiler/scala/reflect/reify/Taggers.scala
  10. +3 −3 src/compiler/scala/reflect/reify/codegen/GenTypes.scala
  11. +1 −1 src/compiler/scala/reflect/reify/codegen/GenUtils.scala
  12. +2 −2 src/compiler/scala/reflect/reify/phases/Reshape.scala
  13. +15 −7 src/compiler/scala/reflect/reify/utils/Extractors.scala
  14. +9 −9 src/compiler/scala/tools/nsc/doc/Settings.scala
  15. +2 −2 src/compiler/scala/tools/nsc/doc/html/SyntaxHigh.scala
  16. +1 −1 src/compiler/scala/tools/nsc/interpreter/ReplVals.scala
  17. +4 −4 src/compiler/scala/tools/nsc/typechecker/Implicits.scala
  18. +7 −6 src/compiler/scala/tools/nsc/typechecker/Macros.scala
  19. +11 −11 src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
  20. +3 −3 src/compiler/scala/tools/nsc/typechecker/Tags.scala
  21. +2 −2 src/compiler/scala/tools/reflect/FastTrack.scala
  22. +2 −2 src/library/scala/reflect/Manifest.scala
  23. +3 −3 src/library/scala/reflect/base/TagInterop.scala
  24. +104 −102 src/library/scala/reflect/base/TypeTags.scala
  25. +4 −0 src/library/scala/reflect/compat.scala
  26. +1 −1 src/library/scala/reflect/makro/internal/package.scala
  27. +9 −12 src/library/scala/reflect/package.scala
  28. +4 −4 src/reflect/scala/reflect/api/Exprs.scala
  29. +5 −5 src/reflect/scala/reflect/api/TagInterop.scala
  30. +15 −15 src/reflect/scala/reflect/internal/Definitions.scala
  31. +13 −13 src/reflect/scala/reflect/internal/StdNames.scala
  32. +2 −3 src/reflect/scala/reflect/makro/Aliases.scala
  33. +1 −1 src/reflect/scala/reflect/makro/Exprs.scala
  34. +1 −1 src/reflect/scala/reflect/makro/TypeTags.scala
  35. +35 −35 test/files/jvm/manifests-new.check
  36. +3 −3 test/files/jvm/manifests-new.scala
  37. +4 −0 test/files/neg/interop_abstypetags_arenot_classmanifests.check
  38. +11 −0 test/files/neg/interop_abstypetags_arenot_classmanifests.scala
  39. +4 −0 test/files/neg/interop_abstypetags_arenot_classtags.check
  40. +12 −0 test/files/neg/interop_abstypetags_arenot_classtags.scala
  41. +4 −0 test/files/neg/interop_abstypetags_arenot_manifests.check
  42. +11 −0 test/files/neg/interop_abstypetags_arenot_manifests.scala
  43. +0 −4 test/files/neg/interop_classmanifests_arenot_concretetypetags.check
  44. +0 −11 test/files/neg/interop_classmanifests_arenot_concretetypetags.scala
  45. +4 −0 test/files/neg/interop_classmanifests_arenot_typetags.check
  46. +1 −1 test/files/{run → neg}/interop_classmanifests_arenot_typetags.scala
  47. +0 −4 test/files/neg/interop_concretetypetags_arenot_classmanifests.check
  48. +0 −11 test/files/neg/interop_concretetypetags_arenot_classmanifests.scala
  49. +0 −4 test/files/neg/interop_concretetypetags_arenot_classtags.check
  50. +0 −12 test/files/neg/interop_concretetypetags_arenot_classtags.scala
  51. +0 −12 test/files/neg/interop_concretetypetags_without_classtags_arenot_manifests.scala
  52. +0 −4 test/files/neg/interop_typetags_arenot_manifests.check
  53. +0 −11 test/files/neg/interop_typetags_arenot_manifests.scala
  54. +1 −1 ...out_classtags_arenot_manifests.check → interop_typetags_without_classtags_arenot_manifests.check}
  55. +12 −0 test/files/neg/interop_typetags_without_classtags_arenot_manifests.scala
  56. +0 −7 test/files/neg/macro-reify-groundtypetag-hktypeparams-notags.check
  57. +0 −7 test/files/neg/macro-reify-groundtypetag-typeparams-notags.check
  58. +0 −7 test/files/neg/macro-reify-groundtypetag-usetypetag.check
  59. +7 −0 test/files/neg/macro-reify-typetag-hktypeparams-notags.check
  60. +2 −2 ...cro-reify-groundtypetag-hktypeparams-notags → macro-reify-typetag-hktypeparams-notags}/Test.scala
  61. +7 −0 test/files/neg/macro-reify-typetag-typeparams-notags.check
  62. 0 test/files/{run → neg}/macro-reify-typetag-typeparams-notags/Test.scala
  63. +7 −0 test/files/neg/macro-reify-typetag-useabstypetag.check
  64. +1 −1 ...les/{run/macro-reify-typetag-usegroundtypetag → neg/macro-reify-typetag-useabstypetag}/Test.scala
  65. +1 −1 test/files/neg/t3692-old.check
  66. +1 −1 test/files/pos/implicits-new.scala
  67. +28 −0 test/files/run/abstypetags_core.check
  68. +32 −0 test/files/run/abstypetags_core.scala
  69. +14 −14 test/files/run/concretetypetags_core.check
  70. +28 −28 test/files/run/concretetypetags_core.scala
  71. +5 −5 test/files/run/concretetypetags_multi.check
  72. +5 −5 test/files/run/concretetypetags_multi.scala
  73. +2 −2 test/files/run/existentials3-new.scala
  74. +0 −3 test/files/run/interop_classmanifests_arenot_typetags.check
  75. +0 −12 test/files/run/interop_concretetypetags_are_manifests.scala
  76. 0 ...iles/run/{interop_manifests_are_concretetypetags.check → interop_manifests_are_abstypetags.check}
  77. +11 −0 test/files/run/interop_manifests_are_abstypetags.scala
  78. +0 −11 test/files/run/interop_manifests_are_concretetypetags.scala
  79. 0 test/files/run/{interop_concretetypetags_are_manifests.check → interop_typetags_are_manifests.check}
  80. +12 −0 test/files/run/interop_typetags_are_manifests.scala
  81. +5 −5 test/files/run/macro-expand-nullary-generic.check
  82. +1 −1 test/files/run/macro-expand-tparams-explicit.check
  83. +2 −2 test/files/run/macro-expand-tparams-implicit.check
  84. +4 −4 test/files/run/macro-expand-tparams-prefix-a.check
  85. +2 −2 test/files/run/macro-expand-tparams-prefix-b.check
  86. +3 −3 test/files/run/macro-expand-tparams-prefix-c1.check
  87. +3 −3 test/files/run/macro-expand-tparams-prefix-c2.check
  88. +3 −3 test/files/run/macro-expand-tparams-prefix-d1.check
  89. +2 −2 test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala
  90. +2 −0 test/files/run/macro-reify-abstypetag-notypeparams.check
  91. +6 −0 test/files/run/macro-reify-abstypetag-notypeparams/Test.scala
  92. +2 −0 test/files/run/macro-reify-abstypetag-typeparams-notags.check
  93. +2 −2 ...-reify-groundtypetag-typeparams-notags → run/macro-reify-abstypetag-typeparams-notags}/Test.scala
  94. +2 −0 test/files/run/macro-reify-abstypetag-typeparams-tags.check
  95. +9 −0 test/files/run/macro-reify-abstypetag-typeparams-tags/Test.scala
  96. +2 −0 test/files/run/macro-reify-abstypetag-usetypetag.check
  97. +2 −2 ...les/{neg/macro-reify-groundtypetag-usetypetag → run/macro-reify-abstypetag-usetypetag}/Test.scala
  98. +0 −2 test/files/run/macro-reify-groundtypetag-notypeparams.check
  99. +0 −6 test/files/run/macro-reify-groundtypetag-notypeparams/Test.scala
  100. +0 −2 test/files/run/macro-reify-groundtypetag-typeparams-tags.check
  101. +0 −9 test/files/run/macro-reify-groundtypetag-typeparams-tags/Test.scala
  102. +2 −2 test/files/run/macro-reify-typetag-notypeparams.check
  103. +0 −2 test/files/run/macro-reify-typetag-typeparams-notags.check
  104. +1 −1 test/files/run/macro-reify-typetag-typeparams-tags.check
  105. +0 −2 test/files/run/macro-reify-typetag-usegroundtypetag.check
  106. +3 −3 test/files/run/macro-undetparams-consfromsls.check
  107. +4 −4 test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala
  108. +1 −1 test/files/run/macro-undetparams-implicitval.check
  109. +2 −2 test/files/run/macro-undetparams-macroitself.check
  110. +1 −1 test/files/run/newTags.check
  111. +1 −1 test/files/run/reify_newimpl_25.check
  112. +3 −3 test/files/run/reify_newimpl_26.check
  113. +1 −1 test/files/run/reify_newimpl_26.scala
  114. +0 −28 test/files/run/typetags_core.check
  115. +0 −32 test/files/run/typetags_core.scala
  116. +0 −5 test/files/run/typetags_multi.check
  117. +0 −9 test/files/run/typetags_multi.scala
  118. +2 −2 test/pending/run/macro-expand-implicit-macro-defeats-type-inference.check
  119. +3 −3 test/pending/run/macro-reify-groundtypetag-hktypeparams-tags/Test.scala
@@ -1 +1 @@
-cd208e55a800a1b4fcc623f13b44e9df551b617d ?scala-compiler.jar
+78aea1d6d86525ce869139f66bfb98505dab6c76 ?scala-compiler.jar
@@ -1 +1 @@
-5d4aa46eabd2a034a3102fb1de168547ef7d977b ?scala-library.jar
+935553e8d1dfb5d71652c195ce25314c3af2442c ?scala-library.jar
@@ -1 +1 @@
-cebf7edbff7931c4b3d6ef1504b2bf66f1abf6fd ?scala-reflect.jar
+d3a859a035f849d334732b12518715e7c9f4a475 ?scala-reflect.jar
@@ -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
}
@@ -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))
}
@@ -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))
}
@@ -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)
}
@@ -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
@@ -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))
}
}
@@ -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
@@ -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
}
@@ -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
}
@@ -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 <init>(): $typecreator1 = {
// $typecreator1.super.<init>();
@@ -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,17 +130,21 @@ 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
}
}
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
}
@@ -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() +
- ("<root>.scala.package.Numeric" -> ((tparam: String) => tparam + " is a numeric class, such as Int, Long, Float or Double")) +
- ("<root>.scala.package.Integral" -> ((tparam: String) => tparam + " is an integral numeric class, such as Int or Long")) +
- ("<root>.scala.package.Fractional" -> ((tparam: String) => tparam + " is a fractional numeric class, such as Float or Double")) +
- ("<root>.scala.reflect.Manifest" -> ((tparam: String) => tparam + " is accompanied by a Manifest, which is a runtime representation of its type that survives erasure")) +
- ("<root>.scala.reflect.ClassManifest" -> ((tparam: String) => tparam + " is accompanied by a ClassManifest, which is a runtime representation of its type that survives erasure")) +
- ("<root>.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")) +
- ("<root>.scala.reflect.ClassTag" -> ((tparam: String) => tparam + " is accompanied by a ClassTag, which is a runtime representation of its type that survives erasure")) +
- ("<root>.scala.reflect.TypeTag" -> ((tparam: String) => tparam + " is accompanied by a TypeTag, which is a runtime representation of its type that survives erasure")) +
- ("<root>.scala.reflect.ConcreteTypeTag" -> ((tparam: String) => tparam + " is accompanied by an ConcreteTypeTag, which is a runtime representation of a concrete type that survives erasure"))
+ ("<root>.scala.package.Numeric" -> ((tparam: String) => tparam + " is a numeric class, such as Int, Long, Float or Double")) +
+ ("<root>.scala.package.Integral" -> ((tparam: String) => tparam + " is an integral numeric class, such as Int or Long")) +
+ ("<root>.scala.package.Fractional" -> ((tparam: String) => tparam + " is a fractional numeric class, such as Float or Double")) +
+ ("<root>.scala.reflect.Manifest" -> ((tparam: String) => tparam + " is accompanied by a Manifest, which is a runtime representation of its type that survives erasure")) +
+ ("<root>.scala.reflect.ClassManifest" -> ((tparam: String) => tparam + " is accompanied by a ClassManifest, which is a runtime representation of its type that survives erasure")) +
+ ("<root>.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")) +
+ ("<root>.scala.reflect.ClassTag" -> ((tparam: String) => tparam + " is accompanied by a ClassTag, which is a runtime representation of its type that survives erasure")) +
+ ("<root>.scala.reflect.AbsTypeTag" -> ((tparam: String) => tparam + " is accompanied by an AbsTypeTag, which is a runtime representation of its type that survives erasure")) +
+ ("<root>.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
@@ -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",
@@ -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) {
@@ -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)
}
@@ -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
Oops, something went wrong.

0 comments on commit 5acac4d

Please sign in to comment.