summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2014-01-30 10:01:31 +0300
committerEugene Burmako <xeno.by@gmail.com>2014-02-14 23:51:22 +0100
commit114c99691674873393223a11a9aa9168c3f41d77 (patch)
treed855c67a565faf4dbe414cc8f1a1aaff68a8df79 /test/files
parent27805570cbf130260eab04fe1491e58fa95e8108 (diff)
downloadscala-114c99691674873393223a11a9aa9168c3f41d77.tar.gz
scala-114c99691674873393223a11a9aa9168c3f41d77.tar.bz2
scala-114c99691674873393223a11a9aa9168c3f41d77.zip
establishes scala.reflect.api#internal
Reflection API exhibits a tension inherent to experimental things: on the one hand we want it to grow into a beautiful and robust API, but on the other hand we have to deal with immaturity of underlying mechanisms by providing not very pretty solutions to enable important use cases. In Scala 2.10, which was our first stab at reflection API, we didn't have a systematic approach to dealing with this tension, sometimes exposing too much of internals (e.g. Symbol.deSkolemize) and sometimes exposing too little (e.g. there's still no facility to change owners, to do typing transformations, etc). This resulted in certain confusion with some internal APIs living among public ones, scaring the newcomers, and some internal APIs only available via casting, which requires intimate knowledge of the compiler and breaks compatibility guarantees. This led to creation of the `internal` API module for the reflection API, which provides advanced APIs necessary for macros that push boundaries of the state of the art, clearly demarcating them from the more or less straightforward rest and providing compatibility guarantees on par with the rest of the reflection API. This commit does break source compatibility with reflection API in 2.10, but the next commit is going to introduce a strategy of dealing with that.
Diffstat (limited to 'test/files')
-rw-r--r--test/files/pos/annotated-treecopy/Impls_Macros_1.scala5
-rw-r--r--test/files/pos/attachments-typed-another-ident/Impls_1.scala7
-rw-r--r--test/files/pos/attachments-typed-ident/Impls_1.scala7
-rw-r--r--test/files/run/existentials3-new.scala3
-rw-r--r--test/files/run/freetypes_false_alarm2.scala3
-rw-r--r--test/files/run/interop_typetags_are_manifests.scala1
-rw-r--r--test/files/run/macro-range/Common_1.scala3
-rw-r--r--test/files/run/macro-reify-nested-a/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-reify-nested-b/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-reify-type/Macros_1.scala3
-rw-r--r--test/files/run/macro-reify-unreify/Macros_1.scala6
-rw-r--r--test/files/run/macro-subpatterns/Macro_1.scala12
-rw-r--r--test/files/run/macro-typecheck-macrosdisabled.check2
-rw-r--r--test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala7
-rw-r--r--test/files/run/macro-typecheck-macrosdisabled2.check4
-rw-r--r--test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala7
-rw-r--r--test/files/run/reflection-tags.scala3
-rw-r--r--test/files/run/reify_newimpl_45.scala6
-rw-r--r--test/files/run/t5923a/Macros_1.scala3
-rw-r--r--test/files/run/t6221/Macros_1.scala3
-rw-r--r--test/files/run/t6591_7.scala3
-rw-r--r--test/files/run/t7570b.scala4
-rw-r--r--test/files/run/t8190.scala3
-rw-r--r--test/files/run/toolbox_typecheck_macrosdisabled.check2
-rw-r--r--test/files/run/toolbox_typecheck_macrosdisabled.scala7
-rw-r--r--test/files/run/toolbox_typecheck_macrosdisabled2.check4
-rw-r--r--test/files/run/toolbox_typecheck_macrosdisabled2.scala7
-rw-r--r--test/files/scalacheck/quasiquotes/ArbitraryTreesAndNames.scala2
-rw-r--r--test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala2
-rw-r--r--test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala4
-rw-r--r--test/files/scalacheck/quasiquotes/ForProps.scala2
-rw-r--r--test/files/scalacheck/quasiquotes/QuasiquoteProperties.scala4
-rw-r--r--test/files/scalacheck/quasiquotes/TypeConstructionProps.scala4
-rw-r--r--test/files/scalacheck/quasiquotes/TypecheckedProps.scala2
34 files changed, 82 insertions, 61 deletions
diff --git a/test/files/pos/annotated-treecopy/Impls_Macros_1.scala b/test/files/pos/annotated-treecopy/Impls_Macros_1.scala
index fdf9c72c31..79edbfffd8 100644
--- a/test/files/pos/annotated-treecopy/Impls_Macros_1.scala
+++ b/test/files/pos/annotated-treecopy/Impls_Macros_1.scala
@@ -15,6 +15,7 @@ object Macros {
def tree_impl[T:c.WeakTypeTag,U:c.WeakTypeTag](c: Context)
(f:c.Expr[Function1[T,U]]): c.Expr[Function1[T,U]] = {
import c.universe._
+ import internal._
val ttag = c.weakTypeTag[U]
f match {
case Expr(Function(List(ValDef(_,n,tp,_)),b)) =>
@@ -22,7 +23,7 @@ object Macros {
var b1 = new Transformer {
override def transform(tree: Tree): Tree = tree match {
case Ident(x) if (x==n) => Ident(TermName("_arg"))
- case tt: TypeTree if tt.original != null => TypeTree(tt.tpe) setOriginal transform(tt.original)
+ case tt: TypeTree if tt.original != null => setOriginal(TypeTree(tt.tpe), transform(tt.original))
// without the fix to LazyTreeCopier.Annotated, we would need to uncomment the line below to make the macro work
// that's because the pattern match in the input expression gets expanded into Typed(<x>, TypeTree(<Int @unchecked>))
// with the original of the TypeTree being Annotated(<@unchecked>, Ident(<x>))
@@ -34,7 +35,7 @@ object Macros {
}
}.transform(b)
- val reifiedTree = c.reifyTree(treeBuild.mkRuntimeUniverseRef, EmptyTree, b1)
+ val reifiedTree = c.reifyTree(gen.mkRuntimeUniverseRef, EmptyTree, b1)
val reifiedExpr = c.Expr[scala.reflect.runtime.universe.Expr[T => U]](reifiedTree)
val template =
c.universe.reify(new (T => U) with TypedFunction {
diff --git a/test/files/pos/attachments-typed-another-ident/Impls_1.scala b/test/files/pos/attachments-typed-another-ident/Impls_1.scala
index 8016143a4c..98062a9c76 100644
--- a/test/files/pos/attachments-typed-another-ident/Impls_1.scala
+++ b/test/files/pos/attachments-typed-another-ident/Impls_1.scala
@@ -6,10 +6,11 @@ object MyAttachment
object Macros {
def impl(c: Context) = {
import c.universe._
- val ident = Ident(TermName("bar")) updateAttachment MyAttachment
- assert(ident.attachments.get[MyAttachment.type].isDefined, ident.attachments)
+ import internal._
+ val ident = updateAttachment(Ident(TermName("bar")), MyAttachment)
+ assert(attachments(ident).get[MyAttachment.type].isDefined, attachments(ident))
val typed = c.typecheck(ident)
- assert(typed.attachments.get[MyAttachment.type].isDefined, typed.attachments)
+ assert(attachments(typed).get[MyAttachment.type].isDefined, attachments(typed))
c.Expr[Int](typed)
}
diff --git a/test/files/pos/attachments-typed-ident/Impls_1.scala b/test/files/pos/attachments-typed-ident/Impls_1.scala
index af2cc59ecd..25c0891880 100644
--- a/test/files/pos/attachments-typed-ident/Impls_1.scala
+++ b/test/files/pos/attachments-typed-ident/Impls_1.scala
@@ -6,10 +6,11 @@ object MyAttachment
object Macros {
def impl(c: Context) = {
import c.universe._
- val ident = Ident(TermName("bar")) updateAttachment MyAttachment
- assert(ident.attachments.get[MyAttachment.type].isDefined, ident.attachments)
+ import internal._
+ val ident = updateAttachment(Ident(TermName("bar")), MyAttachment)
+ assert(attachments(ident).get[MyAttachment.type].isDefined, attachments(ident))
val typed = c.typecheck(ident)
- assert(typed.attachments.get[MyAttachment.type].isDefined, typed.attachments)
+ assert(attachments(typed).get[MyAttachment.type].isDefined, attachments(typed))
c.Expr[Int](typed)
}
diff --git a/test/files/run/existentials3-new.scala b/test/files/run/existentials3-new.scala
index 6112a7b856..a422a7668f 100644
--- a/test/files/run/existentials3-new.scala
+++ b/test/files/run/existentials3-new.scala
@@ -1,5 +1,6 @@
import scala.language.existentials
import scala.reflect.runtime.universe._
+import internal._
object Test {
trait ToS { final override def toString = getClass.getName }
@@ -35,7 +36,7 @@ object Test {
val g12 = { abstract class A extends Seq[U forSome { type U <: Int }] ; List[A]() }
def printTpe(t: Type) = {
- val s = if (t.typeSymbol.isFreeType) t.typeSymbol.typeSignature.toString else t.typeSymbol.toString
+ val s = if (isFreeType(t.typeSymbol)) t.typeSymbol.typeSignature.toString else t.typeSymbol.toString
println("%s, t=%s, s=%s".format(t, t.asInstanceOf[Product].productPrefix, s))
}
def m[T: TypeTag](x: T) = printTpe(typeOf[T])
diff --git a/test/files/run/freetypes_false_alarm2.scala b/test/files/run/freetypes_false_alarm2.scala
index 3499f13fba..a517f7396b 100644
--- a/test/files/run/freetypes_false_alarm2.scala
+++ b/test/files/run/freetypes_false_alarm2.scala
@@ -1,8 +1,9 @@
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{universe => ru}
import scala.tools.reflect.Eval
+import internal._
object Test extends App {
val tpe = typeOf[ru.Type]
- println(tpe.typeSymbol.isFreeType)
+ println(isFreeType(tpe.typeSymbol))
} \ No newline at end of file
diff --git a/test/files/run/interop_typetags_are_manifests.scala b/test/files/run/interop_typetags_are_manifests.scala
index 1aca7f52cc..6dc5437819 100644
--- a/test/files/run/interop_typetags_are_manifests.scala
+++ b/test/files/run/interop_typetags_are_manifests.scala
@@ -1,5 +1,6 @@
import scala.reflect.runtime.universe._
import scala.reflect.ClassTag
+import internal._
object Test extends App {
def typeTagIsManifest[T: TypeTag : ClassTag] = {
diff --git a/test/files/run/macro-range/Common_1.scala b/test/files/run/macro-range/Common_1.scala
index 0e66815f15..35d2efd76d 100644
--- a/test/files/run/macro-range/Common_1.scala
+++ b/test/files/run/macro-range/Common_1.scala
@@ -12,6 +12,7 @@ abstract class RangeDefault {
abstract class Utils {
val context: Context
import context.universe._
+ import internal._
class TreeSubstituter(from: List[Symbol], to: List[Tree]) extends Transformer {
override def transform(tree: Tree): Tree = tree match {
@@ -23,7 +24,7 @@ abstract class Utils {
subst(from, to)
case _ =>
val tree1 = super.transform(tree)
- if (tree1 ne tree) tree1.tpe = null
+ if (tree1 ne tree) setType(tree1, null)
tree1
}
}
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 8d2aa1e70a..3bea04cead 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
@@ -23,10 +23,10 @@ case class Utils[C <: Context]( c:C ) {
object QueryableMacros{
def _helper[C <: Context,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = {
import c.universe._
- import treeBuild._
+ import internal._
val element_type = implicitly[c.WeakTypeTag[S]].tpe
val foo = c.Expr[ru.Expr[Queryable[S]]](
- c.reifyTree( mkRuntimeUniverseRef, EmptyTree, c.typecheck(
+ c.reifyTree( gen.mkRuntimeUniverseRef, EmptyTree, c.typecheck(
Utils[c.type](c).removeDoubleReify(
Apply(Select(c.prefix.tree, TermName( name )), List( projection.tree ))
).asInstanceOf[Tree]
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 8d2aa1e70a..3bea04cead 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
@@ -23,10 +23,10 @@ case class Utils[C <: Context]( c:C ) {
object QueryableMacros{
def _helper[C <: Context,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = {
import c.universe._
- import treeBuild._
+ import internal._
val element_type = implicitly[c.WeakTypeTag[S]].tpe
val foo = c.Expr[ru.Expr[Queryable[S]]](
- c.reifyTree( mkRuntimeUniverseRef, EmptyTree, c.typecheck(
+ c.reifyTree( gen.mkRuntimeUniverseRef, EmptyTree, c.typecheck(
Utils[c.type](c).removeDoubleReify(
Apply(Select(c.prefix.tree, TermName( name )), List( projection.tree ))
).asInstanceOf[Tree]
diff --git a/test/files/run/macro-reify-type/Macros_1.scala b/test/files/run/macro-reify-type/Macros_1.scala
index bac1744c50..6558492d07 100644
--- a/test/files/run/macro-reify-type/Macros_1.scala
+++ b/test/files/run/macro-reify-type/Macros_1.scala
@@ -6,6 +6,7 @@ object StaticReflect {
def methodImpl[A: c.WeakTypeTag](c: Context)(name: c.Expr[String]): c.Expr[ru.Type] = {
import c.universe._
+ import internal._
val nameName: TermName = name.tree match {
case Literal(Constant(str: String)) => TermName(str)
@@ -17,7 +18,7 @@ object StaticReflect {
case NoSymbol => c.error(c.enclosingPosition, s"No member called $nameName in $clazz.") ; reify(ru.NoType)
case member =>
val mtpe = member typeSignatureIn clazz
- val mtag = c.reifyType(treeBuild.mkRuntimeUniverseRef, Select(treeBuild.mkRuntimeUniverseRef, TermName("rootMirror")), mtpe)
+ val mtag = c.reifyType(gen.mkRuntimeUniverseRef, Select(gen.mkRuntimeUniverseRef, TermName("rootMirror")), mtpe)
val mtree = Select(mtag, TermName("tpe"))
c.Expr[ru.Type](mtree)
diff --git a/test/files/run/macro-reify-unreify/Macros_1.scala b/test/files/run/macro-reify-unreify/Macros_1.scala
index 6e358eb72d..d92dfa3e24 100644
--- a/test/files/run/macro-reify-unreify/Macros_1.scala
+++ b/test/files/run/macro-reify-unreify/Macros_1.scala
@@ -6,10 +6,10 @@ object Macros {
object Impls {
def foo(c: Context)(s: c.Expr[String]) = {
import c.universe._
- import treeBuild._
+ import internal._
- val world = c.reifyTree(mkRuntimeUniverseRef, EmptyTree, s.tree)
- val greeting = c.reifyTree(mkRuntimeUniverseRef, EmptyTree, c.typecheck(Apply(Select(Literal(Constant("hello ")), TermName("$plus")), List(c.unreifyTree(world)))))
+ val world = c.reifyTree(gen.mkRuntimeUniverseRef, EmptyTree, s.tree)
+ val greeting = c.reifyTree(gen.mkRuntimeUniverseRef, EmptyTree, c.typecheck(Apply(Select(Literal(Constant("hello ")), TermName("$plus")), List(c.unreifyTree(world)))))
val typedGreeting = c.Expr[String](greeting)
c.universe.reify {
diff --git a/test/files/run/macro-subpatterns/Macro_1.scala b/test/files/run/macro-subpatterns/Macro_1.scala
index 2de6b4da9d..994421aa32 100644
--- a/test/files/run/macro-subpatterns/Macro_1.scala
+++ b/test/files/run/macro-subpatterns/Macro_1.scala
@@ -4,15 +4,15 @@ import language.experimental.macros
object Extractor {
def unapply(x: Any): Any = macro unapplyImpl
def unapplyImpl(c: Context)(x: c.Tree) = {
- val st = c.universe.asInstanceOf[reflect.internal.SymbolTable]
- import st._
- val subpatterns = x.attachments.get[SubpatternsAttachment].get.patterns
+ import c.universe._
+ import internal._
+ val subpatterns = attachments(x).get[scala.reflect.internal.SymbolTable#SubpatternsAttachment].get.patterns.toString
q"""
new {
def isEmpty = false
- def get = ${subpatterns.toString}
+ def get = $subpatterns
def unapply(x: Any) = this
- }.unapply(${x.asInstanceOf[st.Tree]})
- """.asInstanceOf[c.Tree]
+ }.unapply($x)
+ """
}
}
diff --git a/test/files/run/macro-typecheck-macrosdisabled.check b/test/files/run/macro-typecheck-macrosdisabled.check
index 0579a4f4c8..c618d22d8d 100644
--- a/test/files/run/macro-typecheck-macrosdisabled.check
+++ b/test/files/run/macro-typecheck-macrosdisabled.check
@@ -23,7 +23,7 @@
def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Type = {
val $u: U = $m$untyped.universe;
val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
- $u.ConstantType.apply($u.Constant.apply(2))
+ $u.internal.reificationSupport.ConstantType($u.Constant.apply(2))
}
};
new $typecreator2()
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 eb558f49b5..5fb7ca1679 100644
--- a/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala
+++ b/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala
@@ -14,12 +14,13 @@ object Macros {
def impl_with_macros_disabled(c: Context) = {
import c.universe._
+ import internal._
val rupkg = c.mirror.staticModule("scala.reflect.runtime.package")
- val rusym = build.selectTerm(rupkg, "universe")
+ val rusym = reificationSupport.selectTerm(rupkg, "universe")
val NullaryMethodType(rutpe) = rusym.typeSignature
- val ru = build.newFreeTerm("ru", scala.reflect.runtime.universe)
- build.setTypeSignature(ru, rutpe)
+ val ru = reificationSupport.newFreeTerm("ru", scala.reflect.runtime.universe)
+ reificationSupport.setTypeSignature(ru, rutpe)
val tree2 = Apply(Select(Ident(ru), TermName("reify")), List(Literal(Constant(2))))
val ttree2 = c.typecheck(tree2, withMacrosDisabled = true)
diff --git a/test/files/run/macro-typecheck-macrosdisabled2.check b/test/files/run/macro-typecheck-macrosdisabled2.check
index c6e1c08d5d..c0f9c436fe 100644
--- a/test/files/run/macro-typecheck-macrosdisabled2.check
+++ b/test/files/run/macro-typecheck-macrosdisabled2.check
@@ -10,7 +10,7 @@
def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Tree = {
val $u: U = $m$untyped.universe;
val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
- $u.Apply.apply($u.Select.apply($u.build.Ident($m.staticModule("scala.Array")), $u.TermName.apply("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2))))
+ $u.Apply.apply($u.Select.apply($u.internal.reificationSupport.Ident($m.staticModule("scala.Array")), $u.TermName.apply("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2))))
}
};
new $treecreator1()
@@ -23,7 +23,7 @@
def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Type = {
val $u: U = $m$untyped.universe;
val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
- $u.TypeRef.apply($u.ThisType.apply($m.staticPackage("scala").asModule.moduleClass), $m.staticClass("scala.Array"), scala.collection.immutable.List.apply[$u.Type]($m.staticClass("scala.Int").asType.toTypeConstructor))
+ $u.internal.reificationSupport.TypeRef($u.internal.reificationSupport.ThisType($m.staticPackage("scala").asModule.moduleClass), $m.staticClass("scala.Array"), scala.collection.immutable.List.apply[$u.Type]($m.staticClass("scala.Int").asType.toTypeConstructor))
}
};
new $typecreator2()
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 3412f5c88f..9fa35dda83 100644
--- a/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala
+++ b/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala
@@ -14,12 +14,13 @@ object Macros {
def impl_with_macros_disabled(c: Context) = {
import c.universe._
+ import internal._
val rupkg = c.mirror.staticModule("scala.reflect.runtime.package")
- val rusym = build.selectTerm(rupkg, "universe")
+ val rusym = reificationSupport.selectTerm(rupkg, "universe")
val NullaryMethodType(rutpe) = rusym.typeSignature
- val ru = build.newFreeTerm("ru", scala.reflect.runtime.universe)
- build.setTypeSignature(ru, rutpe)
+ val ru = reificationSupport.newFreeTerm("ru", scala.reflect.runtime.universe)
+ reificationSupport.setTypeSignature(ru, rutpe)
val tree2 = Apply(Select(Ident(ru), TermName("reify")), List(Apply(Select(Ident(TermName("scala")), TermName("Array")), List(Literal(Constant(2))))))
val ttree2 = c.typecheck(tree2, withMacrosDisabled = true)
diff --git a/test/files/run/reflection-tags.scala b/test/files/run/reflection-tags.scala
index fba90f61e9..39bb8cf4e5 100644
--- a/test/files/run/reflection-tags.scala
+++ b/test/files/run/reflection-tags.scala
@@ -4,6 +4,9 @@ import scala.reflect.ClassTag
object Test extends App {
var typeMembers = typeOf[scala.reflect.api.Universe].members.filter(sym => sym.isType && !sym.isClass).toList
typeMembers = typeMembers.filter(_.name != TypeName("ModifiersCreator")) // type ModifiersCreator = ModifiersExtractor
+ typeMembers = typeMembers.filter(_.name != TypeName("Importer")) // deprecated
+ typeMembers = typeMembers.filter(_.name != TypeName("Internal")) // internal
+ typeMembers = typeMembers.filter(_.name != TypeName("Compat")) // internal
val tags = typeOf[scala.reflect.api.Universe].members.filter(sym => sym.isImplicit).toList
typeMembers.foreach(_.typeSignature)
diff --git a/test/files/run/reify_newimpl_45.scala b/test/files/run/reify_newimpl_45.scala
index 2a6c68d441..fd8011f468 100644
--- a/test/files/run/reify_newimpl_45.scala
+++ b/test/files/run/reify_newimpl_45.scala
@@ -2,13 +2,13 @@ import scala.reflect.runtime.universe._
import scala.reflect.runtime.{universe => ru}
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
+import internal._
object Test extends App {
class C[T >: Null] {
val code = reify{val x: T = "2".asInstanceOf[T]; println("ima worx: %s".format(x)); x}
- println(code.tree.freeTypes)
- val T = code.tree.freeTypes(0)
- val tree = code.tree.substituteSymbols(List(T), List(definitions.StringClass))
+ println(freeTypes(code.tree))
+ val tree = substituteSymbols(code.tree, freeTypes(code.tree), List(definitions.StringClass))
cm.mkToolBox().eval(tree)
}
diff --git a/test/files/run/t5923a/Macros_1.scala b/test/files/run/t5923a/Macros_1.scala
index 9aa7a02708..9050fd4b11 100644
--- a/test/files/run/t5923a/Macros_1.scala
+++ b/test/files/run/t5923a/Macros_1.scala
@@ -9,6 +9,7 @@ object C {
object Macros {
def impl[T](c: Context)(ttag: c.WeakTypeTag[T]) = {
import c.universe._
+ import internal._
val ttag0 = ttag;
{
// When we're expanding implicitly[C[Nothing]], the type inferencer will see
@@ -43,7 +44,7 @@ object Macros {
implicit def ttag: WeakTypeTag[T] = {
val tpe = ttag0.tpe
val sym = tpe.typeSymbol.asType
- if (sym.isParameter && !sym.isSkolem) TypeTag.Nothing.asInstanceOf[TypeTag[T]]
+ if (sym.isParameter && !isSkolem(sym)) TypeTag.Nothing.asInstanceOf[TypeTag[T]]
else ttag0
}
reify(C[T](c.Expr[String](Literal(Constant(weakTypeOf[T].toString))).splice))
diff --git a/test/files/run/t6221/Macros_1.scala b/test/files/run/t6221/Macros_1.scala
index b5c28360fa..0aeaa00c86 100644
--- a/test/files/run/t6221/Macros_1.scala
+++ b/test/files/run/t6221/Macros_1.scala
@@ -14,7 +14,8 @@ object ReflectiveClosure {
object Macros {
def reflectiveClosureImpl[A, B](c: Context)(f: c.Expr[A => B]): c.Expr[ReflectiveClosure[A, B]] = {
import c.universe._
- val u = treeBuild.mkRuntimeUniverseRef
+ import internal._
+ val u = gen.mkRuntimeUniverseRef
val m = EmptyTree
val tree = c.Expr[scala.reflect.runtime.universe.Tree](Select(c.reifyTree(u, m, f.tree), newTermName("tree")))
c.universe.reify(new ReflectiveClosure(tree.splice, f.splice))
diff --git a/test/files/run/t6591_7.scala b/test/files/run/t6591_7.scala
index b6c8d399a0..7313a3400d 100644
--- a/test/files/run/t6591_7.scala
+++ b/test/files/run/t6591_7.scala
@@ -1,5 +1,6 @@
import scala.reflect.runtime.universe._
import scala.tools.reflect.Eval
+import internal._
object Test extends App {
locally {
@@ -13,7 +14,7 @@ object Test extends App {
// blocked by SI-7103, though it's not the focus of this test
// therefore I'm just commenting out the evaluation
// println(expr.eval)
- expr.tree.freeTerms foreach (ft => {
+ freeTerms(expr.tree) foreach (ft => {
// blocked by SI-7104, though it's not the focus of this test
// therefore I'm just commenting out the call to typeSignature
// println(s"name = ${ft.name}, sig = ${ft.typeSignature}, stable = ${ft.isStable}")
diff --git a/test/files/run/t7570b.scala b/test/files/run/t7570b.scala
index f1db193186..9ed7c87885 100644
--- a/test/files/run/t7570b.scala
+++ b/test/files/run/t7570b.scala
@@ -6,8 +6,8 @@ import Flag._
object Test extends App {
val tb = cm.mkToolBox()
- val msg = build.newFreeTerm("msg", "C")
- build.setTypeSignature(msg, typeOf[String])
+ val msg = internal.reificationSupport.newFreeTerm("msg", "C")
+ internal.reificationSupport.setTypeSignature(msg, typeOf[String])
try {
val csym = tb.define(q"""class C { override def toString = $msg }""")
println(tb.eval(q"new $csym"))
diff --git a/test/files/run/t8190.scala b/test/files/run/t8190.scala
index 012d0ad347..d61fa8c01c 100644
--- a/test/files/run/t8190.scala
+++ b/test/files/run/t8190.scala
@@ -110,6 +110,9 @@ object Test extends App with Overloads {
types = types.filter(_ != "LiteralArgument") // deprecated
types = types.filter(_ != "ArrayArgument") // deprecated
types = types.filter(_ != "NestedArgument") // deprecated
+ types = types.filter(_ != "Importer") // deprecated
+ types = types.filter(_ != "Internal") // internal
+ types = types.filter(_ != "Compat") // internal
val diff = types.toList diff buf.toList
println("uncovered type members: " + diff)
}
diff --git a/test/files/run/toolbox_typecheck_macrosdisabled.check b/test/files/run/toolbox_typecheck_macrosdisabled.check
index d9e79cdd19..62de375826 100644
--- a/test/files/run/toolbox_typecheck_macrosdisabled.check
+++ b/test/files/run/toolbox_typecheck_macrosdisabled.check
@@ -32,7 +32,7 @@
def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Type = {
val $u: U = $m$untyped.universe;
val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
- $u.ConstantType.apply($u.Constant.apply(2))
+ $u.internal.reificationSupport.ConstantType($u.Constant.apply(2))
}
};
new $typecreator2()
diff --git a/test/files/run/toolbox_typecheck_macrosdisabled.scala b/test/files/run/toolbox_typecheck_macrosdisabled.scala
index 4cbeefd6e0..ab193808ab 100644
--- a/test/files/run/toolbox_typecheck_macrosdisabled.scala
+++ b/test/files/run/toolbox_typecheck_macrosdisabled.scala
@@ -2,6 +2,7 @@ import scala.reflect.runtime.universe._
import scala.reflect.runtime.{universe => ru}
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
+import internal._
// Note: If you're looking at this test and you don't know why, you may
// have accidentally changed the way type tags reify. If so, validate
@@ -10,10 +11,10 @@ import scala.tools.reflect.ToolBox
object Test extends App {
val toolbox = cm.mkToolBox()
val rupkg = cm.staticModule("scala.reflect.runtime.package")
- val rusym = build.selectTerm(rupkg, "universe")
+ val rusym = reificationSupport.selectTerm(rupkg, "universe")
val NullaryMethodType(rutpe) = rusym.typeSignature
- val ru = build.newFreeTerm("ru", scala.reflect.runtime.universe)
- build.setTypeSignature(ru, rutpe)
+ val ru = reificationSupport.newFreeTerm("ru", scala.reflect.runtime.universe)
+ reificationSupport.setTypeSignature(ru, rutpe)
val tree1 = Apply(Select(Ident(ru), TermName("reify")), List(Literal(Constant(2))))
val ttree1 = toolbox.typecheck(tree1, withMacrosDisabled = false)
diff --git a/test/files/run/toolbox_typecheck_macrosdisabled2.check b/test/files/run/toolbox_typecheck_macrosdisabled2.check
index 8e554a6c8f..ca56dd44ac 100644
--- a/test/files/run/toolbox_typecheck_macrosdisabled2.check
+++ b/test/files/run/toolbox_typecheck_macrosdisabled2.check
@@ -19,7 +19,7 @@
def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Tree = {
val $u: U = $m$untyped.universe;
val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
- $u.Apply.apply($u.Select.apply($u.build.Ident($m.staticModule("scala.Array")), $u.TermName.apply("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2))))
+ $u.Apply.apply($u.Select.apply($u.internal.reificationSupport.Ident($m.staticModule("scala.Array")), $u.TermName.apply("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2))))
}
};
new $treecreator1()
@@ -32,7 +32,7 @@
def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Type = {
val $u: U = $m$untyped.universe;
val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
- $u.TypeRef.apply($u.ThisType.apply($m.staticPackage("scala").asModule.moduleClass), $m.staticClass("scala.Array"), scala.collection.immutable.List.apply[$u.Type]($m.staticClass("scala.Int").asType.toTypeConstructor))
+ $u.internal.reificationSupport.TypeRef($u.internal.reificationSupport.ThisType($m.staticPackage("scala").asModule.moduleClass), $m.staticClass("scala.Array"), scala.collection.immutable.List.apply[$u.Type]($m.staticClass("scala.Int").asType.toTypeConstructor))
}
};
new $typecreator2()
diff --git a/test/files/run/toolbox_typecheck_macrosdisabled2.scala b/test/files/run/toolbox_typecheck_macrosdisabled2.scala
index 2fbd8f7c7a..94b6fb9249 100644
--- a/test/files/run/toolbox_typecheck_macrosdisabled2.scala
+++ b/test/files/run/toolbox_typecheck_macrosdisabled2.scala
@@ -2,6 +2,7 @@ import scala.reflect.runtime.universe._
import scala.reflect.runtime.{universe => ru}
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
+import internal._
// Note: If you're looking at this test and you don't know why, you may
// have accidentally changed the way type tags reify. If so, validate
@@ -10,10 +11,10 @@ import scala.tools.reflect.ToolBox
object Test extends App {
val toolbox = cm.mkToolBox()
val rupkg = cm.staticModule("scala.reflect.runtime.package")
- val rusym = build.selectTerm(rupkg, "universe")
+ val rusym = reificationSupport.selectTerm(rupkg, "universe")
val NullaryMethodType(rutpe) = rusym.typeSignature
- val ru = build.newFreeTerm("ru", scala.reflect.runtime.universe)
- build.setTypeSignature(ru, rutpe)
+ val ru = reificationSupport.newFreeTerm("ru", scala.reflect.runtime.universe)
+ reificationSupport.setTypeSignature(ru, rutpe)
val tree1 = Apply(Select(Ident(ru), TermName("reify")), List(Apply(Select(Ident(TermName("scala")), TermName("Array")), List(Literal(Constant(2))))))
val ttree1 = toolbox.typecheck(tree1, withMacrosDisabled = false)
diff --git a/test/files/scalacheck/quasiquotes/ArbitraryTreesAndNames.scala b/test/files/scalacheck/quasiquotes/ArbitraryTreesAndNames.scala
index fe90d7222f..7bd37140a7 100644
--- a/test/files/scalacheck/quasiquotes/ArbitraryTreesAndNames.scala
+++ b/test/files/scalacheck/quasiquotes/ArbitraryTreesAndNames.scala
@@ -1,5 +1,5 @@
import org.scalacheck._, Prop._, Gen._, Arbitrary._
-import scala.reflect.runtime.universe._, Flag._
+import scala.reflect.runtime.universe._, internal._, Flag._
trait ArbitraryTreesAndNames {
def smallList[T](size: Int, g: Gen[T]) = {
diff --git a/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala b/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala
index dcd4f63a4d..618ea5be11 100644
--- a/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala
@@ -1,5 +1,5 @@
import org.scalacheck._, Prop._, Gen._, Arbitrary._
-import scala.reflect.runtime.universe._, Flag._, build.ScalaDot
+import scala.reflect.runtime.universe._, Flag._, internal.reificationSupport.ScalaDot
object DefinitionConstructionProps
extends QuasiquoteProperties("definition construction")
diff --git a/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala
index e2d1757d48..e9337bc584 100644
--- a/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala
@@ -1,5 +1,5 @@
import org.scalacheck._, Prop._, Gen._, Arbitrary._
-import scala.reflect.runtime.universe._, Flag._
+import scala.reflect.runtime.universe._, Flag._, internal.reificationSupport.SyntacticClassDef
object DefinitionDeconstructionProps
extends QuasiquoteProperties("definition deconstruction")
@@ -94,7 +94,7 @@ trait ClassDeconstruction { self: QuasiquoteProperties =>
property("SI-7979") = test {
val PARAMACCESSOR = (1 << 29).toLong.asInstanceOf[FlagSet]
assertThrows[MatchError] {
- val build.SyntacticClassDef(_, _, _, _, _, _, _, _, _) =
+ val SyntacticClassDef(_, _, _, _, _, _, _, _, _) =
ClassDef(
Modifiers(), TypeName("Foo"), List(),
Template(
diff --git a/test/files/scalacheck/quasiquotes/ForProps.scala b/test/files/scalacheck/quasiquotes/ForProps.scala
index e71822aaea..87ff7f8205 100644
--- a/test/files/scalacheck/quasiquotes/ForProps.scala
+++ b/test/files/scalacheck/quasiquotes/ForProps.scala
@@ -1,5 +1,5 @@
import org.scalacheck._, Prop._, Gen._, Arbitrary._
-import scala.reflect.runtime.universe._, Flag._, build.{Ident => _, _}
+import scala.reflect.runtime.universe._, Flag._, internal.reificationSupport.{Ident => _, _}
object ForProps extends QuasiquoteProperties("for") {
case class ForEnums(val value: List[Tree])
diff --git a/test/files/scalacheck/quasiquotes/QuasiquoteProperties.scala b/test/files/scalacheck/quasiquotes/QuasiquoteProperties.scala
index 589b8d4d72..2600b0c120 100644
--- a/test/files/scalacheck/quasiquotes/QuasiquoteProperties.scala
+++ b/test/files/scalacheck/quasiquotes/QuasiquoteProperties.scala
@@ -1,7 +1,7 @@
import org.scalacheck._, Prop._, Gen._, Arbitrary._
import scala.tools.reflect.{ToolBox, ToolBoxError}
import scala.reflect.runtime.currentMirror
-import scala.reflect.runtime.universe._, Flag._
+import scala.reflect.runtime.universe._, Flag._, internal.reificationSupport.setSymbol
class QuasiquoteProperties(name: String) extends Properties(name) with ArbitraryTreesAndNames with Helpers
@@ -116,5 +116,5 @@ trait Helpers {
}
}
- val scalapkg = build.setSymbol(Ident(TermName("scala")), definitions.ScalaPackage)
+ val scalapkg = setSymbol(Ident(TermName("scala")), definitions.ScalaPackage)
}
diff --git a/test/files/scalacheck/quasiquotes/TypeConstructionProps.scala b/test/files/scalacheck/quasiquotes/TypeConstructionProps.scala
index 78b54a4e49..ea9f734a0b 100644
--- a/test/files/scalacheck/quasiquotes/TypeConstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/TypeConstructionProps.scala
@@ -1,5 +1,5 @@
import org.scalacheck._, Prop._, Gen._, Arbitrary._
-import scala.reflect.runtime.universe._, Flag._
+import scala.reflect.runtime.universe._, Flag._, internal.reificationSupport.ScalaDot
object TypeConstructionProps extends QuasiquoteProperties("type construction") {
property("bare idents contain type names") = test {
@@ -13,7 +13,7 @@ object TypeConstructionProps extends QuasiquoteProperties("type construction")
property("tuple type") = test {
val empty = List[Tree]()
val ts = List(tq"t1", tq"t2")
- assert(tq"(..$empty)" ≈ build.ScalaDot(TypeName("Unit")))
+ assert(tq"(..$empty)" ≈ ScalaDot(TypeName("Unit")))
assert(tq"(..$ts)" ≈ tq"scala.Tuple2[t1, t2]")
assert(tq"(t0, ..$ts)" ≈ tq"scala.Tuple3[t0, t1, t2]")
}
diff --git a/test/files/scalacheck/quasiquotes/TypecheckedProps.scala b/test/files/scalacheck/quasiquotes/TypecheckedProps.scala
index 3afb47952c..1f8df168cf 100644
--- a/test/files/scalacheck/quasiquotes/TypecheckedProps.scala
+++ b/test/files/scalacheck/quasiquotes/TypecheckedProps.scala
@@ -1,5 +1,5 @@
import org.scalacheck._, Prop._, Gen._, Arbitrary._
-import scala.reflect.runtime.universe._, Flag._, build.{Ident => _, _}
+import scala.reflect.runtime.universe._, Flag._, internal.reificationSupport.{Ident => _, _}
object TypecheckedProps extends QuasiquoteProperties("typechecked") {
def original(tree: Tree) = tree match {