summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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/tools/reflect/FastTrack.scala3
-rw-r--r--src/library/scala/reflect/package.scala52
-rw-r--r--src/partest/scala/tools/partest/package.scala35
-rw-r--r--src/reflect/scala/reflect/api/package.scala3
-rw-r--r--src/reflect/scala/reflect/internal/Definitions.scala4
11 files changed, 72 insertions, 37 deletions
diff --git a/lib/scala-compiler-src.jar.desired.sha1 b/lib/scala-compiler-src.jar.desired.sha1
index 5d32ff0d1d..69fa09546d 100644
--- a/lib/scala-compiler-src.jar.desired.sha1
+++ b/lib/scala-compiler-src.jar.desired.sha1
@@ -1 +1 @@
-2698ecddfcde060a5db2a37e4aa448f4ad5c5891 ?scala-compiler-src.jar
+44deab4311f4717a416e76d0c54190d6a0f2c968 ?scala-compiler-src.jar
diff --git a/lib/scala-compiler.jar.desired.sha1 b/lib/scala-compiler.jar.desired.sha1
index 1a65697c88..a247e24f0a 100644
--- a/lib/scala-compiler.jar.desired.sha1
+++ b/lib/scala-compiler.jar.desired.sha1
@@ -1 +1 @@
-d9ce03a6d3d33234d94577b0cc0093f7a1739d95 ?scala-compiler.jar
+bccf8d18a168d4997fec62ac4097c22b1fb8c031 ?scala-compiler.jar
diff --git a/lib/scala-library-src.jar.desired.sha1 b/lib/scala-library-src.jar.desired.sha1
index 3175dc3d30..865aa13106 100644
--- a/lib/scala-library-src.jar.desired.sha1
+++ b/lib/scala-library-src.jar.desired.sha1
@@ -1 +1 @@
-a06b6e42d646e7077325fe1147f1fc9fa22aad7b ?scala-library-src.jar
+ea2ce62024b691f35a6d0083f27fd8a8c399f72d ?scala-library-src.jar
diff --git a/lib/scala-library.jar.desired.sha1 b/lib/scala-library.jar.desired.sha1
index 1543a18c53..450eabecd9 100644
--- a/lib/scala-library.jar.desired.sha1
+++ b/lib/scala-library.jar.desired.sha1
@@ -1 +1 @@
-4b0516ead118899611bbf6b1b21bf7a32e1f1f40 ?scala-library.jar
+7960dae9ef6471b412c904b12e54d06e35fc30cd ?scala-library.jar
diff --git a/lib/scala-reflect-src.jar.desired.sha1 b/lib/scala-reflect-src.jar.desired.sha1
index 7dd29fc0bb..3e67b926ee 100644
--- a/lib/scala-reflect-src.jar.desired.sha1
+++ b/lib/scala-reflect-src.jar.desired.sha1
@@ -1 +1 @@
-4f474a08df49c89a04031096093a0eda7875c8b7 ?scala-reflect-src.jar
+60799c7cf8ee80b0e05e1209d5970a714d32bd76 ?scala-reflect-src.jar
diff --git a/lib/scala-reflect.jar.desired.sha1 b/lib/scala-reflect.jar.desired.sha1
index aaea49a8b8..eaa998f79a 100644
--- a/lib/scala-reflect.jar.desired.sha1
+++ b/lib/scala-reflect.jar.desired.sha1
@@ -1 +1 @@
-2a2172b2a97a0458ccce846b3a779e7728a7f034 ?scala-reflect.jar
+619eb8ffe5b62268107580f8baa38e140a734620 ?scala-reflect.jar
diff --git a/src/compiler/scala/tools/reflect/FastTrack.scala b/src/compiler/scala/tools/reflect/FastTrack.scala
index 38e4e3c9f1..1af2842d05 100644
--- a/src/compiler/scala/tools/reflect/FastTrack.scala
+++ b/src/compiler/scala/tools/reflect/FastTrack.scala
@@ -31,8 +31,11 @@ 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) }
+ materializeClassTag bindTo { case (c, Apply(TypeApply(_, List(tt)), List(u))) => c.materializeClassTag(u, tt.tpe) }
MacroInternal_materializeWeakTypeTag bindTo { case (c, Apply(TypeApply(_, List(tt)), List(u))) => c.materializeTypeTag(u, EmptyTree, tt.tpe, concrete = false) }
+ 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) }
+ 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 }
StringContext_f bindTo { case (c, app@Apply(Select(Apply(_, parts), _), args)) => c.macro_StringInterpolation_f(parts, args, app.pos) }
diff --git a/src/library/scala/reflect/package.scala b/src/library/scala/reflect/package.scala
index 046491ae10..8b411d0dca 100644
--- a/src/library/scala/reflect/package.scala
+++ b/src/library/scala/reflect/package.scala
@@ -3,37 +3,37 @@ package scala
/**
* The base package of Scala's reflection library.
*
- * The reflection library is structured according to the 'cake pattern'. The base layer
+ * The reflection library is structured according to the 'cake pattern'. The base layer
* resides in package [[scala.reflect.base]] and defines an interface to the following main types:
- *
+ *
* - [[scala.reflect.base.Types#Type Types]] represent types
* - [[scala.reflect.base.Symbols#Symbol Symbols]] represent definitions
* - [[scala.reflect.base.Trees#Tree Trees]] represent abstract syntax trees
* - [[scala.reflect.base.Names#Name Names]] represent term and type names
* - [[scala.reflect.base.Annotations#Annotation Annotations]] represent annotations
* - [[scala.reflect.base.Positions#Position Positions]] represent source positions of tree nodes
- * - [[scala.reflect.base.FlagSets#FlagSet FlagSet]] represent sets of flags that apply to symbols and
+ * - [[scala.reflect.base.FlagSets#FlagSet FlagSet]] represent sets of flags that apply to symbols and
* definition trees
- * - [[scala.reflect.base.Constants#Constant Constants]] represent compile-time constants.
+ * - [[scala.reflect.base.Constants#Constant Constants]] represent compile-time constants.
*
- * Each of these types are defined in their own enclosing traits, which are ultimately all inherited by class
+ * Each of these types are defined in their own enclosing traits, which are ultimately all inherited by class
* [[scala.reflect.base.Universe Universe]]. The base universe defines a minimal interface to the above types.
- * Universes that provide additional functionality such as deeper introspection or runtime code generation,
+ * Universes that provide additional functionality such as deeper introspection or runtime code generation,
* are defined in packages [[scala.reflect.api]] and `scala.tools.reflect`.
*
- * The cake pattern employed here requires to write certain Scala idioms with more indirections that usual.
+ * The cake pattern employed here requires to write certain Scala idioms with more indirections that usual.
* What follows is a description of these indirections, which will help to navigate the Scaladocs easily.
*
- * For instance, consider the base type of all abstract syntax trees: [[scala.reflect.base.Trees#Tree]].
- * This type is not a class but is abstract and has an upper bound of [[scala.reflect.base.Trees#TreeBase]],
- * which is a class defining the minimal base interface for all trees.
+ * For instance, consider the base type of all abstract syntax trees: [[scala.reflect.base.Trees#Tree]].
+ * This type is not a class but is abstract and has an upper bound of [[scala.reflect.base.Trees#TreeBase]],
+ * which is a class defining the minimal base interface for all trees.
*
- * For a more interesting tree type, consider [[scala.reflect.base.Trees#If]] representing if-expressions.
- * It does not come with a class `IfBase`, since it does not add anything to the interface of its upper
- * bound `TermTree`. However, it is defined next to a value `If` of type [[scala.reflect.base.Trees#IfExtractor]].
- * This value serves as the companion object defining a factory method `apply` and a corresponding `unapply`
+ * For a more interesting tree type, consider [[scala.reflect.base.Trees#If]] representing if-expressions.
+ * It does not come with a class `IfBase`, since it does not add anything to the interface of its upper
+ * bound `TermTree`. However, it is defined next to a value `If` of type [[scala.reflect.base.Trees#IfExtractor]].
+ * This value serves as the companion object defining a factory method `apply` and a corresponding `unapply`
* for pattern matching.
- *
+ *
* {{{
* import scala.reflect.runtime.universe._
* val cond = reify{ condition }.tree // <- just some tree representing a condition
@@ -41,32 +41,32 @@ package scala
* val other = Literal(Constant(2))
* val iftree = If(cond,body,other)
* }}}
- *
+ *
* is equivalent to
- *
+ *
* {{{
* import scala.reflect.runtime.universe._
* val iftree = reify{ if( condition ) 1 else 2 }.tree
* }}}
*
* and can be pattern matched as
- *
+ *
* {{{
* iftree match { case If(cond,body,other) => ... }
* }}}
- *
- * Moreover, there is an implicit value [[scala.reflect.base.Trees#IfTag]] of type
+ *
+ * Moreover, there is an implicit value [[scala.reflect.base.Trees#IfTag]] of type
* `ClassTag[If]` that is used by the Scala compiler so that we can indeed pattern match on `If`:
* {{{
* iftree match { case _:If => ... }
- * }}}
+ * }}}
* Without the given implicit value, this pattern match would raise an "unchecked" warning at compile time
* since `If` is an abstract type that gets erased at runtime. See [[scala.reflect.ClassTag]] for details.
*
- * To summarize: each tree type `X` (and similarly for other types such as `Type` or `Symbol`) is represented
- * by an abstract type `X`, optionally together with a class `XBase` that defines `X`'s' interface.
- * `X`'s companion object, if it exists, is represented by a value `X` that is of type `XExtractor`.
- * Moreover, for each type `X`, there is a value `XTag` of type `ClassTag[X]` that allows to pattern match
+ * To summarize: each tree type `X` (and similarly for other types such as `Type` or `Symbol`) is represented
+ * by an abstract type `X`, optionally together with a class `XBase` that defines `X`'s' interface.
+ * `X`'s companion object, if it exists, is represented by a value `X` that is of type `XExtractor`.
+ * Moreover, for each type `X`, there is a value `XTag` of type `ClassTag[X]` that allows to pattern match
* on `X`.
*/
package object reflect {
@@ -113,6 +113,8 @@ package object reflect {
def classTag[T](implicit ctag: ClassTag[T]) = ctag
// typeTag incantation is defined inside scala.reflect.basis and scala.reflect.runtime.universe
+ private[scala] def materializeClassTag[T](u: base.Universe): ClassTag[T] = ??? // macro
+
// ClassTag class is defined in ClassTag.scala
type TypeTag[T] = scala.reflect.basis.TypeTag[T]
diff --git a/src/partest/scala/tools/partest/package.scala b/src/partest/scala/tools/partest/package.scala
index ebd3e46b7c..df1c296d47 100644
--- a/src/partest/scala/tools/partest/package.scala
+++ b/src/partest/scala/tools/partest/package.scala
@@ -93,11 +93,34 @@ package object partest {
import scala.reflect.macros.Context
def traceImpl[A: c.WeakTypeTag](c: Context)(a: c.Expr[A]): c.Expr[A] = {
import c.universe._
- val exprCode = c.literal(show(a.tree))
- val exprType = c.literal(show(a.actualType))
- reify {
- println(s"trace> ${exprCode.splice}\nres: ${exprType.splice} = ${a.splice}\n")
- a.splice
- }
+ import definitions._
+
+ // xeno.by: reify shouldn't be used explicitly before the final release of 2.10.0,
+ // because this impairs reflection refactorings
+ //
+ // val exprCode = c.literal(show(a.tree))
+ // val exprType = c.literal(show(a.actualType))
+ // reify {
+ // println(s"trace> ${exprCode.splice}\nres: ${exprType.splice} = ${a.splice}\n")
+ // a.splice
+ // }
+
+ c.Expr(Block(
+ List(Apply(
+ Select(Ident(PredefModule), newTermName("println")),
+ List(Apply(
+ Select(Apply(
+ Select(Ident(ScalaPackage), newTermName("StringContext")),
+ List(
+ Literal(Constant("trace> ")),
+ Literal(Constant("\\nres: ")),
+ Literal(Constant(" = ")),
+ Literal(Constant("\\n")))),
+ newTermName("s")),
+ List(
+ Literal(Constant(show(a.tree))),
+ Literal(Constant(show(a.actualType))),
+ a.tree))))),
+ a.tree))
}
}
diff --git a/src/reflect/scala/reflect/api/package.scala b/src/reflect/scala/reflect/api/package.scala
index d2fce7cf1d..5e31071e2d 100644
--- a/src/reflect/scala/reflect/api/package.scala
+++ b/src/reflect/scala/reflect/api/package.scala
@@ -9,4 +9,7 @@ package object api {
type Attachments = base.Attachments
type MirrorOf[U <: base.Universe with Singleton] = base.MirrorOf[U]
+
+ private[scala] def materializeWeakTypeTag[T](u: base.Universe): u.WeakTypeTag[T] = ??? // macro
+ private[scala] def materializeTypeTag[T](u: base.Universe): u.TypeTag[T] = ??? // macro
}
diff --git a/src/reflect/scala/reflect/internal/Definitions.scala b/src/reflect/scala/reflect/internal/Definitions.scala
index 48a658192b..08cf97673f 100644
--- a/src/reflect/scala/reflect/internal/Definitions.scala
+++ b/src/reflect/scala/reflect/internal/Definitions.scala
@@ -485,6 +485,7 @@ trait Definitions extends api.StandardDefinitions {
// scala.reflect
lazy val ReflectPackage = requiredModule[scala.reflect.`package`.type]
def ReflectBasis = getMemberValue(ReflectPackage, nme.basis)
+ lazy val ReflectApiPackage = getPackageObjectIfDefined("scala.reflect.api") // defined in scala-reflect.jar, so we need to be careful
lazy val ReflectRuntimePackage = getPackageObjectIfDefined("scala.reflect.runtime") // defined in scala-reflect.jar, so we need to be careful
def ReflectRuntimeUniverse = if (ReflectRuntimePackage != NoSymbol) getMemberValue(ReflectRuntimePackage, nme.universe) else NoSymbol
def ReflectRuntimeCurrentMirror = if (ReflectRuntimePackage != NoSymbol) getMemberMethod(ReflectRuntimePackage, nme.currentMirror) else NoSymbol
@@ -509,6 +510,9 @@ trait Definitions extends api.StandardDefinitions {
lazy val WeakTypeTagModule = getMemberModule(TypeTagsClass, nme.WeakTypeTag)
lazy val TypeTagClass = getMemberClass(TypeTagsClass, tpnme.TypeTag)
lazy val TypeTagModule = getMemberModule(TypeTagsClass, nme.TypeTag)
+ def materializeClassTag = getMemberMethod(ReflectPackage, nme.materializeClassTag)
+ def materializeWeakTypeTag = if (ReflectApiPackage != NoSymbol) getMemberMethod(ReflectApiPackage, nme.materializeWeakTypeTag) else NoSymbol
+ def materializeTypeTag = if (ReflectApiPackage != NoSymbol) getMemberMethod(ReflectApiPackage, nme.materializeTypeTag) else NoSymbol
lazy val BaseUniverseClass = requiredClass[scala.reflect.base.Universe]
def BaseUniverseReify = getMemberMethod(BaseUniverseClass, nme.reify)