summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-09-14 08:12:32 -0700
committerEugene Burmako <xeno.by@gmail.com>2012-09-14 08:12:32 -0700
commit65358306ba2538a6954767952058d6281ef139e2 (patch)
tree51a8bc0a388c578e96b97a24c8ef272dafe5c0d4
parent52abc96229e624f6b31ee30ffced945ff652c994 (diff)
parent511578d7938a57b0756501cd565435083739fb39 (diff)
downloadscala-65358306ba2538a6954767952058d6281ef139e2.tar.gz
scala-65358306ba2538a6954767952058d6281ef139e2.tar.bz2
scala-65358306ba2538a6954767952058d6281ef139e2.zip
Merge pull request #1295 from scalamacros/ticket/6323
improvements for type tags
-rw-r--r--lib/scala-compiler-src.jar.desired.sha12
-rw-r--r--lib/scala-compiler.jar.desired.sha12
-rw-r--r--lib/scala-library-src.jar.desired.sha12
-rw-r--r--lib/scala-library.jar.desired.sha12
-rw-r--r--lib/scala-reflect-src.jar.desired.sha12
-rw-r--r--lib/scala-reflect.jar.desired.sha12
-rw-r--r--src/compiler/scala/reflect/macros/runtime/Aliases.scala8
-rw-r--r--src/compiler/scala/reflect/macros/runtime/Exprs.scala2
-rw-r--r--src/compiler/scala/reflect/macros/runtime/TypeTags.scala2
-rw-r--r--src/compiler/scala/reflect/reify/Errors.scala4
-rw-r--r--src/compiler/scala/reflect/reify/States.scala8
-rw-r--r--src/compiler/scala/reflect/reify/Taggers.scala4
-rw-r--r--src/compiler/scala/reflect/reify/codegen/GenSymbols.scala62
-rw-r--r--src/compiler/scala/reflect/reify/codegen/GenTrees.scala2
-rw-r--r--src/compiler/scala/reflect/reify/codegen/GenTypes.scala2
-rw-r--r--src/compiler/scala/reflect/reify/codegen/GenUtils.scala2
-rw-r--r--src/compiler/scala/reflect/reify/phases/Reshape.scala4
-rw-r--r--src/compiler/scala/reflect/reify/utils/Extractors.scala22
-rw-r--r--src/compiler/scala/reflect/reify/utils/StdAttachments.scala10
-rw-r--r--src/compiler/scala/reflect/reify/utils/SymbolTables.scala59
-rw-r--r--src/compiler/scala/tools/nsc/doc/Settings.scala2
-rw-r--r--src/compiler/scala/tools/nsc/doc/html/SyntaxHigh.scala2
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/ReplVals.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala6
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Implicits.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Macros.scala20
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Tags.scala6
-rw-r--r--src/compiler/scala/tools/reflect/FastTrack.scala4
-rw-r--r--src/library/scala/reflect/base/Base.scala11
-rw-r--r--src/library/scala/reflect/base/BuildUtils.scala24
-rw-r--r--src/library/scala/reflect/base/Exprs.scala14
-rw-r--r--src/library/scala/reflect/base/TypeTags.scala128
-rw-r--r--src/library/scala/reflect/base/Universe.scala2
-rw-r--r--src/library/scala/reflect/macros/internal/package.scala2
-rw-r--r--src/reflect/scala/reflect/internal/BuildUtils.scala11
-rw-r--r--src/reflect/scala/reflect/internal/Definitions.scala10
-rw-r--r--src/reflect/scala/reflect/internal/Importers.scala4
-rw-r--r--src/reflect/scala/reflect/internal/StdNames.scala5
-rw-r--r--src/reflect/scala/reflect/internal/Symbols.scala12
-rw-r--r--src/reflect/scala/reflect/macros/Aliases.scala8
-rw-r--r--src/reflect/scala/reflect/macros/Exprs.scala2
-rw-r--r--src/reflect/scala/reflect/macros/TypeTags.scala2
-rw-r--r--src/reflect/scala/reflect/runtime/JavaMirrors.scala51
-rw-r--r--src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala8
-rw-r--r--src/reflect/scala/reflect/runtime/package.scala2
-rw-r--r--test/files/neg/interop_abstypetags_arenot_classmanifests.scala8
-rw-r--r--test/files/neg/interop_abstypetags_arenot_classtags.scala8
-rw-r--r--test/files/neg/interop_abstypetags_arenot_manifests.scala8
-rw-r--r--test/files/neg/macro-invalidsig-context-bounds.check2
-rw-r--r--test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala2
-rw-r--r--test/files/neg/macro-invalidsig-implicit-params.check2
-rw-r--r--test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala4
-rw-r--r--test/files/neg/macro-invalidsig-tparams-notparams-a.check2
-rw-r--r--test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala2
-rw-r--r--test/files/neg/macro-invalidsig-tparams-notparams-b.check2
-rw-r--r--test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala6
-rw-r--r--test/files/neg/macro-invalidsig-tparams-notparams-c.check2
-rw-r--r--test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala6
-rw-r--r--test/files/neg/macro-reify-typetag-useabstypetag/Test.scala2
-rw-r--r--test/files/neg/t6323a.check9
-rw-r--r--test/files/neg/t6323a.flags1
-rw-r--r--test/files/neg/t6323a.scala21
-rw-r--r--test/files/pos/t6047.scala6
-rw-r--r--test/files/run/abstypetags_core.scala60
-rw-r--r--test/files/run/abstypetags_serialize.scala8
-rw-r--r--test/files/run/existentials3-new.check16
-rw-r--r--test/files/run/existentials3-new.scala18
-rw-r--r--test/files/run/interop_manifests_are_abstypetags.scala10
-rw-r--r--test/files/run/macro-def-path-dependent-d1/Impls_Macros_1.scala2
-rw-r--r--test/files/run/macro-def-path-dependent-d2/Impls_1.scala2
-rw-r--r--test/files/run/macro-expand-implicit-argument/Macros_1.scala4
-rw-r--r--test/files/run/macro-expand-nullary-generic/Impls_1.scala12
-rw-r--r--test/files/run/macro-expand-tparams-explicit/Impls_1.scala4
-rw-r--r--test/files/run/macro-expand-tparams-implicit.check2
-rw-r--r--test/files/run/macro-expand-tparams-implicit/Impls_1.scala4
-rw-r--r--test/files/run/macro-expand-tparams-prefix-a.check2
-rw-r--r--test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala4
-rw-r--r--test/files/run/macro-expand-tparams-prefix-b.check2
-rw-r--r--test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala6
-rw-r--r--test/files/run/macro-expand-tparams-prefix-c1.check2
-rw-r--r--test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala4
-rw-r--r--test/files/run/macro-expand-tparams-prefix-c2.check2
-rw-r--r--test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-expand-tparams-prefix-d1.check4
-rw-r--r--test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala4
-rw-r--r--test/files/run/macro-impl-default-params/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala2
-rw-r--r--test/files/run/macro-reify-abstypetag-notypeparams/Test.scala4
-rw-r--r--test/files/run/macro-reify-abstypetag-typeparams-notags.check4
-rw-r--r--test/files/run/macro-reify-abstypetag-typeparams-notags/Test.scala4
-rw-r--r--test/files/run/macro-reify-abstypetag-typeparams-tags.check2
-rw-r--r--test/files/run/macro-reify-abstypetag-typeparams-tags/Test.scala6
-rw-r--r--test/files/run/macro-reify-abstypetag-usetypetag.check2
-rw-r--r--test/files/run/macro-reify-abstypetag-usetypetag/Test.scala4
-rw-r--r--test/files/run/macro-reify-freevars/Macros_1.scala2
-rw-r--r--test/files/run/macro-reify-nested-a/Impls_Macros_1.scala6
-rw-r--r--test/files/run/macro-reify-nested-b/Impls_Macros_1.scala6
-rw-r--r--test/files/run/macro-reify-tagful-a/Macros_1.scala2
-rw-r--r--test/files/run/macro-reify-tagless-a.check2
-rw-r--r--test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala3
-rw-r--r--test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala3
-rw-r--r--test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala8
-rw-r--r--test/files/run/macro-undetparams-macroitself.check2
-rw-r--r--test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala2
-rw-r--r--test/files/run/reify_newimpl_26.check6
-rw-r--r--test/files/run/reify_newimpl_26.scala2
-rw-r--r--test/files/run/t1195-new.scala2
-rw-r--r--test/files/run/t6323b.check1
-rw-r--r--test/files/run/t6323b.scala21
-rw-r--r--test/files/run/toolbox_typecheck_macrosdisabled.scala3
-rw-r--r--test/files/run/toolbox_typecheck_macrosdisabled2.scala3
-rw-r--r--test/pending/run/macro-expand-implicit-macro-defeats-type-inference/Impls_1.scala2
-rw-r--r--test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala4
-rw-r--r--test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala4
-rw-r--r--test/pending/run/macro-reify-array/Macros_1.scala2
-rw-r--r--test/pending/run/macro-reify-tagful-b/Macros_1.scala2
116 files changed, 489 insertions, 443 deletions
diff --git a/lib/scala-compiler-src.jar.desired.sha1 b/lib/scala-compiler-src.jar.desired.sha1
index bfbcc5a7a3..057d6b26e6 100644
--- a/lib/scala-compiler-src.jar.desired.sha1
+++ b/lib/scala-compiler-src.jar.desired.sha1
@@ -1 +1 @@
-7bad3afb569e2c57d1b299b61e0d3c0fa1b1d8d9 ?scala-compiler-src.jar
+acfbbb4117b222b488226b4a89d5e732eb59f19c ?scala-compiler-src.jar
diff --git a/lib/scala-compiler.jar.desired.sha1 b/lib/scala-compiler.jar.desired.sha1
index ef2063bc3d..d4cad8f868 100644
--- a/lib/scala-compiler.jar.desired.sha1
+++ b/lib/scala-compiler.jar.desired.sha1
@@ -1 +1 @@
-5f73d19a6ec70f67e6d8a2f08cde3551e51b2b79 ?scala-compiler.jar
+e0c0f2326622f535aa86978dee74dc7ac86e401b ?scala-compiler.jar
diff --git a/lib/scala-library-src.jar.desired.sha1 b/lib/scala-library-src.jar.desired.sha1
index 0709415f43..c8515e61de 100644
--- a/lib/scala-library-src.jar.desired.sha1
+++ b/lib/scala-library-src.jar.desired.sha1
@@ -1 +1 @@
-26c6c1cf7be57afa519ec641fb78e16a771a534a ?scala-library-src.jar
+52b0ea12b0fe6c2150434fdda3909c2aa927a325 ?scala-library-src.jar
diff --git a/lib/scala-library.jar.desired.sha1 b/lib/scala-library.jar.desired.sha1
index edc3614c6d..323d3441f8 100644
--- a/lib/scala-library.jar.desired.sha1
+++ b/lib/scala-library.jar.desired.sha1
@@ -1 +1 @@
-4f14def979133788dd91117a203a40e35cd24528 ?scala-library.jar
+7a35fcd17b39ea1e13cc8c919e1e556eed81e799 ?scala-library.jar
diff --git a/lib/scala-reflect-src.jar.desired.sha1 b/lib/scala-reflect-src.jar.desired.sha1
index a7a9eddd93..839d77da3a 100644
--- a/lib/scala-reflect-src.jar.desired.sha1
+++ b/lib/scala-reflect-src.jar.desired.sha1
@@ -1 +1 @@
-60c61467bc992752bf81bc0ca783a9d6a72db588 ?scala-reflect-src.jar
+fc25fdfd30959e77b85c0c7917005a83890f94a2 ?scala-reflect-src.jar
diff --git a/lib/scala-reflect.jar.desired.sha1 b/lib/scala-reflect.jar.desired.sha1
index a1732595b8..88ea78c303 100644
--- a/lib/scala-reflect.jar.desired.sha1
+++ b/lib/scala-reflect.jar.desired.sha1
@@ -1 +1 @@
-b3764f8b2f7719d1fbfaf9767a3a68f6ef7ad876 ?scala-reflect.jar
+5aca838ee9d82be45fb476c1722f71842d5d528e ?scala-reflect.jar
diff --git a/src/compiler/scala/reflect/macros/runtime/Aliases.scala b/src/compiler/scala/reflect/macros/runtime/Aliases.scala
index 5e15b61dbd..30e72997f7 100644
--- a/src/compiler/scala/reflect/macros/runtime/Aliases.scala
+++ b/src/compiler/scala/reflect/macros/runtime/Aliases.scala
@@ -17,12 +17,12 @@ trait Aliases {
override type Expr[+T] = universe.Expr[T]
override val Expr = universe.Expr
- override type AbsTypeTag[T] = universe.AbsTypeTag[T]
+ override type WeakTypeTag[T] = universe.WeakTypeTag[T]
override type TypeTag[T] = universe.TypeTag[T]
- override val AbsTypeTag = universe.AbsTypeTag
+ override val WeakTypeTag = universe.WeakTypeTag
override val TypeTag = universe.TypeTag
- override def absTypeTag[T](implicit attag: AbsTypeTag[T]) = attag
+ override def weakTypeTag[T](implicit attag: WeakTypeTag[T]) = attag
override def typeTag[T](implicit ttag: TypeTag[T]) = ttag
- override def absTypeOf[T](implicit attag: AbsTypeTag[T]): Type = attag.tpe
+ override def weakTypeOf[T](implicit attag: WeakTypeTag[T]): Type = attag.tpe
override def typeOf[T](implicit ttag: TypeTag[T]): Type = ttag.tpe
} \ No newline at end of file
diff --git a/src/compiler/scala/reflect/macros/runtime/Exprs.scala b/src/compiler/scala/reflect/macros/runtime/Exprs.scala
index 4217a6a404..ebf8fa2b96 100644
--- a/src/compiler/scala/reflect/macros/runtime/Exprs.scala
+++ b/src/compiler/scala/reflect/macros/runtime/Exprs.scala
@@ -4,5 +4,5 @@ package runtime
trait Exprs {
self: Context =>
- def Expr[T: AbsTypeTag](tree: Tree): Expr[T] = universe.Expr[T](mirror, universe.FixedMirrorTreeCreator(mirror, tree))
+ def Expr[T: WeakTypeTag](tree: Tree): Expr[T] = universe.Expr[T](mirror, universe.FixedMirrorTreeCreator(mirror, tree))
}
diff --git a/src/compiler/scala/reflect/macros/runtime/TypeTags.scala b/src/compiler/scala/reflect/macros/runtime/TypeTags.scala
index 2bc2fe6384..19b60159de 100644
--- a/src/compiler/scala/reflect/macros/runtime/TypeTags.scala
+++ b/src/compiler/scala/reflect/macros/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 WeakTypeTag[T](tpe: Type): WeakTypeTag[T] = universe.WeakTypeTag[T](mirror, universe.FixedMirrorTypeCreator(mirror, tpe))
def TypeTag[T](tpe: Type): TypeTag[T] = universe.TypeTag[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 5e15c5ad3a..73c13901b6 100644
--- a/src/compiler/scala/reflect/reify/Errors.scala
+++ b/src/compiler/scala/reflect/reify/Errors.scala
@@ -27,8 +27,8 @@ trait Errors {
throw new ReificationError(defaultErrorPosition, msg)
}
- def CannotReifyTypeTagHavingUnresolvedTypeParameters(tpe: Type) = {
- val msg = "cannot reify TypeTag having unresolved type parameter %s".format(tpe)
+ def CannotReifyWeakType(details: Any) = {
+ val msg = "cannot create a TypeTag" + details
throw new ReificationError(defaultErrorPosition, msg)
}
diff --git a/src/compiler/scala/reflect/reify/States.scala b/src/compiler/scala/reflect/reify/States.scala
index a01cfe5d74..58455c9f3c 100644
--- a/src/compiler/scala/reflect/reify/States.scala
+++ b/src/compiler/scala/reflect/reify/States.scala
@@ -34,9 +34,11 @@ trait States {
def reificationIsConcrete_=(value: Boolean): Unit = {
_reificationIsConcrete = value
if (!value && concrete) {
- assert(current.isInstanceOf[Type], current)
- val offender = current.asInstanceOf[Type]
- CannotReifyTypeTagHavingUnresolvedTypeParameters(offender)
+ current match {
+ case tpe: Type => CannotReifyWeakType(s" having unresolved type parameter $tpe")
+ case sym: Symbol => CannotReifyWeakType(s" referring to local ${sym.kindString} ${sym.fullName}")
+ case _ => CannotReifyWeakType("")
+ }
}
}
var reifyStack = reifee :: Nil
diff --git a/src/compiler/scala/reflect/reify/Taggers.scala b/src/compiler/scala/reflect/reify/Taggers.scala
index a8523fe686..bc12d383a4 100644
--- a/src/compiler/scala/reflect/reify/Taggers.scala
+++ b/src/compiler/scala/reflect/reify/Taggers.scala
@@ -37,7 +37,7 @@ abstract class Taggers {
}
def materializeTypeTag(universe: Tree, mirror: Tree, tpe: Type, concrete: Boolean): Tree = {
- val tagType = if (concrete) TypeTagClass else AbsTypeTagClass
+ val tagType = if (concrete) TypeTagClass else WeakTypeTagClass
// what we need here is to compose a type BaseUniverse # TypeTag[$tpe]
// to look for an implicit that conforms to this type
// that's why neither appliedType(tagType, List(tpe)) aka TypeRef(TypeTagsClass.thisType, tagType, List(tpe))
@@ -50,7 +50,7 @@ abstract class Taggers {
case success if !success.isEmpty =>
Apply(Select(success, nme.in), List(mirror orElse mkDefaultMirrorRef(c.universe)(universe, c.callsiteTyper)))
case _ =>
- val tagModule = if (concrete) TypeTagModule else AbsTypeTagModule
+ val tagModule = if (concrete) TypeTagModule else WeakTypeTagModule
materializeTag(universe, tpe, tagModule, c.reifyType(universe, mirror, tpe, concrete = concrete))
}
}
diff --git a/src/compiler/scala/reflect/reify/codegen/GenSymbols.scala b/src/compiler/scala/reflect/reify/codegen/GenSymbols.scala
index ca6e14cfd3..c4b674955a 100644
--- a/src/compiler/scala/reflect/reify/codegen/GenSymbols.scala
+++ b/src/compiler/scala/reflect/reify/codegen/GenSymbols.scala
@@ -90,49 +90,61 @@ trait GenSymbols {
}
} else {
// todo. make sure that free methods and free local defs work correctly
- if (sym.isTerm) reifyFreeTerm(sym, Ident(sym))
- else reifyFreeType(sym, Ident(sym))
+ if (sym.isExistential) reifySymDef(sym)
+ else if (sym.isTerm) reifyFreeTerm(Ident(sym))
+ else reifyFreeType(Ident(sym))
}
}
- def reifyFreeTerm(sym: Symbol, value: Tree): Tree =
- reifyIntoSymtab(sym) {
+ def reifyFreeTerm(binding: Tree): Tree =
+ reifyIntoSymtab(binding.symbol) { sym =>
if (reifyDebug) println("Free term" + (if (sym.isCapturedVariable) " (captured)" else "") + ": " + sym + "(" + sym.accurateKindString + ")")
- var name = newTermName(nme.REIFY_FREE_PREFIX + sym.name)
- if (sym.isType) name = name.append(nme.REIFY_FREE_THIS_SUFFIX)
+ val name = newTermName(nme.REIFY_FREE_PREFIX + sym.name + (if (sym.isType) nme.REIFY_FREE_THIS_SUFFIX else ""))
if (sym.isCapturedVariable) {
- assert(value.isInstanceOf[Ident], showRaw(value))
- val capturedTpe = capturedVariableType(sym)
- val capturedValue = referenceCapturedVariable(sym)
- (name, mirrorBuildCall(nme.newFreeTerm, reify(sym.name.toString), reify(capturedTpe), capturedValue, mirrorBuildCall(nme.flagsFromBits, reify(sym.flags)), reify(origin(sym))))
+ assert(binding.isInstanceOf[Ident], showRaw(binding))
+ val capturedBinding = referenceCapturedVariable(sym)
+ Reification(name, capturedBinding, mirrorBuildCall(nme.newFreeTerm, reify(sym.name.toString), capturedBinding, mirrorBuildCall(nme.flagsFromBits, reify(sym.flags)), reify(origin(sym))))
} else {
- (name, mirrorBuildCall(nme.newFreeTerm, reify(sym.name.toString), reify(sym.tpe), value, mirrorBuildCall(nme.flagsFromBits, reify(sym.flags)), reify(origin(sym))))
+ Reification(name, binding, mirrorBuildCall(nme.newFreeTerm, reify(sym.name.toString), binding, mirrorBuildCall(nme.flagsFromBits, reify(sym.flags)), reify(origin(sym))))
}
}
- def reifyFreeType(sym: Symbol, value: Tree): Tree =
- reifyIntoSymtab(sym) {
+ def reifyFreeType(binding: Tree): Tree =
+ reifyIntoSymtab(binding.symbol) { sym =>
if (reifyDebug) println("Free type: %s (%s)".format(sym, sym.accurateKindString))
- var name = newTermName(nme.REIFY_FREE_PREFIX + sym.name)
- val phantomTypeTag = Apply(TypeApply(Select(Ident(nme.UNIVERSE_SHORT), nme.TypeTag), List(value)), List(Literal(Constant(null)), Literal(Constant(null))))
- val flavor = if (sym.isExistential) nme.newFreeExistential else nme.newFreeType
- (name, mirrorBuildCall(flavor, reify(sym.name.toString), reify(sym.info), phantomTypeTag, mirrorBuildCall(nme.flagsFromBits, reify(sym.flags)), reify(origin(sym))))
+ state.reificationIsConcrete = false
+ val name = newTermName(nme.REIFY_FREE_PREFIX + sym.name)
+ Reification(name, binding, mirrorBuildCall(nme.newFreeType, reify(sym.name.toString), mirrorBuildCall(nme.flagsFromBits, reify(sym.flags)), reify(origin(sym))))
}
def reifySymDef(sym: Symbol): Tree =
- reifyIntoSymtab(sym) {
+ reifyIntoSymtab(sym) { sym =>
if (reifyDebug) println("Sym def: %s (%s)".format(sym, sym.accurateKindString))
- assert(!sym.isLocatable, sym) // if this assertion fires, then tough type reification needs to be rethought
- sym.owner.ownersIterator find (!_.isLocatable) foreach reifySymDef
- var name = newTermName(nme.REIFY_SYMDEF_PREFIX + sym.name)
- (name, mirrorBuildCall(nme.newNestedSymbol, reify(sym.owner), reify(sym.name), reify(sym.pos), mirrorBuildCall(nme.flagsFromBits, reify(sym.flags)), reify(sym.isClass)))
+ val name = newTermName(nme.REIFY_SYMDEF_PREFIX + sym.name)
+ def reifiedOwner = if (sym.owner.isLocatable) reify(sym.owner) else reifySymDef(sym.owner)
+ Reification(name, Ident(sym), mirrorBuildCall(nme.newNestedSymbol, reifiedOwner, reify(sym.name), reify(sym.pos), mirrorBuildCall(nme.flagsFromBits, reify(sym.flags)), reify(sym.isClass)))
}
- private def reifyIntoSymtab(sym: Symbol)(reificode: => (TermName, Tree)): Tree ={
+ case class Reification(name: Name, binding: Tree, tree: Tree)
+
+ private def reifyIntoSymtab(sym: Symbol)(reificode: Symbol => Reification): Tree = {
def fromSymtab = symtab symRef sym
if (fromSymtab == EmptyTree) {
- val reification = reificode
- state.symtab += (sym, reification._1, reification._2)
+ // reification is lazy, so that we can carefully choose where to evaluate it
+ // and we choose this place to be exactly here:
+ //
+ // reasons:
+ // 1) reification happens at maximum once per symbol to prevent repeated reifications
+ // 2) reification happens before putting the symbol itself into the symbol table to ensure correct initialization order:
+ // for example, if reification of symbol A refers to reification of symbol B
+ // (this might happen when we're doing `reifySymDef`, which expands into `newNestedSymbol`, which needs `sym.owner`)
+ // then we have to put reification-B into the symbol table before reification-A
+ // so that subsequent code generation that traverses the symbol table in the first-added first-codegenned order
+ // produces valid Scala code (with vals in a block depending only on lexically preceding vals)
+ val reification = reificode(sym)
+ import reification.{name, binding}
+ val tree = reification.tree addAttachment ReifyBindingAttachment(binding)
+ state.symtab += (sym, name, tree)
}
fromSymtab
}
diff --git a/src/compiler/scala/reflect/reify/codegen/GenTrees.scala b/src/compiler/scala/reflect/reify/codegen/GenTrees.scala
index f48df8df65..bdcc7383b0 100644
--- a/src/compiler/scala/reflect/reify/codegen/GenTrees.scala
+++ b/src/compiler/scala/reflect/reify/codegen/GenTrees.scala
@@ -124,7 +124,7 @@ trait GenTrees {
val sym = tree.symbol
if (reifyDebug) println("This for %s, reified as freeVar".format(sym))
if (reifyDebug) println("Free: " + sym)
- mirrorBuildCall(nme.Ident, reifyFreeTerm(sym, This(sym)))
+ mirrorBuildCall(nme.Ident, reifyFreeTerm(This(sym)))
case tree @ This(_) if !tree.symbol.isLocalToReifee =>
if (reifyDebug) println("This for %s, reified as This".format(tree.symbol))
mirrorBuildCall(nme.This, reify(tree.symbol))
diff --git a/src/compiler/scala/reflect/reify/codegen/GenTypes.scala b/src/compiler/scala/reflect/reify/codegen/GenTypes.scala
index 1d2e177688..7aa87dc2f8 100644
--- a/src/compiler/scala/reflect/reify/codegen/GenTypes.scala
+++ b/src/compiler/scala/reflect/reify/codegen/GenTypes.scala
@@ -73,7 +73,7 @@ trait GenTypes {
if (tpe.isSpliceable && !(quantified contains tpe.typeSymbol)) {
if (reifyDebug) println("splicing " + tpe)
- val tagFlavor = if (concrete) tpnme.TypeTag.toString else tpnme.AbsTypeTag.toString
+ val tagFlavor = if (concrete) tpnme.TypeTag.toString else tpnme.WeakTypeTag.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
diff --git a/src/compiler/scala/reflect/reify/codegen/GenUtils.scala b/src/compiler/scala/reflect/reify/codegen/GenUtils.scala
index 2b7733fb6c..8aef8d772f 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.AbsTypeTag || ctor == nme.TypeTag || ctor == nme.Expr => true
+ case Select(sym @ Select(_, ctor), nme.apply) if ctor == nme.WeakTypeTag || 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 fcf3c0e65c..0b07c47c0f 100644
--- a/src/compiler/scala/reflect/reify/phases/Reshape.scala
+++ b/src/compiler/scala/reflect/reify/phases/Reshape.scala
@@ -103,8 +103,8 @@ 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_materializeWeakTypeTag =>
+ gen.mkNullaryCall(Predef_implicitly, List(typeRef(pre.tpe, WeakTypeTagClass, 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 _ =>
diff --git a/src/compiler/scala/reflect/reify/utils/Extractors.scala b/src/compiler/scala/reflect/reify/utils/Extractors.scala
index ebe3957e69..1df9efbb82 100644
--- a/src/compiler/scala/reflect/reify/utils/Extractors.scala
+++ b/src/compiler/scala/reflect/reify/utils/Extractors.scala
@@ -94,7 +94,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.TypeTag else nme.AbsTypeTag
+ val tagFactory = if (concrete) nme.TypeTag else nme.WeakTypeTag
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))
@@ -122,7 +122,7 @@ trait Extractors {
object ReifiedType {
def apply(universe: Tree, mirror: Tree, symtab: SymbolTable, tpe: Type, rtpe: Tree, concrete: Boolean) = {
- val tagFactory = if (concrete) nme.TypeTag else nme.AbsTypeTag
+ val tagFactory = if (concrete) nme.TypeTag else nme.WeakTypeTag
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)
@@ -176,12 +176,11 @@ trait Extractors {
List(
_,
_,
- binding,
Apply(Select(Select(uref2 @ Ident(_), build2), flagsFromBits), List(Literal(Constant(flags: Long)))),
Literal(Constant(origin: String)))))
if uref1.name == nme.UNIVERSE_SHORT && build1 == nme.build && newFreeTerm == nme.newFreeTerm &&
uref2.name == nme.UNIVERSE_SHORT && build2 == nme.build && flagsFromBits == nme.flagsFromBits =>
- Some(uref1, name, binding, flags, origin)
+ Some(uref1, name, reifyBinding(tree), flags, origin)
case _ =>
None
}
@@ -194,22 +193,11 @@ trait Extractors {
Select(Select(uref1 @ Ident(_), build1), newFreeType),
List(
_,
- _,
- value,
Apply(Select(Select(uref2 @ Ident(_), build2), flagsFromBits), List(Literal(Constant(flags: Long)))),
Literal(Constant(origin: String)))))
- if uref1.name == nme.UNIVERSE_SHORT && build1 == nme.build && (newFreeType == nme.newFreeType || newFreeType == nme.newFreeExistential) &&
+ if uref1.name == nme.UNIVERSE_SHORT && build1 == nme.build && newFreeType == nme.newFreeType &&
uref2.name == nme.UNIVERSE_SHORT && build2 == nme.build && flagsFromBits == nme.flagsFromBits =>
- value match {
- case Apply(TypeApply(Select(Select(uref3 @ Ident(_), typeTag), apply), List(binding)), List(Literal(Constant(null)), _))
- if uref3.name == nme.UNIVERSE_SHORT && typeTag == nme.TypeTag && apply == nme.apply =>
- Some(uref1, name, binding, flags, origin)
- case Apply(TypeApply(Select(uref3 @ Ident(_), typeTag), List(binding)), List(Literal(Constant(null)), _))
- if uref3.name == nme.UNIVERSE_SHORT && typeTag == nme.TypeTag =>
- Some(uref1, name, binding, flags, origin)
- case _ =>
- throw new Error("unsupported free type def: %s%n%s".format(value, showRaw(value)))
- }
+ Some(uref1, name, reifyBinding(tree), flags, origin)
case _ =>
None
}
diff --git a/src/compiler/scala/reflect/reify/utils/StdAttachments.scala b/src/compiler/scala/reflect/reify/utils/StdAttachments.scala
index abbed814e0..0b9cf58c89 100644
--- a/src/compiler/scala/reflect/reify/utils/StdAttachments.scala
+++ b/src/compiler/scala/reflect/reify/utils/StdAttachments.scala
@@ -6,7 +6,13 @@ trait StdAttachments {
import global._
- case class ReifyBindingAttachment(binding: Symbol)
+ case class ReifyBindingAttachment(binding: Tree)
- case class ReifyAliasAttachment(binding: Symbol, alias: TermName)
+ def reifyBinding(tree: Tree): Tree =
+ tree.attachments.get[ReifyBindingAttachment] match {
+ case Some(ReifyBindingAttachment(binding)) => binding
+ case other => Ident(NoSymbol)
+ }
+
+ case class ReifyAliasAttachment(sym: Symbol, alias: TermName)
} \ No newline at end of file
diff --git a/src/compiler/scala/reflect/reify/utils/SymbolTables.scala b/src/compiler/scala/reflect/reify/utils/SymbolTables.scala
index 3892c86dd3..2e17558f54 100644
--- a/src/compiler/scala/reflect/reify/utils/SymbolTables.scala
+++ b/src/compiler/scala/reflect/reify/utils/SymbolTables.scala
@@ -17,6 +17,7 @@ trait SymbolTables {
private[SymbolTable] val original: Option[List[Tree]] = None) {
def syms: List[Symbol] = symtab.keys.toList
+ def isConcrete: Boolean = symtab.values forall (sym => !FreeTypeDef.unapply(sym).isDefined)
// def aliases: Map[Symbol, List[TermName]] = aliases.distinct groupBy (_._1) mapValues (_ map (_._2))
@@ -45,28 +46,27 @@ trait SymbolTables {
def symRef(sym: Symbol): Tree =
symtab.get(sym) match {
- case Some(FreeDef(_, name, _, _, _)) => Ident(name) addAttachment ReifyBindingAttachment(sym)
- case Some(SymDef(_, name, _, _)) => Ident(name) addAttachment ReifyBindingAttachment(sym)
+ case Some(FreeDef(_, name, binding, _, _)) => Ident(name) addAttachment binding
+ case Some(SymDef(_, name, _, _)) => Ident(name) addAttachment ReifyBindingAttachment(Ident(sym))
case None => EmptyTree
}
def +(sym: Symbol, name: TermName, reification: Tree): SymbolTable = add(sym, name, reification)
- def +(sym: Symbol, name: TermName): SymbolTable = add(sym, name)
def +(symDef: Tree): SymbolTable = add(symDef)
def ++(symDefs: TraversableOnce[Tree]): SymbolTable = (this /: symDefs)((symtab, symDef) => symtab.add(symDef))
def ++(symtab: SymbolTable): SymbolTable = { val updated = this ++ symtab.symtab.values; new SymbolTable(updated.symtab, updated.aliases ++ symtab.aliases) }
def -(sym: Symbol): SymbolTable = remove(sym)
def -(name: TermName): SymbolTable = remove(name)
- def -(symDef: Tree): SymbolTable = remove(binding(symDef))
+ def -(symDef: Tree): SymbolTable = remove(reifyBinding(symDef).symbol)
def --(syms: GenTraversableOnce[Symbol]): SymbolTable = (this /: syms)((symtab, sym) => symtab.remove(sym))
def --(names: Iterable[TermName]): SymbolTable = (this /: names)((symtab, name) => symtab.remove(name))
- def --(symDefs: TraversableOnce[Tree]): SymbolTable = this -- (symDefs map (binding(_)))
+ def --(symDefs: TraversableOnce[Tree]): SymbolTable = this -- (symDefs map (reifyBinding(_)))
def --(symtab: SymbolTable): SymbolTable = { val updated = this -- symtab.symtab.values; new SymbolTable(updated.symtab, updated.aliases diff symtab.aliases) }
def filterSyms(p: Symbol => Boolean): SymbolTable = this -- (syms filterNot p)
def filterAliases(p: (Symbol, TermName) => Boolean): SymbolTable = this -- (aliases filterNot (tuple => p(tuple._1, tuple._2)) map (_._2))
private def add(symDef: Tree): SymbolTable = {
- val sym = binding(symDef)
+ val sym = reifyBinding(symDef).symbol
assert(sym != NoSymbol, showRaw(symDef))
val name = symDef match {
case FreeDef(_, name, _, _, _) => name
@@ -85,7 +85,8 @@ trait SymbolTables {
val fresh = typer.context.unit.fresh
newTermName(fresh.newName(name))
}
- add(ValDef(NoMods, freshName(name0), TypeTree(), reification) addAttachment ReifyBindingAttachment(sym))
+ val bindingAttachment = reification.attachments.get[ReifyBindingAttachment].get
+ add(ValDef(NoMods, freshName(name0), TypeTree(), reification) addAttachment bindingAttachment)
}
private def add(sym: Symbol, name: TermName): SymbolTable = {
@@ -115,12 +116,6 @@ trait SymbolTables {
new SymbolTable(newSymtab, newAliases)
}
- private def binding(tree: Tree): Symbol =
- tree.attachments.get[ReifyBindingAttachment] match {
- case Some(ReifyBindingAttachment(binding)) => binding
- case other => NoSymbol
- }
-
private val cache = mutable.Map[SymbolTable, List[Tree]]()
def encode: List[Tree] = cache.getOrElseUpdate(this, SymbolTable.encode(this)) map (_.duplicate)
@@ -147,7 +142,7 @@ trait SymbolTables {
def apply(encoded: List[Tree]): SymbolTable = {
var result = new SymbolTable(original = Some(encoded))
encoded foreach (entry => (entry.attachments.get[ReifyBindingAttachment], entry.attachments.get[ReifyAliasAttachment]) match {
- case (Some(ReifyBindingAttachment(sym)), _) => result += entry
+ case (Some(ReifyBindingAttachment(_)), _) => result += entry
case (_, Some(ReifyAliasAttachment(sym, alias))) => result = new SymbolTable(result.symtab, result.aliases :+ (sym, alias))
case _ => // do nothing, this is boilerplate that can easily be recreated by subsequent `result.encode`
})
@@ -169,30 +164,26 @@ trait SymbolTables {
def fillInSymbol(sym: Symbol): Tree = {
if (reifyDebug) println("Filling in: %s (%s)".format(sym, sym.accurateKindString))
- val isFree = currtab.symName(sym) startsWith nme.REIFY_FREE_PREFIX
- if (isFree) {
- if (sym.annotations.isEmpty) EmptyTree
- else Apply(Select(currtab.symRef(sym), nme.setAnnotations), List(reifier.reify(sym.annotations)))
- } else {
- // SI-6204 don't reify signatures for incomplete symbols, because this might lead to cyclic reference errors
- val signature =
- if (sym.isInitialized) {
- if (sym.isCapturedVariable) capturedVariableType(sym)
- else sym.info
- } else NoType
- val rset = reifier.mirrorBuildCall(nme.setTypeSignature, currtab.symRef(sym), reifier.reify(signature))
- // `Symbol.annotations` doesn't initialize the symbol, so we don't need to do anything special here
- // also since we call `sym.info` a few lines above, by now the symbol will be initialized (if possible)
- // so the annotations will be filled in and will be waiting to be reified (unless symbol initialization is prohibited as described above)
- if (sym.annotations.isEmpty) rset
- else reifier.mirrorBuildCall(nme.setAnnotations, rset, reifier.mkList(sym.annotations map reifier.reifyAnnotationInfo))
- }
+ val isFreeTerm = FreeTermDef.unapply(currtab.symDef(sym)).isDefined
+ // SI-6204 don't reify signatures for incomplete symbols, because this might lead to cyclic reference errors
+ val signature =
+ if (sym.isInitialized) {
+ if (sym.isCapturedVariable) capturedVariableType(sym)
+ else if (isFreeTerm) sym.tpe
+ else sym.info
+ } else NoType
+ val rset = reifier.mirrorBuildCall(nme.setTypeSignature, currtab.symRef(sym), reifier.reify(signature))
+ // `Symbol.annotations` doesn't initialize the symbol, so we don't need to do anything special here
+ // also since we call `sym.info` a few lines above, by now the symbol will be initialized (if possible)
+ // so the annotations will be filled in and will be waiting to be reified (unless symbol initialization is prohibited as described above)
+ if (sym.annotations.isEmpty) rset
+ else reifier.mirrorBuildCall(nme.setAnnotations, rset, reifier.mkList(sym.annotations map reifier.reifyAnnotationInfo))
}
// `fillInSymbol` might add symbols to `symtab`, that's why this is done iteratively
var progress = 0
while (progress < cumulativeSymtab.length) {
- val sym = currtab.binding(cumulativeSymtab(progress))
+ val sym = reifyBinding(cumulativeSymtab(progress)).symbol
if (sym != NoSymbol) {
val symtabProgress = currtab.symtab.size
val aliasesProgress = currtab.aliases.length
@@ -207,7 +198,7 @@ trait SymbolTables {
val withAliases = cumulativeSymtab flatMap (entry => {
val result = mutable.ListBuffer[Tree]()
result += entry
- val sym = currtab.binding(entry)
+ val sym = reifyBinding(entry).symbol
if (sym != NoSymbol)
result ++= cumulativeAliases.distinct filter (alias => alias._1 == sym && alias._2 != currtab.symName(sym)) map (alias => {
val canonicalName = currtab.symName(sym)
diff --git a/src/compiler/scala/tools/nsc/doc/Settings.scala b/src/compiler/scala/tools/nsc/doc/Settings.scala
index dbc34bd7b3..60cd375175 100644
--- a/src/compiler/scala/tools/nsc/doc/Settings.scala
+++ b/src/compiler/scala/tools/nsc/doc/Settings.scala
@@ -257,7 +257,7 @@ class Settings(error: String => Unit, val printMsg: String => Unit = println(_))
("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.WeakTypeTag" -> ((tparam: String) => tparam + " is accompanied by an WeakTypeTag, which is a runtime representation of its type that survives erasure")) +
("scala.reflect.base.TypeTags.TypeTag" -> ((tparam: String) => tparam + " is accompanied by a TypeTag, which is a runtime representation of its type that survives erasure"))
/**
diff --git a/src/compiler/scala/tools/nsc/doc/html/SyntaxHigh.scala b/src/compiler/scala/tools/nsc/doc/html/SyntaxHigh.scala
index f1eab841f9..9b0765e394 100644
--- a/src/compiler/scala/tools/nsc/doc/html/SyntaxHigh.scala
+++ b/src/compiler/scala/tools/nsc/doc/html/SyntaxHigh.scala
@@ -40,7 +40,7 @@ private[html] object SyntaxHigh {
/** Standard library classes/objects, sorted alphabetically */
val standards = Array (
- "AbsTypeTag", "Any", "AnyRef", "AnyVal", "App", "Application", "Array",
+ "WeakTypeTag", "Any", "AnyRef", "AnyVal", "App", "Application", "Array",
"Boolean", "Byte", "Char", "Class", "ClassTag", "ClassManifest",
"Console", "Double", "Enumeration", "Float", "Function", "Int",
"List", "Long", "Manifest", "Map",
diff --git a/src/compiler/scala/tools/nsc/interpreter/ReplVals.scala b/src/compiler/scala/tools/nsc/interpreter/ReplVals.scala
index 5b8e4c3d92..cb10de7dca 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 # AbsTypeTag[_]): Global#Type =
+ def compilerTypeFromTag(t: BaseUniverse # WeakTypeTag[_]): Global#Type =
definitions.compilerTypeFromTag(t)
class AppliedTypeFromTags(sym: Symbol) {
diff --git a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
index 49ace019b9..bbeb549289 100644
--- a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
@@ -738,7 +738,7 @@ trait ContextErrors {
)
val forgotten = (
if (sym.isTerm) "splice when splicing this variable into a reifee"
- else "c.AbsTypeTag annotation for this type parameter"
+ else "c.WeakTypeTag annotation for this type parameter"
)
macroExpansionError(expandee, template(sym.name.nameKind).format(sym.name + " " + sym.origin, forgotten))
}
@@ -1234,7 +1234,7 @@ trait ContextErrors {
message + suffix
}
- private def abbreviateCoreAliases(s: String): String = List("AbsTypeTag", "Expr").foldLeft(s)((res, x) => res.replace("c.universe." + x, "c." + x))
+ private def abbreviateCoreAliases(s: String): String = List("WeakTypeTag", "Expr").foldLeft(s)((res, x) => res.replace("c.universe." + x, "c." + x))
private def showMeth(pss: List[List[Symbol]], restpe: Type, abbreviate: Boolean) = {
var argsPart = (pss map (ps => ps map (_.defString) mkString ("(", ", ", ")"))).mkString
@@ -1313,7 +1313,7 @@ trait ContextErrors {
// aXXX (e.g. aparams) => characteristics of the macro impl ("a" stands for "actual")
// rXXX (e.g. rparams) => characteristics of a reference macro impl signature synthesized from the macro def ("r" stands for "reference")
- def MacroImplNonTagImplicitParameters(params: List[Symbol]) = compatibilityError("macro implementations cannot have implicit parameters other than AbsTypeTag evidences")
+ def MacroImplNonTagImplicitParameters(params: List[Symbol]) = compatibilityError("macro implementations cannot have implicit parameters other than WeakTypeTag evidences")
def MacroImplParamssMismatchError() = compatibilityError("number of parameter sections differ")
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
index 6a91922b4c..08978ef4b5 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
@@ -1151,7 +1151,7 @@ trait Implicits {
private def TagSymbols = TagMaterializers.keySet
private val TagMaterializers = Map[Symbol, Symbol](
ClassTagClass -> MacroInternal_materializeClassTag,
- AbsTypeTagClass -> MacroInternal_materializeAbsTypeTag,
+ WeakTypeTagClass -> MacroInternal_materializeWeakTypeTag,
TypeTagClass -> MacroInternal_materializeTypeTag
)
diff --git a/src/compiler/scala/tools/nsc/typechecker/Macros.scala b/src/compiler/scala/tools/nsc/typechecker/Macros.scala
index 59935677a8..27a88a3683 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Macros.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Macros.scala
@@ -26,7 +26,7 @@ import scala.reflect.macros.runtime.AbortMacroException
*
* Then fooBar needs to point to a static method of the following form:
*
- * def fooBar[T: c.AbsTypeTag] // type tag annotation is optional
+ * def fooBar[T: c.WeakTypeTag] // type tag annotation is optional
* (c: scala.reflect.macros.Context)
* (xs: c.Expr[List[T]])
* : c.Expr[T] = {
@@ -84,7 +84,7 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces {
val methName: String,
// flattens the macro impl's parameter lists having symbols replaced with metadata
// currently metadata is an index of the type parameter corresponding to that type tag (if applicable)
- // f.ex. for: def impl[T: AbsTypeTag, U: AbsTypeTag, V](c: Context)(x: c.Expr[T]): (U, V) = ???
+ // f.ex. for: def impl[T: WeakTypeTag, U: WeakTypeTag, V](c: Context)(x: c.Expr[T]): (U, V) = ???
// `signature` will be equal to List(-1, -1, 0, 1)
val signature: List[Int],
// type arguments part of a macro impl ref (the right-hand side of a macro definition)
@@ -216,7 +216,7 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces {
}
/** Transforms parameters lists of a macro impl.
- * The `transform` function is invoked only for AbsTypeTag evidence parameters.
+ * The `transform` function is invoked only for WeakTypeTag evidence parameters.
*
* The transformer takes two arguments: a value parameter from the parameter list
* and a type parameter that is witnesses by the value parameter.
@@ -232,7 +232,7 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces {
if (paramss.isEmpty || paramss.last.isEmpty) return paramss // no implicit parameters in the signature => nothing to do
if (paramss.head.isEmpty || !(paramss.head.head.tpe <:< MacroContextClass.tpe)) return paramss // no context parameter in the signature => nothing to do
def transformTag(param: Symbol): Symbol = param.tpe.dealias match {
- case TypeRef(SingleType(SingleType(NoPrefix, c), universe), AbsTypeTagClass, targ :: Nil)
+ case TypeRef(SingleType(SingleType(NoPrefix, c), universe), WeakTypeTagClass, targ :: Nil)
if c == paramss.head.head && universe == MacroContextUniverse =>
transform(param, targ.typeSymbol)
case _ =>
@@ -336,7 +336,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.AbsTypeTag else tpnme.Expr)
+ val tsym = getMember(MacroContextClass, if (isType) tpnme.WeakTypeTag else tpnme.Expr)
typeRef(singleType(NoPrefix, ctxParam), tsym, List(sigma(origTpe)))
}
val paramCache = collection.mutable.Map[Symbol, Symbol]()
@@ -630,7 +630,7 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces {
macroDef.owner)
} else
targ.tpe
- context.AbsTypeTag(tpe)
+ context.WeakTypeTag(tpe)
})
macroTraceVerbose("tags: ")(tags)
@@ -872,13 +872,13 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces {
new Transformer {
override def transform(tree: Tree) = super.transform(tree match {
// todo. expansion should work from the inside out
- case wannabe if (delayed contains wannabe) && calculateUndetparams(wannabe).isEmpty =>
- val context = wannabe.attachments.get[MacroRuntimeAttachment].get.typerContext
- delayed -= wannabe
+ case tree if (delayed contains tree) && calculateUndetparams(tree).isEmpty =>
+ val context = tree.attachments.get[MacroRuntimeAttachment].get.typerContext
+ delayed -= tree
context.implicitsEnabled = typer.context.implicitsEnabled
context.enrichmentEnabled = typer.context.enrichmentEnabled
context.macrosEnabled = typer.context.macrosEnabled
- macroExpand(newTyper(context), wannabe, EXPRmode, WildcardType)
+ macroExpand(newTyper(context), tree, EXPRmode, WildcardType)
case _ =>
tree
})
diff --git a/src/compiler/scala/tools/nsc/typechecker/Tags.scala b/src/compiler/scala/tools/nsc/typechecker/Tags.scala
index f82e009be8..167bf5c857 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 `AbsTypeTag` is for `TypeTag`.
+ * Once upon a time, we had an `ErasureTag` which was to `ClassTag` the same that `WeakTypeTag` 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 an AbsTypeTag (if `concrete` is false) or a TypeTag (if `concrete` is true).
+ /** Finds in scope or materializes an WeakTypeTag (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) TypeTagClass else AbsTypeTagClass
+ val tagSym = if (concrete) TypeTagClass else WeakTypeTagClass
val tagTp = if (pre == NoType) TypeRef(BaseUniverseClass.toTypeConstructor, 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 07c972899e..d6bed0c6d1 100644
--- a/src/compiler/scala/tools/reflect/FastTrack.scala
+++ b/src/compiler/scala/tools/reflect/FastTrack.scala
@@ -23,7 +23,7 @@ trait FastTrack {
def validate(c: MacroContext): Boolean = expander.isDefinedAt((c, c.expandee))
def run(c: MacroContext): Any = {
val result = expander((c, c.expandee))
- c.Expr[Nothing](result)(c.AbsTypeTag.Nothing)
+ c.Expr[Nothing](result)(c.WeakTypeTag.Nothing)
}
}
@@ -31,7 +31,7 @@ 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_materializeAbsTypeTag bindTo { case (c, Apply(TypeApply(_, List(tt)), List(u))) => c.materializeTypeTag(u, EmptyTree, tt.tpe, concrete = false) }
+ MacroInternal_materializeWeakTypeTag 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) }
BaseUniverseReify bindTo { case (c, Apply(TypeApply(_, List(tt)), List(expr))) => c.materializeExpr(c.prefix.tree, EmptyTree, expr) }
ReflectRuntimeCurrentMirror bindTo { case (c, _) => scala.reflect.runtime.Macros.currentMirror(c).tree }
diff --git a/src/library/scala/reflect/base/Base.scala b/src/library/scala/reflect/base/Base.scala
index 28ebdf4377..6f90d598f9 100644
--- a/src/library/scala/reflect/base/Base.scala
+++ b/src/library/scala/reflect/base/Base.scala
@@ -36,10 +36,10 @@ class Base extends Universe { self =>
def newClassSymbol(name: TypeName, pos: Position = NoPosition, flags: FlagSet = NoFlags): ClassSymbol =
new ClassSymbol(this, name, flags)
- def newFreeTermSymbol(name: TermName, info: Type, value: => Any, flags: FlagSet = NoFlags, origin: String = null) =
+ def newFreeTermSymbol(name: TermName, value: => Any, flags: FlagSet = NoFlags, origin: String = null) =
new FreeTermSymbol(this, name, flags)
- def newFreeTypeSymbol(name: TypeName, info: Type, value: => Any, flags: FlagSet = NoFlags, origin: String = null) =
+ def newFreeTypeSymbol(name: TypeName, flags: FlagSet = NoFlags, origin: String = null) =
new FreeTypeSymbol(this, name, flags)
private def kindString: String =
@@ -311,13 +311,10 @@ class Base extends Universe { self =>
else new TypeSymbol(owner, name.toTypeName, flags)
else new TermSymbol(owner, name.toTermName, flags)
- def newFreeTerm(name: String, info: Type, value: => Any, flags: Long = 0L, origin: String = null): FreeTermSymbol =
+ def newFreeTerm(name: String, value: => Any, flags: Long = 0L, origin: String = null): FreeTermSymbol =
new FreeTermSymbol(rootMirror.RootClass, newTermName(name), flags)
- def newFreeType(name: String, info: Type, value: => Any, flags: Long = 0L, origin: String = null): FreeTypeSymbol =
- new FreeTypeSymbol(rootMirror.RootClass, newTypeName(name), flags)
-
- def newFreeExistential(name: String, info: Type, value: => Any, flags: Long = 0L, origin: String = null): FreeTypeSymbol =
+ def newFreeType(name: String, flags: Long = 0L, origin: String = null): FreeTypeSymbol =
new FreeTypeSymbol(rootMirror.RootClass, newTypeName(name), flags)
def setTypeSignature[S <: Symbol](sym: S, tpe: Type): S = sym
diff --git a/src/library/scala/reflect/base/BuildUtils.scala b/src/library/scala/reflect/base/BuildUtils.scala
index 98f32231ad..c4231dd515 100644
--- a/src/library/scala/reflect/base/BuildUtils.scala
+++ b/src/library/scala/reflect/base/BuildUtils.scala
@@ -29,36 +29,18 @@ trait BuildUtils { self: Universe =>
/** Create a fresh free term symbol.
* @param name the name of the free variable
- * @param info the type signature of the free variable
* @param value the value of the free variable at runtime
* @param flags (optional) flags of the free variable
* @param origin debug information that tells where this symbol comes from
*/
- def newFreeTerm(name: String, info: Type, value: => Any, flags: FlagSet = NoFlags, origin: String = null): FreeTermSymbol
+ def newFreeTerm(name: String, value: => Any, flags: FlagSet = NoFlags, origin: String = null): FreeTermSymbol
- /** Create a fresh free non-existential type symbol.
+ /** Create a fresh free type symbol.
* @param name the name of the free variable
- * @param info the type signature of the free variable
- * @param value a type tag that captures the value of the free variable
- * is completely phantom, since the captured type cannot be propagated to the runtime
- * if it could be, we wouldn't be creating a free type to begin with
- * the only usage for it is preserving the captured symbol for compile-time analysis
* @param flags (optional) flags of the free variable
* @param origin debug information that tells where this symbol comes from
*/
- def newFreeType(name: String, info: Type, value: => Any, flags: FlagSet = NoFlags, origin: String = null): FreeTypeSymbol
-
- /** Create a fresh free existential type symbol.
- * @param name the name of the free variable
- * @param info the type signature of the free variable
- * @param value a type tag that captures the value of the free variable
- * is completely phantom, since the captured type cannot be propagated to the runtime
- * if it could be, we wouldn't be creating a free type to begin with
- * the only usage for it is preserving the captured symbol for compile-time analysis
- * @param flags (optional) flags of the free variable
- * @param origin (optional) debug information that tells where this symbol comes from
- */
- def newFreeExistential(name: String, info: Type, value: => Any, flags: FlagSet = NoFlags, origin: String = null): FreeTypeSymbol
+ def newFreeType(name: String, flags: FlagSet = NoFlags, origin: String = null): FreeTypeSymbol
/** Set symbol's type signature to given type.
* @return the symbol itself
diff --git a/src/library/scala/reflect/base/Exprs.scala b/src/library/scala/reflect/base/Exprs.scala
index 10c222722a..45598c03e2 100644
--- a/src/library/scala/reflect/base/Exprs.scala
+++ b/src/library/scala/reflect/base/Exprs.scala
@@ -28,19 +28,19 @@ trait Exprs { self: Universe =>
}
object Expr {
- def apply[T: AbsTypeTag](mirror: MirrorOf[self.type], treec: TreeCreator): Expr[T] = new ExprImpl[T](mirror.asInstanceOf[Mirror], treec)
+ def apply[T: WeakTypeTag](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: AbsTypeTag](val mirror: Mirror, val treec: TreeCreator) extends Expr[T] {
+ private class ExprImpl[+T: WeakTypeTag](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[AbsTypeTag[T]] in otherMirror).asInstanceOf[otherMirror.universe.AbsTypeTag[T]]
+ val tag1 = (implicitly[WeakTypeTag[T]] in otherMirror).asInstanceOf[otherMirror.universe.WeakTypeTag[T]]
otherMirror.universe.Expr[T](otherMirror1, treec)(tag1)
}
lazy val tree: Tree = treec(mirror)
- lazy val staticType: Type = implicitly[AbsTypeTag[T]].tpe
+ lazy val staticType: Type = implicitly[WeakTypeTag[T]].tpe
def actualType: Type = treeType(tree)
def splice: T = throw new UnsupportedOperationException("""
@@ -54,11 +54,11 @@ trait Exprs { self: Universe =>
|if you want to get a value of the underlying expression, add scala-compiler.jar to the classpath,
|import `scala.tools.reflect.Eval` and call `<your expr>.eval` instead.""".trim.stripMargin)
- private def writeReplace(): AnyRef = new SerializedExpr(treec, implicitly[AbsTypeTag[T]].in(scala.reflect.basis.rootMirror))
+ private def writeReplace(): AnyRef = new SerializedExpr(treec, implicitly[WeakTypeTag[T]].in(scala.reflect.basis.rootMirror))
}
}
-private[scala] class SerializedExpr(var treec: TreeCreator, var tag: scala.reflect.basis.AbsTypeTag[_]) extends Serializable {
+private[scala] class SerializedExpr(var treec: TreeCreator, var tag: scala.reflect.basis.WeakTypeTag[_]) extends Serializable {
private def writeObject(out: java.io.ObjectOutputStream): Unit = {
out.writeObject(treec)
out.writeObject(tag)
@@ -66,7 +66,7 @@ private[scala] class SerializedExpr(var treec: TreeCreator, var tag: scala.refle
private def readObject(in: java.io.ObjectInputStream): Unit = {
treec = in.readObject().asInstanceOf[TreeCreator]
- tag = in.readObject().asInstanceOf[scala.reflect.basis.AbsTypeTag[_]]
+ tag = in.readObject().asInstanceOf[scala.reflect.basis.WeakTypeTag[_]]
}
private def readResolve(): AnyRef = {
diff --git a/src/library/scala/reflect/base/TypeTags.scala b/src/library/scala/reflect/base/TypeTags.scala
index b7e0c37a4b..37e0c4f02f 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#AbsTypeTag]].
+ * [[scala.reflect.ClassTag]], [[scala.reflect.base.Universe#TypeTag]] and [[scala.reflect.base.Universe#WeakTypeTag]].
*
* 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#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]]
+ * A [[scala.reflect.base.Universe#WeakTypeTag]] value wraps a full Scala type in its tpe field.
+ * A [[scala.reflect.base.Universe#TypeTag]] value is an [[scala.reflect.base.Universe#WeakTypeTag]]
* 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,36 +40,36 @@ import language.implicitConversions
* import reflect.mirror._
* def f[T: TypeTag, U] = {
* type L = T => U
- * implicitly[AbsTypeTag[L]]
+ * implicitly[WeakTypeTag[L]]
* }
*
* Then a call of f[String, Int] will yield a result of the form
*
- * AbsTypeTag(<[ String => U ]>).
+ * WeakTypeTag(<[ 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.
*
- * === AbsTypeTag vs TypeTag ===
+ * === WeakTypeTag vs TypeTag ===
*
- * Be careful with AbsTypeTag, because it will reify types even if these types are abstract.
+ * Be careful with WeakTypeTag, 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: AbsTypeTag](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: WeakTypeTag](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: AbsTypeTag](name: String, x: T): NamedParam = apply(name, x)
- * def apply[T: AbsTypeTag](name: String, x: T): NamedParam = new Typed[T](name, x)
+ * implicit def namedValue[T: WeakTypeTag](name: String, x: T): NamedParam = apply(name, x)
+ * def apply[T: WeakTypeTag](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#AbsTypeTag]] here is reasonable, because it is desirable
+ * into the heart of the REPL. Using a [[scala.reflect.base.Universe#WeakTypeTag]] 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 `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.
+ * However if any of the three `WeakTypeTag` context bounds is omitted, the resulting code will be incorrect,
+ * because the missing `WeakTypeTag` will be transparently generated by the compiler, carrying meaningless information.
* Most likely, this problem will manifest itself elsewhere, making debugging complicated.
- * If `AbsTypeTag` context bounds were replaced with `TypeTag`, then such errors would be reported statically.
+ * If `WeakTypeTag` 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 ===
@@ -104,71 +104,71 @@ trait TypeTags { self: Universe =>
import definitions._
/**
- * If an implicit value of type u.AbsTypeTag[T] is required, the compiler will make one up on demand.
+ * If an implicit value of type u.WeakTypeTag[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 AbsTypeTag available for ${T}")
- trait AbsTypeTag[T] extends Equals with Serializable {
+ @annotation.implicitNotFound(msg = "No WeakTypeTag available for ${T}")
+ trait WeakTypeTag[T] extends Equals with Serializable {
val mirror: Mirror
- def in[U <: Universe with Singleton](otherMirror: MirrorOf[U]): U # AbsTypeTag[T]
+ def in[U <: Universe with Singleton](otherMirror: MirrorOf[U]): U # WeakTypeTag[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 canEqual(x: Any) = x.isInstanceOf[WeakTypeTag[_]]
+ override def equals(x: Any) = x.isInstanceOf[WeakTypeTag[_]] && this.mirror == x.asInstanceOf[WeakTypeTag[_]].mirror && this.tpe == x.asInstanceOf[WeakTypeTag[_]].tpe
override def hashCode = mirror.hashCode * 31 + tpe.hashCode
- override def toString = "AbsTypeTag[" + tpe + "]"
+ override def toString = "WeakTypeTag[" + 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 AnyVal : AbsTypeTag[scala.AnyVal] = TypeTag.AnyVal
- val AnyRef : AbsTypeTag[scala.AnyRef] = TypeTag.AnyRef
- val Object : AbsTypeTag[java.lang.Object] = TypeTag.Object
- val Nothing : AbsTypeTag[scala.Nothing] = TypeTag.Nothing
- val Null : AbsTypeTag[scala.Null] = TypeTag.Null
+ object WeakTypeTag {
+ val Byte : WeakTypeTag[scala.Byte] = TypeTag.Byte
+ val Short : WeakTypeTag[scala.Short] = TypeTag.Short
+ val Char : WeakTypeTag[scala.Char] = TypeTag.Char
+ val Int : WeakTypeTag[scala.Int] = TypeTag.Int
+ val Long : WeakTypeTag[scala.Long] = TypeTag.Long
+ val Float : WeakTypeTag[scala.Float] = TypeTag.Float
+ val Double : WeakTypeTag[scala.Double] = TypeTag.Double
+ val Boolean : WeakTypeTag[scala.Boolean] = TypeTag.Boolean
+ val Unit : WeakTypeTag[scala.Unit] = TypeTag.Unit
+ val Any : WeakTypeTag[scala.Any] = TypeTag.Any
+ val AnyVal : WeakTypeTag[scala.AnyVal] = TypeTag.AnyVal
+ val AnyRef : WeakTypeTag[scala.AnyRef] = TypeTag.AnyRef
+ val Object : WeakTypeTag[java.lang.Object] = TypeTag.Object
+ val Nothing : WeakTypeTag[scala.Nothing] = TypeTag.Nothing
+ val Null : WeakTypeTag[scala.Null] = TypeTag.Null
- def apply[T](mirror1: MirrorOf[self.type], tpec1: TypeCreator): AbsTypeTag[T] =
+ def apply[T](mirror1: MirrorOf[self.type], tpec1: TypeCreator): WeakTypeTag[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 AnyValTpe => AbsTypeTag.AnyVal.asInstanceOf[AbsTypeTag[T]]
- case AnyRefTpe => AbsTypeTag.AnyRef.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 _ => new AbsTypeTagImpl[T](mirror1.asInstanceOf[Mirror], tpec1)
+ case ByteTpe => WeakTypeTag.Byte.asInstanceOf[WeakTypeTag[T]]
+ case ShortTpe => WeakTypeTag.Short.asInstanceOf[WeakTypeTag[T]]
+ case CharTpe => WeakTypeTag.Char.asInstanceOf[WeakTypeTag[T]]
+ case IntTpe => WeakTypeTag.Int.asInstanceOf[WeakTypeTag[T]]
+ case LongTpe => WeakTypeTag.Long.asInstanceOf[WeakTypeTag[T]]
+ case FloatTpe => WeakTypeTag.Float.asInstanceOf[WeakTypeTag[T]]
+ case DoubleTpe => WeakTypeTag.Double.asInstanceOf[WeakTypeTag[T]]
+ case BooleanTpe => WeakTypeTag.Boolean.asInstanceOf[WeakTypeTag[T]]
+ case UnitTpe => WeakTypeTag.Unit.asInstanceOf[WeakTypeTag[T]]
+ case AnyTpe => WeakTypeTag.Any.asInstanceOf[WeakTypeTag[T]]
+ case AnyValTpe => WeakTypeTag.AnyVal.asInstanceOf[WeakTypeTag[T]]
+ case AnyRefTpe => WeakTypeTag.AnyRef.asInstanceOf[WeakTypeTag[T]]
+ case ObjectTpe => WeakTypeTag.Object.asInstanceOf[WeakTypeTag[T]]
+ case NothingTpe => WeakTypeTag.Nothing.asInstanceOf[WeakTypeTag[T]]
+ case NullTpe => WeakTypeTag.Null.asInstanceOf[WeakTypeTag[T]]
+ case _ => new WeakTypeTagImpl[T](mirror1.asInstanceOf[Mirror], tpec1)
}
- def unapply[T](ttag: AbsTypeTag[T]): Option[Type] = Some(ttag.tpe)
+ def unapply[T](ttag: WeakTypeTag[T]): Option[Type] = Some(ttag.tpe)
}
- private class AbsTypeTagImpl[T](val mirror: Mirror, val tpec: TypeCreator) extends AbsTypeTag[T] {
+ private class WeakTypeTagImpl[T](val mirror: Mirror, val tpec: TypeCreator) extends WeakTypeTag[T] {
lazy val tpe: Type = tpec(mirror)
- def in[U <: Universe with Singleton](otherMirror: MirrorOf[U]): U # AbsTypeTag[T] = {
+ def in[U <: Universe with Singleton](otherMirror: MirrorOf[U]): U # WeakTypeTag[T] = {
val otherMirror1 = otherMirror.asInstanceOf[MirrorOf[otherMirror.universe.type]]
- otherMirror.universe.AbsTypeTag[T](otherMirror1, tpec)
+ otherMirror.universe.WeakTypeTag[T](otherMirror1, tpec)
}
private def writeReplace(): AnyRef = new SerializedTypeTag(tpec, concrete = false)
}
@@ -180,7 +180,7 @@ trait TypeTags { self: Universe =>
* @see [[scala.reflect.base.TypeTags]]
*/
@annotation.implicitNotFound(msg = "No TypeTag available for ${T}")
- trait TypeTag[T] extends AbsTypeTag[T] with Equals with Serializable {
+ trait TypeTag[T] extends WeakTypeTag[T] with Equals with Serializable {
override def in[U <: Universe with Singleton](otherMirror: MirrorOf[U]): U # TypeTag[T]
/** case class accessories */
@@ -230,7 +230,7 @@ trait TypeTags { self: Universe =>
def unapply[T](ttag: TypeTag[T]): Option[Type] = Some(ttag.tpe)
}
- private class TypeTagImpl[T](mirror: Mirror, tpec: TypeCreator) extends AbsTypeTagImpl[T](mirror, tpec) with TypeTag[T] {
+ private class TypeTagImpl[T](mirror: Mirror, tpec: TypeCreator) extends WeakTypeTagImpl[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.TypeTag[T](otherMirror1, tpec)
@@ -250,11 +250,11 @@ trait TypeTags { self: Universe =>
}
// incantations
- def absTypeTag[T](implicit attag: AbsTypeTag[T]) = attag
+ def weakTypeTag[T](implicit attag: WeakTypeTag[T]) = attag
def typeTag[T](implicit ttag: TypeTag[T]) = ttag
// big thanks to Viktor Klang for this brilliant idea!
- def absTypeOf[T](implicit attag: AbsTypeTag[T]): Type = attag.tpe
+ def weakTypeOf[T](implicit attag: WeakTypeTag[T]): Type = attag.tpe
def typeOf[T](implicit ttag: TypeTag[T]): Type = ttag.tpe
}
@@ -272,6 +272,6 @@ private[scala] class SerializedTypeTag(var tpec: TypeCreator, var concrete: Bool
private def readResolve(): AnyRef = {
import scala.reflect.basis._
if (concrete) TypeTag(rootMirror, tpec)
- else AbsTypeTag(rootMirror, tpec)
+ else WeakTypeTag(rootMirror, tpec)
}
} \ No newline at end of file
diff --git a/src/library/scala/reflect/base/Universe.scala b/src/library/scala/reflect/base/Universe.scala
index f098876c18..18599ad092 100644
--- a/src/library/scala/reflect/base/Universe.scala
+++ b/src/library/scala/reflect/base/Universe.scala
@@ -46,7 +46,7 @@ abstract class Universe extends Symbols
* def macroImpl[T](c: Context) = {
* ...
* // T here is just a type parameter, so the tree produced by reify won't be of much use in a macro expansion
- * // however, if T were annotated with c.AbsTypeTag (which would declare an implicit parameter for macroImpl)
+ * // however, if T were annotated with c.WeakTypeTag (which would declare an implicit parameter for macroImpl)
* // then reification would substitute T with the TypeTree that was used in a TypeApply of this particular macro invocation
* val factory = c.reify{ new Queryable[T] }
* ...
diff --git a/src/library/scala/reflect/macros/internal/package.scala b/src/library/scala/reflect/macros/internal/package.scala
index 0a0e6c5b51..aca2b765f1 100644
--- a/src/library/scala/reflect/macros/internal/package.scala
+++ b/src/library/scala/reflect/macros/internal/package.scala
@@ -8,6 +8,6 @@ import scala.reflect.ClassTag
// todo. once we have implicit macros for tag generation, we can remove these anchors
package object internal {
private[scala] def materializeClassTag[T](u: BaseUniverse): ClassTag[T] = ??? // macro
- private[scala] def materializeAbsTypeTag[T](u: BaseUniverse): u.AbsTypeTag[T] = ??? // macro
+ private[scala] def materializeWeakTypeTag[T](u: BaseUniverse): u.WeakTypeTag[T] = ??? // macro
private[scala] def materializeTypeTag[T](u: BaseUniverse): u.TypeTag[T] = ??? // macro
}
diff --git a/src/reflect/scala/reflect/internal/BuildUtils.scala b/src/reflect/scala/reflect/internal/BuildUtils.scala
index 74b9442076..f7371f4180 100644
--- a/src/reflect/scala/reflect/internal/BuildUtils.scala
+++ b/src/reflect/scala/reflect/internal/BuildUtils.scala
@@ -30,14 +30,11 @@ trait BuildUtils extends base.BuildUtils { self: SymbolTable =>
else MissingRequirementError.notFound("overloaded method %s #%d in %s".format(name, index, owner.fullName))
}
- def newFreeTerm(name: String, info: Type, value: => Any, flags: Long = 0L, origin: String = null): FreeTermSymbol =
- newFreeTermSymbol(newTermName(name), info, value, flags, origin)
+ def newFreeTerm(name: String, value: => Any, flags: Long = 0L, origin: String = null): FreeTermSymbol =
+ newFreeTermSymbol(newTermName(name), value, flags, origin)
- def newFreeType(name: String, info: Type, value: => Any, flags: Long = 0L, origin: String = null): FreeTypeSymbol =
- newFreeTypeSymbol(newTypeName(name), info, value, (if (flags == 0L) PARAM else flags) | DEFERRED, origin)
-
- def newFreeExistential(name: String, info: Type, value: => Any, flags: Long = 0L, origin: String = null): FreeTypeSymbol =
- newFreeTypeSymbol(newTypeName(name), info, value, (if (flags == 0L) EXISTENTIAL else flags) | DEFERRED, origin)
+ def newFreeType(name: String, flags: Long = 0L, origin: String = null): FreeTypeSymbol =
+ newFreeTypeSymbol(newTypeName(name), flags, origin)
def newNestedSymbol(owner: Symbol, name: Name, pos: Position, flags: Long, isClass: Boolean): Symbol =
owner.newNestedSymbol(name, pos, flags, isClass)
diff --git a/src/reflect/scala/reflect/internal/Definitions.scala b/src/reflect/scala/reflect/internal/Definitions.scala
index 15b74058b7..6d9f68a8a5 100644
--- a/src/reflect/scala/reflect/internal/Definitions.scala
+++ b/src/reflect/scala/reflect/internal/Definitions.scala
@@ -505,8 +505,8 @@ 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 WeakTypeTagClass = getMemberClass(TypeTagsClass, tpnme.WeakTypeTag)
+ lazy val WeakTypeTagModule = getMemberModule(TypeTagsClass, nme.WeakTypeTag)
lazy val TypeTagClass = getMemberClass(TypeTagsClass, tpnme.TypeTag)
lazy val TypeTagModule = getMemberModule(TypeTagsClass, nme.TypeTag)
@@ -527,7 +527,7 @@ trait Definitions extends api.StandardDefinitions {
lazy val MacroImplAnnotation = requiredClass[scala.reflect.macros.internal.macroImpl]
lazy val MacroInternalPackage = getPackageObject("scala.reflect.macros.internal")
def MacroInternal_materializeClassTag = getMemberMethod(MacroInternalPackage, nme.materializeClassTag)
- def MacroInternal_materializeAbsTypeTag = getMemberMethod(MacroInternalPackage, nme.materializeAbsTypeTag)
+ def MacroInternal_materializeWeakTypeTag = getMemberMethod(MacroInternalPackage, nme.materializeWeakTypeTag)
def MacroInternal_materializeTypeTag = getMemberMethod(MacroInternalPackage, nme.materializeTypeTag)
lazy val StringContextClass = requiredClass[scala.StringContext]
@@ -542,8 +542,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 # AbsTypeTag[_]): Type = tt.in(rootMirror).tpe
- def compilerSymbolFromTag(tt: BaseUniverse # AbsTypeTag[_]): Symbol = tt.in(rootMirror).tpe.typeSymbol
+ def compilerTypeFromTag(tt: BaseUniverse # WeakTypeTag[_]): Type = tt.in(rootMirror).tpe
+ def compilerSymbolFromTag(tt: BaseUniverse # WeakTypeTag[_]): 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/Importers.scala b/src/reflect/scala/reflect/internal/Importers.scala
index 4b3eb0cdc4..87058df732 100644
--- a/src/reflect/scala/reflect/internal/Importers.scala
+++ b/src/reflect/scala/reflect/internal/Importers.scala
@@ -72,9 +72,9 @@ trait Importers extends api.Importers { self: SymbolTable =>
case x: from.ModuleSymbol =>
linkReferenced(myowner.newModuleSymbol(myname, mypos, myflags), x, importSymbol)
case x: from.FreeTermSymbol =>
- newFreeTermSymbol(importName(x.name).toTermName, importType(x.info), x.value, x.flags, x.origin)
+ newFreeTermSymbol(importName(x.name).toTermName, x.value, x.flags, x.origin) setInfo importType(x.info)
case x: from.FreeTypeSymbol =>
- newFreeTypeSymbol(importName(x.name).toTypeName, importType(x.info), x.value, x.flags, x.origin)
+ newFreeTypeSymbol(importName(x.name).toTypeName, x.flags, x.origin)
case x: from.TermSymbol =>
linkReferenced(myowner.newValue(myname, mypos, myflags), x, importSymbol)
case x: from.TypeSkolem =>
diff --git a/src/reflect/scala/reflect/internal/StdNames.scala b/src/reflect/scala/reflect/internal/StdNames.scala
index f63e2602b1..92adc85e25 100644
--- a/src/reflect/scala/reflect/internal/StdNames.scala
+++ b/src/reflect/scala/reflect/internal/StdNames.scala
@@ -131,7 +131,7 @@ trait StdNames {
final val Seq: NameType = "Seq"
final val Symbol: NameType = "Symbol"
final val ClassTag: NameType = "ClassTag"
- final val AbsTypeTag: NameType = "AbsTypeTag"
+ final val WeakTypeTag: NameType = "WeakTypeTag"
final val TypeTag : NameType = "TypeTag"
final val Expr: NameType = "Expr"
final val String: NameType = "String"
@@ -704,14 +704,13 @@ trait StdNames {
val manifestToTypeTag: NameType = "manifestToTypeTag"
val map: NameType = "map"
val materializeClassTag: NameType = "materializeClassTag"
- val materializeAbsTypeTag: NameType = "materializeAbsTypeTag"
+ val materializeWeakTypeTag: NameType = "materializeWeakTypeTag"
val materializeTypeTag: NameType = "materializeTypeTag"
val mirror : NameType = "mirror"
val moduleClass : NameType = "moduleClass"
val name: NameType = "name"
val ne: NameType = "ne"
val newArray: NameType = "newArray"
- val newFreeExistential: NameType = "newFreeExistential"
val newFreeTerm: NameType = "newFreeTerm"
val newFreeType: NameType = "newFreeType"
val newNestedSymbol: NameType = "newNestedSymbol"
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala
index b1e81de037..430cf58a54 100644
--- a/src/reflect/scala/reflect/internal/Symbols.scala
+++ b/src/reflect/scala/reflect/internal/Symbols.scala
@@ -48,13 +48,13 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
/** Create a new free term. Its owner is NoSymbol.
*/
- def newFreeTermSymbol(name: TermName, info: Type, value: => Any, flags: Long = 0L, origin: String): FreeTermSymbol =
- new FreeTermSymbol(name, value, origin) initFlags flags setInfo info
+ def newFreeTermSymbol(name: TermName, value: => Any, flags: Long = 0L, origin: String): FreeTermSymbol =
+ new FreeTermSymbol(name, value, origin) initFlags flags
/** Create a new free type. Its owner is NoSymbol.
*/
- def newFreeTypeSymbol(name: TypeName, info: Type, value: => Any, flags: Long = 0L, origin: String): FreeTypeSymbol =
- new FreeTypeSymbol(name, value, origin) initFlags flags setInfo info
+ def newFreeTypeSymbol(name: TypeName, flags: Long = 0L, origin: String): FreeTypeSymbol =
+ new FreeTypeSymbol(name, origin) initFlags flags
/** The original owner of a class. Used by the backend to generate
* EnclosingMethod attributes.
@@ -3080,9 +3080,7 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
}
implicit val FreeTermSymbolTag = ClassTag[FreeTermSymbol](classOf[FreeTermSymbol])
- class FreeTypeSymbol(name0: TypeName, value0: => Any, val origin: String) extends TypeSkolem(NoSymbol, NoPosition, name0, NoSymbol) with FreeSymbol with FreeTypeSymbolApi {
- def value = value0
- }
+ class FreeTypeSymbol(name0: TypeName, val origin: String) extends TypeSkolem(NoSymbol, NoPosition, name0, NoSymbol) with FreeSymbol with FreeTypeSymbolApi
implicit val FreeTypeSymbolTag = ClassTag[FreeTypeSymbol](classOf[FreeTypeSymbol])
/** An object representing a missing symbol */
diff --git a/src/reflect/scala/reflect/macros/Aliases.scala b/src/reflect/scala/reflect/macros/Aliases.scala
index ad100d7e89..eff7f34b02 100644
--- a/src/reflect/scala/reflect/macros/Aliases.scala
+++ b/src/reflect/scala/reflect/macros/Aliases.scala
@@ -17,12 +17,12 @@ trait Aliases {
type Expr[+T] = universe.Expr[T]
val Expr = universe.Expr
- type AbsTypeTag[T] = universe.AbsTypeTag[T]
+ type WeakTypeTag[T] = universe.WeakTypeTag[T]
type TypeTag[T] = universe.TypeTag[T]
- val AbsTypeTag = universe.AbsTypeTag
+ val WeakTypeTag = universe.WeakTypeTag
val TypeTag = universe.TypeTag
- def absTypeTag[T](implicit attag: AbsTypeTag[T]) = attag
+ def weakTypeTag[T](implicit attag: WeakTypeTag[T]) = attag
def typeTag[T](implicit ttag: TypeTag[T]) = ttag
- def absTypeOf[T](implicit attag: AbsTypeTag[T]): Type = attag.tpe
+ def weakTypeOf[T](implicit attag: WeakTypeTag[T]): Type = attag.tpe
def typeOf[T](implicit ttag: TypeTag[T]): Type = ttag.tpe
}
diff --git a/src/reflect/scala/reflect/macros/Exprs.scala b/src/reflect/scala/reflect/macros/Exprs.scala
index ceaab06d12..280d5508c8 100644
--- a/src/reflect/scala/reflect/macros/Exprs.scala
+++ b/src/reflect/scala/reflect/macros/Exprs.scala
@@ -4,5 +4,5 @@ package macros
trait Exprs {
self: Context =>
- def Expr[T: AbsTypeTag](tree: Tree): Expr[T]
+ def Expr[T: WeakTypeTag](tree: Tree): Expr[T]
}
diff --git a/src/reflect/scala/reflect/macros/TypeTags.scala b/src/reflect/scala/reflect/macros/TypeTags.scala
index 8f590d1de4..2f15e37f6a 100644
--- a/src/reflect/scala/reflect/macros/TypeTags.scala
+++ b/src/reflect/scala/reflect/macros/TypeTags.scala
@@ -4,6 +4,6 @@ package macros
trait TypeTags {
self: Context =>
- def AbsTypeTag[T](tpe: Type): AbsTypeTag[T]
+ def WeakTypeTag[T](tpe: Type): WeakTypeTag[T]
def TypeTag[T](tpe: Type): TypeTag[T]
}
diff --git a/src/reflect/scala/reflect/runtime/JavaMirrors.scala b/src/reflect/scala/reflect/runtime/JavaMirrors.scala
index 9f2c3fc79c..f4b68640ae 100644
--- a/src/reflect/scala/reflect/runtime/JavaMirrors.scala
+++ b/src/reflect/scala/reflect/runtime/JavaMirrors.scala
@@ -120,19 +120,20 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym
// ----------- Implementations of mirror operations and classes -------------------
- private def ErrorInnerClass(wannabe: Symbol) = throw new ScalaReflectionException(s"$wannabe is an inner class, use reflectClass on an InstanceMirror to obtain its ClassMirror")
- private def ErrorInnerModule(wannabe: Symbol) = throw new ScalaReflectionException(s"$wannabe is an inner module, use reflectModule on an InstanceMirror to obtain its ModuleMirror")
- private def ErrorStaticClass(wannabe: Symbol) = throw new ScalaReflectionException(s"$wannabe is a static class, use reflectClass on a RuntimeMirror to obtain its ClassMirror")
- private def ErrorStaticModule(wannabe: Symbol) = throw new ScalaReflectionException(s"$wannabe is a static module, use reflectModule on a RuntimeMirror to obtain its ModuleMirror")
- private def ErrorNotMember(wannabe: Symbol, owner: Symbol) = throw new ScalaReflectionException(s"expected a member of $owner, you provided ${wannabe.kindString} ${wannabe.fullName}")
- private def ErrorNotField(wannabe: Symbol) = throw new ScalaReflectionException(s"expected a field or an accessor method symbol, you provided $wannabe")
- private def ErrorNonExistentField(wannabe: Symbol) = throw new ScalaReflectionException(s"""
- |Scala field ${wannabe.name} isn't represented as a Java field, neither it has a Java accessor method
+ private def ErrorInnerClass(sym: Symbol) = throw new ScalaReflectionException(s"$sym is an inner class, use reflectClass on an InstanceMirror to obtain its ClassMirror")
+ private def ErrorInnerModule(sym: Symbol) = throw new ScalaReflectionException(s"$sym is an inner module, use reflectModule on an InstanceMirror to obtain its ModuleMirror")
+ private def ErrorStaticClass(sym: Symbol) = throw new ScalaReflectionException(s"$sym is a static class, use reflectClass on a RuntimeMirror to obtain its ClassMirror")
+ private def ErrorStaticModule(sym: Symbol) = throw new ScalaReflectionException(s"$sym is a static module, use reflectModule on a RuntimeMirror to obtain its ModuleMirror")
+ private def ErrorNotMember(sym: Symbol, owner: Symbol) = throw new ScalaReflectionException(s"expected a member of $owner, you provided ${sym.kindString} ${sym.fullName}")
+ private def ErrorNotField(sym: Symbol) = throw new ScalaReflectionException(s"expected a field or an accessor method symbol, you provided $sym")
+ private def ErrorNonExistentField(sym: Symbol) = throw new ScalaReflectionException(s"""
+ |Scala field ${sym.name} isn't represented as a Java field, neither it has a Java accessor method
|note that private parameters of class constructors don't get mapped onto fields and/or accessors,
|unless they are used outside of their declaring constructors.
""".trim.stripMargin)
- private def ErrorSetImmutableField(wannabe: Symbol) = throw new ScalaReflectionException(s"cannot set an immutable field ${wannabe.name}")
- private def ErrorNotConstructor(wannabe: Symbol, owner: Symbol) = throw new ScalaReflectionException(s"expected a constructor of $owner, you provided $wannabe")
+ private def ErrorSetImmutableField(sym: Symbol) = throw new ScalaReflectionException(s"cannot set an immutable field ${sym.name}")
+ private def ErrorNotConstructor(sym: Symbol, owner: Symbol) = throw new ScalaReflectionException(s"expected a constructor of $owner, you provided $sym")
+ private def ErrorFree(member: Symbol, freeType: Symbol) = throw new ScalaReflectionException(s"cannot reflect ${member.kindString} ${member.name}, because it's a member of a weak type ${freeType.name}")
def reflect[T: ClassTag](obj: T): InstanceMirror = new JavaInstanceMirror(obj)
@@ -154,13 +155,30 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym
def moduleSymbol(rtcls: RuntimeClass): ModuleSymbol = classToScala(rtcls).companionModule.asModule
- private def checkMemberOf(wannabe: Symbol, owner: ClassSymbol) {
- if (wannabe.owner == AnyClass || wannabe.owner == AnyRefClass || wannabe.owner == ObjectClass) {
+ private def ensuringNotFree(sym: Symbol)(body: => Any) {
+ val freeType = sym.ownerChain find (_.isFreeType)
+ freeType match {
+ case Some(freeType) => ErrorFree(sym, freeType)
+ case _ => body
+ }
+ }
+
+ private def checkMemberOf(sym: Symbol, owner: ClassSymbol) {
+ if (sym.owner == AnyClass || sym.owner == AnyRefClass || sym.owner == ObjectClass) {
// do nothing
- } else if (wannabe.owner == AnyValClass) {
- if (!owner.isPrimitiveValueClass && !owner.isDerivedValueClass) ErrorNotMember(wannabe, owner)
+ } else if (sym.owner == AnyValClass) {
+ if (!owner.isPrimitiveValueClass && !owner.isDerivedValueClass) ErrorNotMember(sym, owner)
} else {
- if (!(owner.info.baseClasses contains wannabe.owner)) ErrorNotMember(wannabe, owner)
+ ensuringNotFree(sym) {
+ if (!(owner.info.baseClasses contains sym.owner)) ErrorNotMember(sym, owner)
+ }
+ }
+ }
+
+ private def checkConstructorOf(sym: Symbol, owner: ClassSymbol) {
+ if (!sym.isClassConstructor) ErrorNotConstructor(sym, owner)
+ ensuringNotFree(sym) {
+ if (!owner.info.decls.toList.contains(sym)) ErrorNotConstructor(sym, owner)
}
}
@@ -386,8 +404,7 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym
def erasure = symbol
def isStatic = false
def reflectConstructor(constructor: MethodSymbol) = {
- if (!constructor.isClassConstructor) ErrorNotConstructor(constructor, symbol)
- if (!symbol.info.decls.toList.contains(constructor)) ErrorNotConstructor(constructor, symbol)
+ checkConstructorOf(constructor, symbol)
new JavaConstructorMirror(outer, constructor)
}
def companion: Option[ModuleMirror] = symbol.companionModule match {
diff --git a/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala b/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala
index 40346cad79..7705610efb 100644
--- a/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala
+++ b/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala
@@ -14,11 +14,11 @@ trait SynchronizedSymbols extends internal.Symbols { self: SymbolTable =>
override def connectModuleToClass(m: ModuleSymbol, moduleClass: ClassSymbol): ModuleSymbol =
synchronized { super.connectModuleToClass(m, moduleClass) }
- override def newFreeTermSymbol(name: TermName, info: Type, value: => Any, flags: Long = 0L, origin: String = null): FreeTermSymbol =
- new FreeTermSymbol(name, value, origin) with SynchronizedTermSymbol initFlags flags setInfo info
+ override def newFreeTermSymbol(name: TermName, value: => Any, flags: Long = 0L, origin: String = null): FreeTermSymbol =
+ new FreeTermSymbol(name, value, origin) with SynchronizedTermSymbol initFlags flags
- override def newFreeTypeSymbol(name: TypeName, info: Type, value: => Any, flags: Long = 0L, origin: String = null): FreeTypeSymbol =
- new FreeTypeSymbol(name, value, origin) with SynchronizedTypeSymbol initFlags flags setInfo info
+ override def newFreeTypeSymbol(name: TypeName, flags: Long = 0L, origin: String = null): FreeTypeSymbol =
+ new FreeTypeSymbol(name, origin) with SynchronizedTypeSymbol initFlags flags
override protected def makeNoSymbol: NoSymbol = new NoSymbol with SynchronizedSymbol
diff --git a/src/reflect/scala/reflect/runtime/package.scala b/src/reflect/scala/reflect/runtime/package.scala
index ccdea3e82d..d325cf6a16 100644
--- a/src/reflect/scala/reflect/runtime/package.scala
+++ b/src/reflect/scala/reflect/runtime/package.scala
@@ -17,7 +17,7 @@ package runtime {
if (runtimeClass.isEmpty) c.abort(c.enclosingPosition, "call site does not have an enclosing class")
val runtimeUniverse = Select(Select(Select(Ident(newTermName("scala")), newTermName("reflect")), newTermName("runtime")), newTermName("universe"))
val currentMirror = Apply(Select(runtimeUniverse, newTermName("runtimeMirror")), List(Select(runtimeClass, newTermName("getClassLoader"))))
- c.Expr[Nothing](currentMirror)(c.AbsTypeTag.Nothing)
+ c.Expr[Nothing](currentMirror)(c.WeakTypeTag.Nothing)
}
}
}
diff --git a/test/files/neg/interop_abstypetags_arenot_classmanifests.scala b/test/files/neg/interop_abstypetags_arenot_classmanifests.scala
index c8567be5d4..5d88c90ffd 100644
--- a/test/files/neg/interop_abstypetags_arenot_classmanifests.scala
+++ b/test/files/neg/interop_abstypetags_arenot_classmanifests.scala
@@ -1,11 +1,11 @@
import scala.reflect.runtime.universe._
object Test extends App {
- def absTypeTagIsnotClassManifest[T: AbsTypeTag] = {
+ def weakTypeTagIsnotClassManifest[T: WeakTypeTag] = {
println(classManifest[T])
}
- absTypeTagIsnotClassManifest[Int]
- absTypeTagIsnotClassManifest[String]
- absTypeTagIsnotClassManifest[Array[Int]]
+ weakTypeTagIsnotClassManifest[Int]
+ weakTypeTagIsnotClassManifest[String]
+ weakTypeTagIsnotClassManifest[Array[Int]]
} \ No newline at end of file
diff --git a/test/files/neg/interop_abstypetags_arenot_classtags.scala b/test/files/neg/interop_abstypetags_arenot_classtags.scala
index e3911c1588..de1f8657b6 100644
--- a/test/files/neg/interop_abstypetags_arenot_classtags.scala
+++ b/test/files/neg/interop_abstypetags_arenot_classtags.scala
@@ -2,11 +2,11 @@ import scala.reflect.runtime.universe._
import scala.reflect.{ClassTag, classTag}
object Test extends App {
- def absTypeTagIsnotClassTag[T: AbsTypeTag] = {
+ def weakTypeTagIsnotClassTag[T: WeakTypeTag] = {
println(classTag[T])
}
- absTypeTagIsnotClassTag[Int]
- absTypeTagIsnotClassTag[String]
- absTypeTagIsnotClassTag[Array[Int]]
+ weakTypeTagIsnotClassTag[Int]
+ weakTypeTagIsnotClassTag[String]
+ weakTypeTagIsnotClassTag[Array[Int]]
} \ No newline at end of file
diff --git a/test/files/neg/interop_abstypetags_arenot_manifests.scala b/test/files/neg/interop_abstypetags_arenot_manifests.scala
index 77a95048fd..1ca3673ce4 100644
--- a/test/files/neg/interop_abstypetags_arenot_manifests.scala
+++ b/test/files/neg/interop_abstypetags_arenot_manifests.scala
@@ -1,11 +1,11 @@
import scala.reflect.runtime.universe._
object Test extends App {
- def absTypeTagIsnotManifest[T: AbsTypeTag] = {
+ def weakTypeTagIsnotManifest[T: WeakTypeTag] = {
println(manifest[T])
}
- absTypeTagIsnotManifest[Int]
- absTypeTagIsnotManifest[String]
- absTypeTagIsnotManifest[Array[Int]]
+ weakTypeTagIsnotManifest[Int]
+ weakTypeTagIsnotManifest[String]
+ weakTypeTagIsnotManifest[Array[Int]]
} \ No newline at end of file
diff --git a/test/files/neg/macro-invalidsig-context-bounds.check b/test/files/neg/macro-invalidsig-context-bounds.check
index 5d42ebc515..eb5d833bc0 100644
--- a/test/files/neg/macro-invalidsig-context-bounds.check
+++ b/test/files/neg/macro-invalidsig-context-bounds.check
@@ -1,7 +1,7 @@
Macros_Test_1.scala:2: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context): c.Expr[Any]
found : (c: scala.reflect.macros.Context)(implicit evidence$2: Numeric[U]): c.universe.Literal
-macro implementations cannot have implicit parameters other than AbsTypeTag evidences
+macro implementations cannot have implicit parameters other than WeakTypeTag evidences
def foo[U] = macro Impls.foo[U]
^
one error found
diff --git a/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala b/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala
index 5aa9a7eaf9..c066c485b1 100644
--- a/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala
+++ b/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala
@@ -2,7 +2,7 @@ import scala.reflect.runtime.universe._
import scala.reflect.macros.{Context => Ctx}
object Impls {
- def foo[U: c.AbsTypeTag: Numeric](c: Ctx) = {
+ def foo[U: c.WeakTypeTag: Numeric](c: Ctx) = {
import c.universe._
Literal(Constant(42))
}
diff --git a/test/files/neg/macro-invalidsig-implicit-params.check b/test/files/neg/macro-invalidsig-implicit-params.check
index 62156770e4..ca35e62cd7 100644
--- a/test/files/neg/macro-invalidsig-implicit-params.check
+++ b/test/files/neg/macro-invalidsig-implicit-params.check
@@ -1,7 +1,7 @@
Impls_Macros_1.scala:18: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context)(x: c.Expr[Int]): c.Expr[Unit]
found : (c: scala.reflect.macros.Context)(implicit x: c.Expr[Int]): c.Expr[Unit]
-macro implementations cannot have implicit parameters other than AbsTypeTag evidences
+macro implementations cannot have implicit parameters other than WeakTypeTag evidences
def foo_targs[U](x: Int) = macro Impls.foo_targs[T, U]
^
one error found
diff --git a/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala b/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala
index f724538993..845a168ff2 100644
--- a/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala
+++ b/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala
@@ -2,13 +2,13 @@ import scala.reflect.runtime.universe._
import scala.reflect.macros.{Context => Ctx}
object Impls {
- def foo_targs[T, U: c.AbsTypeTag](c: Ctx)(implicit x: c.Expr[Int]) = {
+ def foo_targs[T, U: c.WeakTypeTag](c: Ctx)(implicit x: c.Expr[Int]) = {
import c.{prefix => prefix}
import c.universe._
val body = Block(
Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("invoking foo_targs...")))),
Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("type of prefix is: " + prefix.staticType)))),
- Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("U is: " + implicitly[c.AbsTypeTag[U]].tpe)))),
+ Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("U is: " + implicitly[c.WeakTypeTag[U]].tpe)))),
Literal(Constant(())))
c.Expr[Unit](body)
}
diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-a.check b/test/files/neg/macro-invalidsig-tparams-notparams-a.check
index 5aee62b9e5..5404c185f3 100644
--- a/test/files/neg/macro-invalidsig-tparams-notparams-a.check
+++ b/test/files/neg/macro-invalidsig-tparams-notparams-a.check
@@ -1,4 +1,4 @@
-Macros_Test_2.scala:2: error: wrong number of type parameters for method foo: [U](c: scala.reflect.macros.Context)(implicit evidence$1: c.AbsTypeTag[U])Nothing
+Macros_Test_2.scala:2: error: wrong number of type parameters for method foo: [U](c: scala.reflect.macros.Context)(implicit evidence$1: c.WeakTypeTag[U])Nothing
def foo = macro Impls.foo
^
one error found
diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala
index afbe0f0915..f8b3c92869 100644
--- a/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala
+++ b/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala
@@ -2,5 +2,5 @@ import scala.reflect.runtime.universe._
import scala.reflect.macros.{Context => Ctx}
object Impls {
- def foo[U: c.AbsTypeTag](c: Ctx) = ???
+ def foo[U: c.WeakTypeTag](c: Ctx) = ???
} \ No newline at end of file
diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-b.check b/test/files/neg/macro-invalidsig-tparams-notparams-b.check
index e8de8a4c6b..485d4de96e 100644
--- a/test/files/neg/macro-invalidsig-tparams-notparams-b.check
+++ b/test/files/neg/macro-invalidsig-tparams-notparams-b.check
@@ -1,4 +1,4 @@
-Macros_Test_2.scala:3: error: wrong number of type parameters for method foo: [T, U, V](c: scala.reflect.macros.Context)(implicit evidence$1: c.AbsTypeTag[T], implicit evidence$2: c.AbsTypeTag[U], implicit V: c.AbsTypeTag[V])c.Expr[Unit]
+Macros_Test_2.scala:3: error: wrong number of type parameters for method foo: [T, U, V](c: scala.reflect.macros.Context)(implicit evidence$1: c.WeakTypeTag[T], implicit evidence$2: c.WeakTypeTag[U], implicit V: c.WeakTypeTag[V])c.Expr[Unit]
def foo[V] = macro Impls.foo
^
one error found
diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala
index b48f9d5f98..baf3aab9e3 100644
--- a/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala
+++ b/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala
@@ -2,9 +2,9 @@ import scala.reflect.runtime.universe._
import scala.reflect.macros.{Context => Ctx}
object Impls {
- def foo[T: c.AbsTypeTag, U: c.AbsTypeTag, V](c: Ctx)(implicit V: c.AbsTypeTag[V]): c.Expr[Unit] = {
- println(implicitly[c.AbsTypeTag[T]])
- println(implicitly[c.AbsTypeTag[U]])
+ def foo[T: c.WeakTypeTag, U: c.WeakTypeTag, V](c: Ctx)(implicit V: c.WeakTypeTag[V]): c.Expr[Unit] = {
+ println(implicitly[c.WeakTypeTag[T]])
+ println(implicitly[c.WeakTypeTag[U]])
println(V)
c.literalUnit
}
diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-c.check b/test/files/neg/macro-invalidsig-tparams-notparams-c.check
index b1078fb233..1530c35097 100644
--- a/test/files/neg/macro-invalidsig-tparams-notparams-c.check
+++ b/test/files/neg/macro-invalidsig-tparams-notparams-c.check
@@ -1,4 +1,4 @@
-Macros_Test_2.scala:3: error: wrong number of type parameters for method foo: [T, U, V](c: scala.reflect.macros.Context)(implicit evidence$1: c.AbsTypeTag[T], implicit evidence$2: c.AbsTypeTag[U], implicit V: c.AbsTypeTag[V])c.Expr[Unit]
+Macros_Test_2.scala:3: error: wrong number of type parameters for method foo: [T, U, V](c: scala.reflect.macros.Context)(implicit evidence$1: c.WeakTypeTag[T], implicit evidence$2: c.WeakTypeTag[U], implicit V: c.WeakTypeTag[V])c.Expr[Unit]
def foo[V] = macro Impls.foo[V]
^
one error found
diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala
index 3506bdc789..44b4ed6ab3 100644
--- a/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala
+++ b/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala
@@ -2,10 +2,10 @@ import scala.reflect.runtime.universe._
import scala.reflect.macros.{Context => Ctx}
object Impls {
- def foo[T: c.AbsTypeTag, U: c.AbsTypeTag, V](c: Ctx)(implicit V: c.AbsTypeTag[V]): c.Expr[Unit] = {
+ def foo[T: c.WeakTypeTag, U: c.WeakTypeTag, V](c: Ctx)(implicit V: c.WeakTypeTag[V]): c.Expr[Unit] = {
import c.universe._
- println(implicitly[c.AbsTypeTag[T]])
- println(implicitly[c.AbsTypeTag[U]])
+ println(implicitly[c.WeakTypeTag[T]])
+ println(implicitly[c.WeakTypeTag[U]])
println(V)
c.literalUnit
}
diff --git a/test/files/neg/macro-reify-typetag-useabstypetag/Test.scala b/test/files/neg/macro-reify-typetag-useabstypetag/Test.scala
index b66ad6c523..1e7fcb3f45 100644
--- a/test/files/neg/macro-reify-typetag-useabstypetag/Test.scala
+++ b/test/files/neg/macro-reify-typetag-useabstypetag/Test.scala
@@ -1,7 +1,7 @@
import scala.reflect.runtime.universe._
object Test extends App {
- def fooTypeTag[T: AbsTypeTag] = {
+ def fooTypeTag[T: WeakTypeTag] = {
println(implicitly[TypeTag[T]])
println(implicitly[TypeTag[List[T]]])
}
diff --git a/test/files/neg/t6323a.check b/test/files/neg/t6323a.check
new file mode 100644
index 0000000000..694c79ca5f
--- /dev/null
+++ b/test/files/neg/t6323a.check
@@ -0,0 +1,9 @@
+t6323a.scala:11: `package`.this.materializeTypeTag[Test](scala.reflect.runtime.`package`.universe) is not a valid implicit value for reflect.runtime.universe.TypeTag[Test] because:
+failed to typecheck the materialized tag:
+cannot create a TypeTag referring to local class Test.Test
+ val value = u.typeOf[Test]
+ ^
+t6323a.scala:11: error: No TypeTag available for Test
+ val value = u.typeOf[Test]
+ ^
+one error found
diff --git a/test/files/neg/t6323a.flags b/test/files/neg/t6323a.flags
new file mode 100644
index 0000000000..4c6cdb71e2
--- /dev/null
+++ b/test/files/neg/t6323a.flags
@@ -0,0 +1 @@
+-Xlog-implicits \ No newline at end of file
diff --git a/test/files/neg/t6323a.scala b/test/files/neg/t6323a.scala
new file mode 100644
index 0000000000..a203167f3c
--- /dev/null
+++ b/test/files/neg/t6323a.scala
@@ -0,0 +1,21 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => m}
+import scala.reflect.runtime.{universe => u}
+
+object Test extends App {
+ locally {
+ try {
+ case class Test(a:String,b:List[Int])
+
+ val lookAtMe = m.reflect(Test("a",List(5)))
+ val value = u.typeOf[Test]
+ val members = value.members
+ val member = value.members.filter(_.name.encoded == "a")
+ val aAccessor = lookAtMe.reflectMethod(member.head.asMethod)
+ val thisShouldBeA = aAccessor.apply()
+ println(thisShouldBeA)
+ } catch {
+ case ScalaReflectionException(msg) => println(msg)
+ }
+ }
+} \ No newline at end of file
diff --git a/test/files/pos/t6047.scala b/test/files/pos/t6047.scala
index 80d5e9668b..bc5f856bd2 100644
--- a/test/files/pos/t6047.scala
+++ b/test/files/pos/t6047.scala
@@ -4,17 +4,17 @@ import java.io.InputStream
object Macros {
def unpack[A](input: InputStream): A = macro unpack_impl[A]
- def unpack_impl[A: c.AbsTypeTag](c: Context)(input: c.Expr[InputStream]): c.Expr[A] = {
+ def unpack_impl[A: c.WeakTypeTag](c: Context)(input: c.Expr[InputStream]): c.Expr[A] = {
import c.universe._
def unpackcode(tpe: c.Type): c.Expr[_] = {
- if (tpe <:< implicitly[c.AbsTypeTag[Traversable[_]]].tpe) {
+ if (tpe <:< implicitly[c.WeakTypeTag[Traversable[_]]].tpe) {
}
???
}
- unpackcode(implicitly[c.AbsTypeTag[A]].tpe)
+ unpackcode(implicitly[c.WeakTypeTag[A]].tpe)
???
}
} \ No newline at end of file
diff --git a/test/files/run/abstypetags_core.scala b/test/files/run/abstypetags_core.scala
index 226de94055..2692fec035 100644
--- a/test/files/run/abstypetags_core.scala
+++ b/test/files/run/abstypetags_core.scala
@@ -1,34 +1,34 @@
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[AnyVal]] eq AbsTypeTag.AnyVal)
- println(implicitly[AbsTypeTag[AnyVal]])
- println(implicitly[AbsTypeTag[AnyRef]] eq AbsTypeTag.AnyRef)
- println(implicitly[AbsTypeTag[AnyRef]])
- 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[WeakTypeTag[Byte]] eq WeakTypeTag.Byte)
+ println(implicitly[WeakTypeTag[Byte]])
+ println(implicitly[WeakTypeTag[Short]] eq WeakTypeTag.Short)
+ println(implicitly[WeakTypeTag[Short]])
+ println(implicitly[WeakTypeTag[Char]] eq WeakTypeTag.Char)
+ println(implicitly[WeakTypeTag[Char]])
+ println(implicitly[WeakTypeTag[Int]] eq WeakTypeTag.Int)
+ println(implicitly[WeakTypeTag[Int]])
+ println(implicitly[WeakTypeTag[Long]] eq WeakTypeTag.Long)
+ println(implicitly[WeakTypeTag[Long]])
+ println(implicitly[WeakTypeTag[Float]] eq WeakTypeTag.Float)
+ println(implicitly[WeakTypeTag[Float]])
+ println(implicitly[WeakTypeTag[Double]] eq WeakTypeTag.Double)
+ println(implicitly[WeakTypeTag[Double]])
+ println(implicitly[WeakTypeTag[Boolean]] eq WeakTypeTag.Boolean)
+ println(implicitly[WeakTypeTag[Boolean]])
+ println(implicitly[WeakTypeTag[Unit]] eq WeakTypeTag.Unit)
+ println(implicitly[WeakTypeTag[Unit]])
+ println(implicitly[WeakTypeTag[Any]] eq WeakTypeTag.Any)
+ println(implicitly[WeakTypeTag[Any]])
+ println(implicitly[WeakTypeTag[AnyVal]] eq WeakTypeTag.AnyVal)
+ println(implicitly[WeakTypeTag[AnyVal]])
+ println(implicitly[WeakTypeTag[AnyRef]] eq WeakTypeTag.AnyRef)
+ println(implicitly[WeakTypeTag[AnyRef]])
+ println(implicitly[WeakTypeTag[Object]] eq WeakTypeTag.Object)
+ println(implicitly[WeakTypeTag[Object]])
+ println(implicitly[WeakTypeTag[Null]] eq WeakTypeTag.Null)
+ println(implicitly[WeakTypeTag[Null]])
+ println(implicitly[WeakTypeTag[Nothing]] eq WeakTypeTag.Nothing)
+ println(implicitly[WeakTypeTag[Nothing]])
} \ No newline at end of file
diff --git a/test/files/run/abstypetags_serialize.scala b/test/files/run/abstypetags_serialize.scala
index 5b9142f6d5..38a7aba325 100644
--- a/test/files/run/abstypetags_serialize.scala
+++ b/test/files/run/abstypetags_serialize.scala
@@ -3,7 +3,7 @@ import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
object Test extends App {
- def test(tag: AbsTypeTag[_]) =
+ def test(tag: WeakTypeTag[_]) =
try {
val fout = new ByteArrayOutputStream()
val out = new ObjectOutputStream(fout)
@@ -13,7 +13,7 @@ object Test extends App {
val fin = new ByteArrayInputStream(fout.toByteArray)
val in = new ObjectInputStream(fin)
- val retag = in.readObject().asInstanceOf[scala.reflect.basis.AbsTypeTag[_]].in(cm)
+ val retag = in.readObject().asInstanceOf[scala.reflect.basis.WeakTypeTag[_]].in(cm)
in.close()
fin.close()
@@ -24,8 +24,8 @@ object Test extends App {
}
def qwe[T, U[_]] = {
- test(implicitly[AbsTypeTag[T]])
- test(implicitly[AbsTypeTag[U[String]]])
+ test(implicitly[WeakTypeTag[T]])
+ test(implicitly[WeakTypeTag[U[String]]])
}
qwe
diff --git a/test/files/run/existentials3-new.check b/test/files/run/existentials3-new.check
index a036d92a24..2550f4dae0 100644
--- a/test/files/run/existentials3-new.check
+++ b/test/files/run/existentials3-new.check
@@ -1,24 +1,24 @@
-Bar.type, t=TypeRef, s= <: scala.runtime.AbstractFunction0[Bar] with Serializable{case def unapply(x$0: Bar): Boolean} with Singleton
-Bar, t=TypeRef, s= <: Test.ToS with Product with Serializable{def copy(): Bar}
+Bar.type, t=TypeRef, s=type Bar.type
+Bar, t=TypeRef, s=type Bar
Test.ToS, t=RefinedType, s=f3
Test.ToS, t=RefinedType, s=f4
Test.ToS, t=RefinedType, s=f5
() => Test.ToS, t=TypeRef, s=class Function0
() => Test.ToS, t=TypeRef, s=class Function0
-$anon, t=TypeRef, s= <: B with Test.ToS
-$anon, t=TypeRef, s= <: B with A with Test.ToS
+$anon, t=TypeRef, s=type $anon
+$anon, t=TypeRef, s=type $anon
List[java.lang.Object{type T1}#T1], t=TypeRef, s=class List
List[Seq[Int]], t=TypeRef, s=class List
List[Seq[U forSome { type U <: Int }]], t=TypeRef, s=class List
-Bar.type, t=TypeRef, s= <: scala.runtime.AbstractFunction0[Bar] with Serializable{case def unapply(x$0: Bar): Boolean} with Singleton
-Bar, t=TypeRef, s= <: Test.ToS with Product with Serializable{def copy(): Bar}
+Bar.type, t=TypeRef, s=type Bar.type
+Bar, t=TypeRef, s=type Bar
Test.ToS, t=RefinedType, s=g3
Test.ToS, t=RefinedType, s=g4
Test.ToS, t=RefinedType, s=g5
() => Test.ToS, t=TypeRef, s=class Function0
() => Test.ToS, t=TypeRef, s=class Function0
-$anon, t=TypeRef, s= <: B with Test.ToS
-$anon, t=TypeRef, s= <: B with A with Test.ToS
+$anon, t=TypeRef, s=type $anon
+$anon, t=TypeRef, s=type $anon
List[java.lang.Object{type T1}#T1], t=TypeRef, s=class List
List[Seq[Int]], t=TypeRef, s=class List
List[Seq[U forSome { type U <: Int }]], t=TypeRef, s=class List
diff --git a/test/files/run/existentials3-new.scala b/test/files/run/existentials3-new.scala
index 16735eab4f..110c8eff7a 100644
--- a/test/files/run/existentials3-new.scala
+++ b/test/files/run/existentials3-new.scala
@@ -38,31 +38,31 @@ object Test {
println("%s, t=%s, s=%s".format(t, t.asInstanceOf[Product].productPrefix, s))
}
def m[T: TypeTag](x: T) = printTpe(typeOf[T])
- def m2[T: AbsTypeTag](x: T) = printTpe(implicitly[AbsTypeTag[T]].tpe)
+ def m2[T: WeakTypeTag](x: T) = printTpe(implicitly[WeakTypeTag[T]].tpe)
// tags do work for f10/g10
def main(args: Array[String]): Unit = {
- m(f1)
- m(f2)
+ m2(f1)
+ m2(f2)
m(f3)
m(f4)
m(f5)
m(f6)
m(f7)
- m(f8)
- m(f9)
+ m2(f8)
+ m2(f9)
m2(f10)
m(f11)
m(f12)
- m(g1)
- m(g2)
+ m2(g1)
+ m2(g2)
m(g3)
m(g4)
m(g5)
m(g6)
m(g7)
- m(g8)
- m(g9)
+ m2(g8)
+ m2(g9)
m2(g10)
m(g11)
m(g12)
diff --git a/test/files/run/interop_manifests_are_abstypetags.scala b/test/files/run/interop_manifests_are_abstypetags.scala
index 1cba2fdb4b..f2c2723106 100644
--- a/test/files/run/interop_manifests_are_abstypetags.scala
+++ b/test/files/run/interop_manifests_are_abstypetags.scala
@@ -1,11 +1,11 @@
import scala.reflect.runtime.universe._
object Test extends App {
- def manifestIsAbsTypeTag[T: Manifest] = {
- println(implicitly[AbsTypeTag[T]].tpe)
+ def manifestIsWeakTypeTag[T: Manifest] = {
+ println(implicitly[WeakTypeTag[T]].tpe)
}
- manifestIsAbsTypeTag[Int]
- manifestIsAbsTypeTag[String]
- manifestIsAbsTypeTag[Array[Int]]
+ manifestIsWeakTypeTag[Int]
+ manifestIsWeakTypeTag[String]
+ manifestIsWeakTypeTag[Array[Int]]
} \ No newline at end of file
diff --git a/test/files/run/macro-def-path-dependent-d1/Impls_Macros_1.scala b/test/files/run/macro-def-path-dependent-d1/Impls_Macros_1.scala
index 2daf6fc3fb..69d9708b2a 100644
--- a/test/files/run/macro-def-path-dependent-d1/Impls_Macros_1.scala
+++ b/test/files/run/macro-def-path-dependent-d1/Impls_Macros_1.scala
@@ -5,5 +5,5 @@ import scala.reflect.api.Universe
object Test {
def materializeTypeTag[T](u: Universe)(e: T) = macro materializeTypeTag_impl[T]
- def materializeTypeTag_impl[T: c.AbsTypeTag](c: Context)(u: c.Expr[Universe])(e: c.Expr[T]): c.Expr[u.value.TypeTag[T]] = ???
+ def materializeTypeTag_impl[T: c.WeakTypeTag](c: Context)(u: c.Expr[Universe])(e: c.Expr[T]): c.Expr[u.value.TypeTag[T]] = ???
} \ No newline at end of file
diff --git a/test/files/run/macro-def-path-dependent-d2/Impls_1.scala b/test/files/run/macro-def-path-dependent-d2/Impls_1.scala
index 1cda64e43e..7fa9c3579e 100644
--- a/test/files/run/macro-def-path-dependent-d2/Impls_1.scala
+++ b/test/files/run/macro-def-path-dependent-d2/Impls_1.scala
@@ -3,5 +3,5 @@ import scala.reflect.macros.Context
import scala.reflect.api.Universe
object Impls {
- def materializeTypeTag_impl[T: c.AbsTypeTag](c: Context)(u: c.Expr[Universe])(e: c.Expr[T]): c.Expr[u.value.TypeTag[T]] = ???
+ def materializeTypeTag_impl[T: c.WeakTypeTag](c: Context)(u: c.Expr[Universe])(e: c.Expr[T]): c.Expr[u.value.TypeTag[T]] = ???
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-implicit-argument/Macros_1.scala b/test/files/run/macro-expand-implicit-argument/Macros_1.scala
index 7629c5a9e2..86c4198870 100644
--- a/test/files/run/macro-expand-implicit-argument/Macros_1.scala
+++ b/test/files/run/macro-expand-implicit-argument/Macros_1.scala
@@ -35,7 +35,7 @@ object Macros {
* arr
* }
*/
- def arrayMacro[A:c.AbsTypeTag](c:Context)(as:c.Expr[A]*)(ct: c.Expr[ClassTag[A]]): c.Expr[Array[A]] = {
+ def arrayMacro[A:c.WeakTypeTag](c:Context)(as:c.Expr[A]*)(ct: c.Expr[ClassTag[A]]): c.Expr[Array[A]] = {
import c.mirror._
import c.universe._
def const(x:Int) = Literal(Constant(x))
@@ -44,7 +44,7 @@ object Macros {
val arr = newTermName("arr")
val create = Apply(Select(ct.tree, "newArray"), List(const(n)))
- val arrtpe = TypeTree(implicitly[c.AbsTypeTag[Array[A]]].tpe)
+ val arrtpe = TypeTree(implicitly[c.WeakTypeTag[Array[A]]].tpe)
val valdef = ValDef(Modifiers(), arr, arrtpe, create)
val updates = (0 until n).map {
diff --git a/test/files/run/macro-expand-nullary-generic/Impls_1.scala b/test/files/run/macro-expand-nullary-generic/Impls_1.scala
index fbbc23a824..1180c83a40 100644
--- a/test/files/run/macro-expand-nullary-generic/Impls_1.scala
+++ b/test/files/run/macro-expand-nullary-generic/Impls_1.scala
@@ -2,14 +2,14 @@ import scala.reflect.runtime.universe._
import scala.reflect.macros.{Context => Ctx}
object Impls {
- def impl[T: c.AbsTypeTag](c: Ctx) = {
+ def impl[T: c.WeakTypeTag](c: Ctx) = {
import c.universe._
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works " + implicitly[c.AbsTypeTag[T]]))))
+ val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works " + implicitly[c.WeakTypeTag[T]]))))
c.Expr[Unit](body)
}
- def fooNullary[T: c.AbsTypeTag](c: Ctx) = impl[T](c)
- def fooEmpty[T: c.AbsTypeTag](c: Ctx)() = impl[T](c)
- def barNullary[T: c.AbsTypeTag](c: Ctx)(x: c.Expr[Int]) = impl[T](c)
- def barEmpty[T: c.AbsTypeTag](c: Ctx)(x: c.Expr[Int])() = impl[T](c)
+ def fooNullary[T: c.WeakTypeTag](c: Ctx) = impl[T](c)
+ def fooEmpty[T: c.WeakTypeTag](c: Ctx)() = impl[T](c)
+ def barNullary[T: c.WeakTypeTag](c: Ctx)(x: c.Expr[Int]) = impl[T](c)
+ def barEmpty[T: c.WeakTypeTag](c: Ctx)(x: c.Expr[Int])() = impl[T](c)
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-tparams-explicit/Impls_1.scala b/test/files/run/macro-expand-tparams-explicit/Impls_1.scala
index 0a879687e8..72b420d92f 100644
--- a/test/files/run/macro-expand-tparams-explicit/Impls_1.scala
+++ b/test/files/run/macro-expand-tparams-explicit/Impls_1.scala
@@ -2,9 +2,9 @@ import scala.reflect.runtime.universe._
import scala.reflect.macros.{Context => Ctx}
object Impls {
- def foo[U: c.AbsTypeTag](c: Ctx) = {
+ def foo[U: c.WeakTypeTag](c: Ctx) = {
import c.universe._
- val U = implicitly[c.AbsTypeTag[U]]
+ val U = implicitly[c.WeakTypeTag[U]]
val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(U.toString))))
c.Expr[Unit](body)
}
diff --git a/test/files/run/macro-expand-tparams-implicit.check b/test/files/run/macro-expand-tparams-implicit.check
index 1c1a785706..37226ec68d 100644
--- a/test/files/run/macro-expand-tparams-implicit.check
+++ b/test/files/run/macro-expand-tparams-implicit.check
@@ -1,2 +1,2 @@
TypeTag[Int]
-AbsTypeTag[String]
+WeakTypeTag[String]
diff --git a/test/files/run/macro-expand-tparams-implicit/Impls_1.scala b/test/files/run/macro-expand-tparams-implicit/Impls_1.scala
index f6cb63b9c9..33770516df 100644
--- a/test/files/run/macro-expand-tparams-implicit/Impls_1.scala
+++ b/test/files/run/macro-expand-tparams-implicit/Impls_1.scala
@@ -2,9 +2,9 @@ import scala.reflect.runtime.universe._
import scala.reflect.macros.{Context => Ctx}
object Impls {
- def foo[U: c.AbsTypeTag](c: Ctx)(x: c.Expr[U]) = {
+ def foo[U: c.WeakTypeTag](c: Ctx)(x: c.Expr[U]) = {
import c.universe._
- val U = implicitly[c.AbsTypeTag[U]]
+ val U = implicitly[c.WeakTypeTag[U]]
val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(U.toString))))
c.Expr[Unit](body)
}
diff --git a/test/files/run/macro-expand-tparams-prefix-a.check b/test/files/run/macro-expand-tparams-prefix-a.check
index 6a7f9c5f52..7ef9fa7330 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 @@
TypeTag[Int]
TypeTag[Int]
-AbsTypeTag[String]
+WeakTypeTag[String]
TypeTag[Boolean]
diff --git a/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala
index f6cb63b9c9..33770516df 100644
--- a/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala
+++ b/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala
@@ -2,9 +2,9 @@ import scala.reflect.runtime.universe._
import scala.reflect.macros.{Context => Ctx}
object Impls {
- def foo[U: c.AbsTypeTag](c: Ctx)(x: c.Expr[U]) = {
+ def foo[U: c.WeakTypeTag](c: Ctx)(x: c.Expr[U]) = {
import c.universe._
- val U = implicitly[c.AbsTypeTag[U]]
+ val U = implicitly[c.WeakTypeTag[U]]
val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(U.toString))))
c.Expr[Unit](body)
}
diff --git a/test/files/run/macro-expand-tparams-prefix-b.check b/test/files/run/macro-expand-tparams-prefix-b.check
index daae32bd0a..f4a2a8e80d 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 @@
TypeTag[Boolean] TypeTag[Int]
-TypeTag[Boolean] AbsTypeTag[String]
+TypeTag[Boolean] WeakTypeTag[String]
diff --git a/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala
index 7e0fa26569..9378e67712 100644
--- a/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala
+++ b/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala
@@ -2,10 +2,10 @@ import scala.reflect.runtime.universe._
import scala.reflect.macros.{Context => Ctx}
object Impls {
- def foo[T: c.AbsTypeTag, U: c.AbsTypeTag](c: Ctx)(x: c.Expr[U]) = {
+ def foo[T: c.WeakTypeTag, U: c.WeakTypeTag](c: Ctx)(x: c.Expr[U]) = {
import c.universe._
- val T = implicitly[c.AbsTypeTag[T]]
- val U = implicitly[c.AbsTypeTag[U]]
+ val T = implicitly[c.WeakTypeTag[T]]
+ val U = implicitly[c.WeakTypeTag[U]]
val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString + " " + U.toString))))
c.Expr[Unit](body)
}
diff --git a/test/files/run/macro-expand-tparams-prefix-c1.check b/test/files/run/macro-expand-tparams-prefix-c1.check
index 5356b3e6d1..473668ac58 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 @@
TypeTag[Int]
-AbsTypeTag[String]
+WeakTypeTag[String]
TypeTag[Boolean]
diff --git a/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala
index ca515be627..afdd7d4f7a 100644
--- a/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala
+++ b/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala
@@ -2,11 +2,11 @@ import scala.reflect.runtime.universe._
import scala.reflect.macros.{Context => Ctx}
object Impls {
- def foo[T, U: c.AbsTypeTag, V](c: Ctx)(implicit T: c.AbsTypeTag[T], V: c.AbsTypeTag[V]): c.Expr[Unit] = {
+ def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[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.AbsTypeTag[U]].toString)))),
+ Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))),
Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))),
Literal(Constant(()))))
}
diff --git a/test/files/run/macro-expand-tparams-prefix-c2.check b/test/files/run/macro-expand-tparams-prefix-c2.check
index 5356b3e6d1..473668ac58 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 @@
TypeTag[Int]
-AbsTypeTag[String]
+WeakTypeTag[String]
TypeTag[Boolean]
diff --git a/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala b/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala
index 5a554590d8..3c2838208a 100644
--- a/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala
+++ b/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala
@@ -2,11 +2,11 @@ import scala.reflect.runtime.universe._
import scala.reflect.macros.{Context => Ctx}
object Impls {
- def foo[T, U: c.AbsTypeTag, V](c: Ctx)(implicit T: c.AbsTypeTag[T], V: c.AbsTypeTag[V]): c.Expr[Unit] = {
+ def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[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.AbsTypeTag[U]].toString)))),
+ Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))),
Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))),
Literal(Constant(()))))
}
diff --git a/test/files/run/macro-expand-tparams-prefix-d1.check b/test/files/run/macro-expand-tparams-prefix-d1.check
index 319edfbed0..2331e2549e 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 @@
-AbsTypeTag[T]
-AbsTypeTag[U]
+WeakTypeTag[T]
+WeakTypeTag[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 ca515be627..afdd7d4f7a 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.macros.{Context => Ctx}
object Impls {
- def foo[T, U: c.AbsTypeTag, V](c: Ctx)(implicit T: c.AbsTypeTag[T], V: c.AbsTypeTag[V]): c.Expr[Unit] = {
+ def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[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.AbsTypeTag[U]].toString)))),
+ Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))),
Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))),
Literal(Constant(()))))
}
diff --git a/test/files/run/macro-impl-default-params/Impls_Macros_1.scala b/test/files/run/macro-impl-default-params/Impls_Macros_1.scala
index 06c58d96ab..db77b1923a 100644
--- a/test/files/run/macro-impl-default-params/Impls_Macros_1.scala
+++ b/test/files/run/macro-impl-default-params/Impls_Macros_1.scala
@@ -2,10 +2,10 @@ import scala.reflect.runtime.universe._
import scala.reflect.macros.{Context => Ctx}
object Impls {
- def foo_targs[T, U: c.AbsTypeTag](c: Ctx = null)(x: c.Expr[Int] = null) = {
+ def foo_targs[T, U: c.WeakTypeTag](c: Ctx = null)(x: c.Expr[Int] = null) = {
import c.{prefix => prefix}
import c.universe._
- val U = implicitly[c.AbsTypeTag[U]]
+ val U = implicitly[c.WeakTypeTag[U]]
val body = Block(
Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("invoking foo_targs...")))),
Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("type of prefix is: " + prefix.staticType)))),
diff --git a/test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala b/test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala
index a54b7f4b08..4583a726cf 100644
--- a/test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala
+++ b/test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala
@@ -1,7 +1,7 @@
import scala.reflect.macros.{Context => Ctx}
object Impls {
- def foo[T: c.AbsTypeTag](c: Ctx)(x: c.Expr[T]) = {
+ def foo[T: c.WeakTypeTag](c: Ctx)(x: c.Expr[T]) = {
import c.universe._
val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(x.tree.toString))))
c.Expr[Unit](body)
diff --git a/test/files/run/macro-reify-abstypetag-notypeparams/Test.scala b/test/files/run/macro-reify-abstypetag-notypeparams/Test.scala
index 34f742b9fb..73c2d05921 100644
--- a/test/files/run/macro-reify-abstypetag-notypeparams/Test.scala
+++ b/test/files/run/macro-reify-abstypetag-notypeparams/Test.scala
@@ -1,6 +1,6 @@
import scala.reflect.runtime.universe._
object Test extends App {
- println(implicitly[AbsTypeTag[Int]])
- println(implicitly[AbsTypeTag[List[Int]]])
+ println(implicitly[WeakTypeTag[Int]])
+ println(implicitly[WeakTypeTag[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
index be62b59a69..6aeec96079 100644
--- a/test/files/run/macro-reify-abstypetag-typeparams-notags.check
+++ b/test/files/run/macro-reify-abstypetag-typeparams-notags.check
@@ -1,2 +1,2 @@
-AbsTypeTag[T]
-AbsTypeTag[List[T]]
+WeakTypeTag[T]
+WeakTypeTag[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
index 0b42cc07b5..4ba2231d9a 100644
--- a/test/files/run/macro-reify-abstypetag-typeparams-notags/Test.scala
+++ b/test/files/run/macro-reify-abstypetag-typeparams-notags/Test.scala
@@ -2,8 +2,8 @@ import scala.reflect.runtime.universe._
object Test extends App {
def fooNoTypeTag[T] = {
- println(implicitly[AbsTypeTag[T]])
- println(implicitly[AbsTypeTag[List[T]]])
+ println(implicitly[WeakTypeTag[T]])
+ println(implicitly[WeakTypeTag[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
index d6ca5a85ef..6e2646c5e0 100644
--- a/test/files/run/macro-reify-abstypetag-typeparams-tags.check
+++ b/test/files/run/macro-reify-abstypetag-typeparams-tags.check
@@ -1,2 +1,2 @@
TypeTag[Int]
-AbsTypeTag[List[Int]]
+WeakTypeTag[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
index 82a7b7971d..70ca615e1f 100644
--- a/test/files/run/macro-reify-abstypetag-typeparams-tags/Test.scala
+++ b/test/files/run/macro-reify-abstypetag-typeparams-tags/Test.scala
@@ -1,9 +1,9 @@
import scala.reflect.runtime.universe._
object Test extends App {
- def fooTypeTag[T: AbsTypeTag] = {
- println(implicitly[AbsTypeTag[T]])
- println(implicitly[AbsTypeTag[List[T]]])
+ def fooTypeTag[T: WeakTypeTag] = {
+ println(implicitly[WeakTypeTag[T]])
+ println(implicitly[WeakTypeTag[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
index d6ca5a85ef..6e2646c5e0 100644
--- a/test/files/run/macro-reify-abstypetag-usetypetag.check
+++ b/test/files/run/macro-reify-abstypetag-usetypetag.check
@@ -1,2 +1,2 @@
TypeTag[Int]
-AbsTypeTag[List[Int]]
+WeakTypeTag[List[Int]]
diff --git a/test/files/run/macro-reify-abstypetag-usetypetag/Test.scala b/test/files/run/macro-reify-abstypetag-usetypetag/Test.scala
index 3c62725c42..ecae4110a8 100644
--- a/test/files/run/macro-reify-abstypetag-usetypetag/Test.scala
+++ b/test/files/run/macro-reify-abstypetag-usetypetag/Test.scala
@@ -2,8 +2,8 @@ import scala.reflect.runtime.universe._
object Test extends App {
def fooTypeTag[T: TypeTag] = {
- println(implicitly[AbsTypeTag[T]])
- println(implicitly[AbsTypeTag[List[T]]])
+ println(implicitly[WeakTypeTag[T]])
+ println(implicitly[WeakTypeTag[List[T]]])
}
fooTypeTag[Int]
} \ No newline at end of file
diff --git a/test/files/run/macro-reify-freevars/Macros_1.scala b/test/files/run/macro-reify-freevars/Macros_1.scala
index 57fdc32437..20f80c06d1 100644
--- a/test/files/run/macro-reify-freevars/Macros_1.scala
+++ b/test/files/run/macro-reify-freevars/Macros_1.scala
@@ -1,7 +1,7 @@
package scala.collection.slick
object QueryableMacros{
- def map[T:c.AbsTypeTag, S:c.AbsTypeTag]
+ def map[T:c.WeakTypeTag, S:c.WeakTypeTag]
(c: scala.reflect.macros.Context)
(projection: c.Expr[T => S])
: c.Expr[scala.collection.slick.Queryable[S]] = {
diff --git a/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala b/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala
index 04714970dd..ae2def2d3e 100644
--- a/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala
+++ b/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala
@@ -21,9 +21,9 @@ case class Utils[C <: Context]( c:C ) {
}
}
object QueryableMacros{
- def _helper[C <: Context,S:c.AbsTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = {
+ def _helper[C <: Context,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = {
import c.universe._
- val element_type = implicitly[c.AbsTypeTag[S]].tpe
+ val element_type = implicitly[c.WeakTypeTag[S]].tpe
val foo = c.Expr[ru.Expr[Queryable[S]]](
c.reifyTree( c.runtimeUniverse, EmptyTree, c.typeCheck(
Utils[c.type](c).removeDoubleReify(
@@ -32,7 +32,7 @@ object QueryableMacros{
)))
c.universe.reify{ Queryable.factory[S]( foo.splice )}
}
- def map[T:c.AbsTypeTag, S:c.AbsTypeTag]
+ def map[T:c.WeakTypeTag, S:c.WeakTypeTag]
(c: scala.reflect.macros.Context)
(projection: c.Expr[T => S]): c.Expr[Queryable[S]] = _helper[c.type,S]( c )( "_map", projection )
}
diff --git a/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala b/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala
index 04714970dd..ae2def2d3e 100644
--- a/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala
+++ b/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala
@@ -21,9 +21,9 @@ case class Utils[C <: Context]( c:C ) {
}
}
object QueryableMacros{
- def _helper[C <: Context,S:c.AbsTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = {
+ def _helper[C <: Context,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = {
import c.universe._
- val element_type = implicitly[c.AbsTypeTag[S]].tpe
+ val element_type = implicitly[c.WeakTypeTag[S]].tpe
val foo = c.Expr[ru.Expr[Queryable[S]]](
c.reifyTree( c.runtimeUniverse, EmptyTree, c.typeCheck(
Utils[c.type](c).removeDoubleReify(
@@ -32,7 +32,7 @@ object QueryableMacros{
)))
c.universe.reify{ Queryable.factory[S]( foo.splice )}
}
- def map[T:c.AbsTypeTag, S:c.AbsTypeTag]
+ def map[T:c.WeakTypeTag, S:c.WeakTypeTag]
(c: scala.reflect.macros.Context)
(projection: c.Expr[T => S]): c.Expr[Queryable[S]] = _helper[c.type,S]( c )( "_map", projection )
}
diff --git a/test/files/run/macro-reify-tagful-a/Macros_1.scala b/test/files/run/macro-reify-tagful-a/Macros_1.scala
index 0eac74236f..f2512dcfaf 100644
--- a/test/files/run/macro-reify-tagful-a/Macros_1.scala
+++ b/test/files/run/macro-reify-tagful-a/Macros_1.scala
@@ -5,7 +5,7 @@ object Macros {
def foo[T](s: T) = macro Impls.foo[T]
object Impls {
- def foo[T: c.AbsTypeTag](c: Ctx)(s: c.Expr[T]) = c.universe.reify {
+ def foo[T: c.WeakTypeTag](c: Ctx)(s: c.Expr[T]) = c.universe.reify {
List(s.splice)
}
}
diff --git a/test/files/run/macro-reify-tagless-a.check b/test/files/run/macro-reify-tagless-a.check
index d69f641280..c2385ba008 100644
--- a/test/files/run/macro-reify-tagless-a.check
+++ b/test/files/run/macro-reify-tagless-a.check
@@ -1,3 +1,3 @@
reflective compilation has failed:
-Macro expansion contains free type variable T defined by foo in Impls_Macros_1.scala:7:13. Have you forgotten to use c.AbsTypeTag annotation for this type parameter? If you have troubles tracking free type variables, consider using -Xlog-free-types
+Macro expansion contains free type variable T defined by foo in Impls_Macros_1.scala:7:13. Have you forgotten to use c.WeakTypeTag annotation for this type parameter? If you have troubles tracking free type variables, consider using -Xlog-free-types
diff --git a/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala b/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala
index b2f6f7d50e..f693ad78cc 100644
--- a/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala
+++ b/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala
@@ -18,7 +18,8 @@ object Macros {
val rupkg = c.mirror.staticModule("scala.reflect.runtime.package")
val rusym = build.selectTerm(rupkg, "universe")
val NullaryMethodType(rutpe) = rusym.typeSignature
- val ru = build.newFreeTerm("ru", rutpe, scala.reflect.runtime.universe)
+ val ru = build.newFreeTerm("ru", scala.reflect.runtime.universe)
+ build.setTypeSignature(ru, rutpe)
val tree2 = Apply(Select(Ident(ru), newTermName("reify")), List(Literal(Constant(2))))
val ttree2 = c.typeCheck(tree2, withMacrosDisabled = true)
diff --git a/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala b/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala
index 948c047351..1dbf5a1a87 100644
--- a/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala
+++ b/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala
@@ -18,7 +18,8 @@ object Macros {
val rupkg = c.mirror.staticModule("scala.reflect.runtime.package")
val rusym = build.selectTerm(rupkg, "universe")
val NullaryMethodType(rutpe) = rusym.typeSignature
- val ru = build.newFreeTerm("ru", rutpe, scala.reflect.runtime.universe)
+ val ru = build.newFreeTerm("ru", scala.reflect.runtime.universe)
+ build.setTypeSignature(ru, rutpe)
val tree2 = Apply(Select(Ident(ru), newTermName("reify")), List(Apply(Select(Ident(newTermName("scala")), newTermName("Array")), List(Literal(Constant(2))))))
val ttree2 = c.typeCheck(tree2, withMacrosDisabled = true)
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 3d350a50fa..bcbd12817b 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.macros.Context
object Macros {
- def cons_impl[A: c.AbsTypeTag](c: Context)(x: c.Expr[A], xs: c.Expr[List[A]]): c.Expr[List[A]] = c.universe.reify {
- println("A = " + c.literal(implicitly[c.AbsTypeTag[A]].toString).splice)
+ def cons_impl[A: c.WeakTypeTag](c: Context)(x: c.Expr[A], xs: c.Expr[List[A]]): c.Expr[List[A]] = c.universe.reify {
+ println("A = " + c.literal(implicitly[c.WeakTypeTag[A]].toString).splice)
x.splice :: xs.splice
}
- def nil_impl[B: c.AbsTypeTag](c: Context): c.Expr[List[B]] = c.universe.reify {
- println("B = " + c.literal(implicitly[c.AbsTypeTag[B]].toString).splice)
+ def nil_impl[B: c.WeakTypeTag](c: Context): c.Expr[List[B]] = c.universe.reify {
+ println("B = " + c.literal(implicitly[c.WeakTypeTag[B]].toString).splice)
Nil
}
diff --git a/test/files/run/macro-undetparams-macroitself.check b/test/files/run/macro-undetparams-macroitself.check
index 1c1a785706..37226ec68d 100644
--- a/test/files/run/macro-undetparams-macroitself.check
+++ b/test/files/run/macro-undetparams-macroitself.check
@@ -1,2 +1,2 @@
TypeTag[Int]
-AbsTypeTag[String]
+WeakTypeTag[String]
diff --git a/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala b/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala
index 081894cf52..0244273b6f 100644
--- a/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala
+++ b/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala
@@ -2,7 +2,7 @@ import scala.reflect.runtime.universe._
import scala.reflect.macros.Context
object Macros {
- def impl[T: c.AbsTypeTag](c: Context)(foo: c.Expr[T]): c.Expr[Unit] = c.universe.reify { println(c.literal(implicitly[c.AbsTypeTag[T]].toString).splice) }
+ def impl[T: c.WeakTypeTag](c: Context)(foo: c.Expr[T]): c.Expr[Unit] = c.universe.reify { println(c.literal(implicitly[c.WeakTypeTag[T]].toString).splice) }
def foo[T](foo: T) = macro impl[T]
} \ No newline at end of file
diff --git a/test/files/run/reify_newimpl_26.check b/test/files/run/reify_newimpl_26.check
index c006cb7ffb..5996f3b322 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[AbsTypeTag[List[T]]]
+ val tt = implicitly[WeakTypeTag[List[T]]]
println(tt)
}
<console>:9: free type: Ident(newTypeName("T")) defined by foo in <console>:7:16
- val tt = implicitly[AbsTypeTag[List[T]]]
+ val tt = implicitly[WeakTypeTag[List[T]]]
^
foo: [T]=> Unit
scala> foo[Int]
-AbsTypeTag[scala.List[T]]
+WeakTypeTag[scala.List[T]]
scala>
diff --git a/test/files/run/reify_newimpl_26.scala b/test/files/run/reify_newimpl_26.scala
index a12d8a2970..af74d60e8b 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[AbsTypeTag[List[T]]]
+ val tt = implicitly[WeakTypeTag[List[T]]]
println(tt)
}
foo[Int]
diff --git a/test/files/run/t1195-new.scala b/test/files/run/t1195-new.scala
index 4edfb5073f..0f62b140c9 100644
--- a/test/files/run/t1195-new.scala
+++ b/test/files/run/t1195-new.scala
@@ -9,7 +9,7 @@ object Test {
val g1 = g()
val h1 = h()
- def m[T: TypeTag](x: T) = println(typeOf[T] + ", underlying = " + typeOf[T].typeSymbol.typeSignature)
+ def m[T: WeakTypeTag](x: T) = println(weakTypeOf[T] + ", underlying = " + weakTypeOf[T].typeSymbol.typeSignature)
def main(args: Array[String]): Unit = {
m(f)
diff --git a/test/files/run/t6323b.check b/test/files/run/t6323b.check
new file mode 100644
index 0000000000..80b6176178
--- /dev/null
+++ b/test/files/run/t6323b.check
@@ -0,0 +1 @@
+cannot reflect value a, because it's a member of a weak type Test
diff --git a/test/files/run/t6323b.scala b/test/files/run/t6323b.scala
new file mode 100644
index 0000000000..f530ac3ecc
--- /dev/null
+++ b/test/files/run/t6323b.scala
@@ -0,0 +1,21 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => m}
+import scala.reflect.runtime.{universe => u}
+
+object Test extends App {
+ locally {
+ try {
+ case class Test(a:String,b:List[Int])
+
+ val lookAtMe = m.reflect(Test("a",List(5)))
+ val value = u.weakTypeOf[Test]
+ val members = value.members
+ val member = value.members.filter(_.name.encoded == "a")
+ val aAccessor = lookAtMe.reflectMethod(member.head.asMethod)
+ val thisShouldBeA = aAccessor.apply()
+ println(thisShouldBeA)
+ } catch {
+ case ScalaReflectionException(msg) => println(msg)
+ }
+ }
+} \ No newline at end of file
diff --git a/test/files/run/toolbox_typecheck_macrosdisabled.scala b/test/files/run/toolbox_typecheck_macrosdisabled.scala
index 01a418d42e..51eb63f294 100644
--- a/test/files/run/toolbox_typecheck_macrosdisabled.scala
+++ b/test/files/run/toolbox_typecheck_macrosdisabled.scala
@@ -12,7 +12,8 @@ object Test extends App {
val rupkg = cm.staticModule("scala.reflect.runtime.package")
val rusym = build.selectTerm(rupkg, "universe")
val NullaryMethodType(rutpe) = rusym.typeSignature
- val ru = build.newFreeTerm("ru", rutpe, scala.reflect.runtime.universe)
+ val ru = build.newFreeTerm("ru", scala.reflect.runtime.universe)
+ build.setTypeSignature(ru, rutpe)
val tree1 = Apply(Select(Ident(ru), newTermName("reify")), List(Literal(Constant(2))))
val ttree1 = toolbox.typeCheck(tree1, withMacrosDisabled = false)
diff --git a/test/files/run/toolbox_typecheck_macrosdisabled2.scala b/test/files/run/toolbox_typecheck_macrosdisabled2.scala
index 462dc9fa91..74fd09d9fd 100644
--- a/test/files/run/toolbox_typecheck_macrosdisabled2.scala
+++ b/test/files/run/toolbox_typecheck_macrosdisabled2.scala
@@ -12,7 +12,8 @@ object Test extends App {
val rupkg = cm.staticModule("scala.reflect.runtime.package")
val rusym = build.selectTerm(rupkg, "universe")
val NullaryMethodType(rutpe) = rusym.typeSignature
- val ru = build.newFreeTerm("ru", rutpe, scala.reflect.runtime.universe)
+ val ru = build.newFreeTerm("ru", scala.reflect.runtime.universe)
+ build.setTypeSignature(ru, rutpe)
val tree1 = Apply(Select(Ident(ru), newTermName("reify")), List(Apply(Select(Ident(newTermName("scala")), newTermName("Array")), List(Literal(Constant(2))))))
val ttree1 = toolbox.typeCheck(tree1, withMacrosDisabled = false)
diff --git a/test/pending/run/macro-expand-implicit-macro-defeats-type-inference/Impls_1.scala b/test/pending/run/macro-expand-implicit-macro-defeats-type-inference/Impls_1.scala
index 26d4a45fee..15bcb581c8 100644
--- a/test/pending/run/macro-expand-implicit-macro-defeats-type-inference/Impls_1.scala
+++ b/test/pending/run/macro-expand-implicit-macro-defeats-type-inference/Impls_1.scala
@@ -1,7 +1,7 @@
import scala.reflect.macros.Context
object Impls {
- def foo[T: c.AbsTypeTag](c: Context): c.Expr[List[T]] = c.universe.reify {
+ def foo[T: c.WeakTypeTag](c: Context): c.Expr[List[T]] = c.universe.reify {
println("openImplicits are: " + c.literal(c.openImplicits.toString).splice)
println("enclosingImplicits are: " + c.literal(c.enclosingImplicits.toString).splice)
println("typetag is: " + c.literal(c.tag[T].toString).splice)
diff --git a/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala b/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala
index d6ebb907e5..26de70cc12 100644
--- a/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala
+++ b/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala
@@ -1,11 +1,11 @@
import scala.reflect.macros.{Context => Ctx}
object Impls {
- def foo[T, U: c.AbsTypeTag, V](c: Ctx)(implicit T: c.AbsTypeTag[T], V: c.AbsTypeTag[V]): c.Expr[Unit] = {
+ def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = {
import c.universe._
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.AbsTypeTag[U]].toString)))),
+ Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))),
Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))),
Literal(Constant(())))
}
diff --git a/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala b/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala
index d6ebb907e5..26de70cc12 100644
--- a/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala
+++ b/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala
@@ -1,11 +1,11 @@
import scala.reflect.macros.{Context => Ctx}
object Impls {
- def foo[T, U: c.AbsTypeTag, V](c: Ctx)(implicit T: c.AbsTypeTag[T], V: c.AbsTypeTag[V]): c.Expr[Unit] = {
+ def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = {
import c.universe._
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.AbsTypeTag[U]].toString)))),
+ Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))),
Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))),
Literal(Constant(())))
}
diff --git a/test/pending/run/macro-reify-array/Macros_1.scala b/test/pending/run/macro-reify-array/Macros_1.scala
index 99006c548a..f970be5caa 100644
--- a/test/pending/run/macro-reify-array/Macros_1.scala
+++ b/test/pending/run/macro-reify-array/Macros_1.scala
@@ -4,7 +4,7 @@ object Macros {
def foo[T](s: String) = macro Impls.foo[T]
object Impls {
- def foo[T: c.AbsTypeTag](c: Ctx)(s: c.Expr[T]) = c.universe.reify {
+ def foo[T: c.WeakTypeTag](c: Ctx)(s: c.Expr[T]) = c.universe.reify {
Array(s.splice)
}
}
diff --git a/test/pending/run/macro-reify-tagful-b/Macros_1.scala b/test/pending/run/macro-reify-tagful-b/Macros_1.scala
index a14187e8a7..59dbe7157b 100644
--- a/test/pending/run/macro-reify-tagful-b/Macros_1.scala
+++ b/test/pending/run/macro-reify-tagful-b/Macros_1.scala
@@ -4,7 +4,7 @@ object Macros {
def foo[T](s: T) = macro Impls.foo[List[T]]
object Impls {
- def foo[T: c.AbsTypeTag](c: Ctx)(s: c.Expr[T]) = c.universe.reify {
+ def foo[T: c.WeakTypeTag](c: Ctx)(s: c.Expr[T]) = c.universe.reify {
List(s.splice)
}
}