diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-09-19 15:04:38 -0700 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-09-19 15:04:38 -0700 |
commit | 3b120ff12891968d02296abb60adb9137d335ae2 (patch) | |
tree | d6ffd5abe0c5b53543185d2b40ecc5966c304d1a /test/files | |
parent | dbe69dc0db04e32f8c9b254470ca1fc9c9a8f516 (diff) | |
parent | d3095cbeb29ae53d6796103b33a37560e9ba2cce (diff) | |
download | scala-3b120ff12891968d02296abb60adb9137d335ae2.tar.gz scala-3b120ff12891968d02296abb60adb9137d335ae2.tar.bz2 scala-3b120ff12891968d02296abb60adb9137d335ae2.zip |
Merge pull request #1354 from scalamacros/ticket/6363
merges scala.reflect.base into scala.reflect.api
Diffstat (limited to 'test/files')
20 files changed, 137 insertions, 116 deletions
diff --git a/test/files/neg/macro-invalidret-nonuniversetree.check b/test/files/neg/macro-invalidret-nonuniversetree.check index 09df2c0a92..b3a4d0da80 100644 --- a/test/files/neg/macro-invalidret-nonuniversetree.check +++ b/test/files/neg/macro-invalidret-nonuniversetree.check @@ -1,7 +1,7 @@ Macros_Test_2.scala:2: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context): c.Expr[Any]
- found : (c: scala.reflect.macros.Context): reflect.basis.Literal
-type mismatch for return type: reflect.basis.Literal does not conform to c.Expr[Any]
+ found : (c: scala.reflect.macros.Context): reflect.runtime.universe.Literal
+type mismatch for return type: reflect.runtime.universe.Literal does not conform to c.Expr[Any]
def foo = macro Impls.foo
^
one error found
diff --git a/test/files/neg/macro-invalidret-nonuniversetree/Impls_1.scala b/test/files/neg/macro-invalidret-nonuniversetree/Impls_1.scala index 8311d474c2..f98376a2ba 100644 --- a/test/files/neg/macro-invalidret-nonuniversetree/Impls_1.scala +++ b/test/files/neg/macro-invalidret-nonuniversetree/Impls_1.scala @@ -1,5 +1,6 @@ import scala.reflect.macros.{Context => Ctx} +import scala.reflect.runtime.{universe => ru} object Impls { - def foo(c: Ctx) = scala.reflect.basis.Literal(scala.reflect.basis.Constant(42)) + def foo(c: Ctx) = ru.Literal(ru.Constant(42)) } diff --git a/test/files/pos/typetags.scala b/test/files/pos/typetags.scala index 33390d7b89..239a9b32ec 100644 --- a/test/files/pos/typetags.scala +++ b/test/files/pos/typetags.scala @@ -1,12 +1,16 @@ -import scala.reflect.{basis => rb} -import scala.reflect.runtime.{universe => ru} +// TODO come up with a non-trivial universe different from ru +// an rewrite this test, so that it makes sure that cross-universe implicit searches work +// +// import scala.reflect.{basis => rb} +// import scala.reflect.runtime.{universe => ru} +// object Test { +// def main(args: Array[String]) { +// def foo(implicit t: rb.TypeTag[List[Int]]) { +// println(t) +// val t2: ru.TypeTag[_] = t in ru.rootMirror +// println(t2) +// } +// } +// } -object Test { - def main(args: Array[String]) { - def foo(implicit t: rb.TypeTag[List[Int]]) { - println(t) - val t2: ru.TypeTag[_] = t in ru.rootMirror - println(t2) - } - } -} +object Test extends App
\ No newline at end of file diff --git a/test/files/run/abstypetags_serialize.scala b/test/files/run/abstypetags_serialize.scala index 38a7aba325..93fb5dcd06 100644 --- a/test/files/run/abstypetags_serialize.scala +++ b/test/files/run/abstypetags_serialize.scala @@ -1,5 +1,6 @@ import java.io._ import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} import scala.reflect.runtime.{currentMirror => cm} object Test extends App { @@ -13,7 +14,7 @@ object Test extends App { val fin = new ByteArrayInputStream(fout.toByteArray) val in = new ObjectInputStream(fin) - val retag = in.readObject().asInstanceOf[scala.reflect.basis.WeakTypeTag[_]].in(cm) + val retag = in.readObject().asInstanceOf[ru.WeakTypeTag[_]].in(cm) in.close() fin.close() diff --git a/test/files/run/exprs_serialize.scala b/test/files/run/exprs_serialize.scala index 075c902a34..c4310b0fe1 100644 --- a/test/files/run/exprs_serialize.scala +++ b/test/files/run/exprs_serialize.scala @@ -1,5 +1,6 @@ import java.io._ import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} import scala.reflect.runtime.{currentMirror => cm} object Test extends App { @@ -13,7 +14,7 @@ object Test extends App { val fin = new ByteArrayInputStream(fout.toByteArray) val in = new ObjectInputStream(fin) - val reexpr = in.readObject().asInstanceOf[scala.reflect.basis.Expr[_]].in(cm) + val reexpr = in.readObject().asInstanceOf[ru.Expr[_]].in(cm) in.close() fin.close() 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 86c4198870..b1665256cd 100644 --- a/test/files/run/macro-expand-implicit-argument/Macros_1.scala +++ b/test/files/run/macro-expand-implicit-argument/Macros_1.scala @@ -4,7 +4,7 @@ import scala.{specialized => spec} import language.experimental.macros -import scala.reflect.{ClassTag, TypeTag} +import scala.reflect.ClassTag import scala.reflect.macros.Context object Macros { diff --git a/test/files/run/macro-typecheck-macrosdisabled.check b/test/files/run/macro-typecheck-macrosdisabled.check index c560b0e4b5..c88d33b48e 100644 --- a/test/files/run/macro-typecheck-macrosdisabled.check +++ b/test/files/run/macro-typecheck-macrosdisabled.check @@ -7,7 +7,7 @@ $treecreator1.super.<init>();
()
};
- def apply[U >: Nothing <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Tree = {
+ def apply[U >: Nothing <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.MirrorOf[U]): U#Tree = {
val $u: U = $m$untyped.universe;
val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
$u.Literal.apply($u.Constant.apply(2))
@@ -20,7 +20,7 @@ $typecreator2.super.<init>();
()
};
- def apply[U >: Nothing <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Type = {
+ def apply[U >: Nothing <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.MirrorOf[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))
diff --git a/test/files/run/macro-typecheck-macrosdisabled2.check b/test/files/run/macro-typecheck-macrosdisabled2.check index 55e7913250..469f41aa94 100644 --- a/test/files/run/macro-typecheck-macrosdisabled2.check +++ b/test/files/run/macro-typecheck-macrosdisabled2.check @@ -7,7 +7,7 @@ $treecreator1.super.<init>();
()
};
- def apply[U >: Nothing <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Tree = {
+ def apply[U >: Nothing <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.MirrorOf[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.Select.apply($u.build.Ident($m.staticPackage("scala")), $u.newTermName("Array")), $u.newTermName("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2))))
@@ -20,7 +20,7 @@ $typecreator2.super.<init>();
()
};
- def apply[U >: Nothing <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Type = {
+ def apply[U >: Nothing <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.MirrorOf[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))
diff --git a/test/files/run/newTags.check b/test/files/run/newTags.check index 2cbc265d7a..0c1bd95eb2 100644 --- a/test/files/run/newTags.check +++ b/test/files/run/newTags.check @@ -1,5 +1,3 @@ -TypeRef(SingleType(SingleType(SingleType(NoPrefix,class <root>),module scala),module package),class List,List(TypeRef(ThisType(class scala),class Int,List())))
List[Int]
-TypeRef(SingleType(ThisType(class scala),module Predef),class Map,List(TypeRef(SingleType(ThisType(class scala),module Predef),class String,List()), TypeRef(SingleType(ThisType(class scala),module Predef),class String,List())))
Map[String,String]
-TypeTag[TypeRef(SingleType(ThisType(class scala),module Predef),class Map,List(TypeRef(SingleType(ThisType(class scala),module Predef),class String,List()), TypeRef(SingleType(ThisType(class scala),module Predef),class String,List())))]
+TypeTag[Map[String,String]]
diff --git a/test/files/run/newTags.scala b/test/files/run/newTags.scala index a758599515..c5199d4e55 100644 --- a/test/files/run/newTags.scala +++ b/test/files/run/newTags.scala @@ -1,14 +1,11 @@ -import scala.reflect.base.{Universe => BaseUniverse} -import scala.reflect.{basis => rb} +import scala.reflect.api.{Universe => ApiUniverse} import scala.reflect.runtime.{universe => ru} object Test extends App { - println(rb.typeOf[List[Int]]) println(ru.typeOf[List[Int]]) - def foo[T: rb.TypeTag] = { - println(rb.typeOf[T]) + def foo[T: ru.TypeTag] = { println(ru.typeOf[T]) - println(implicitly[BaseUniverse#TypeTag[T]]) + println(implicitly[ApiUniverse#TypeTag[T]]) } foo[Map[String, String]] }
\ No newline at end of file diff --git a/test/files/run/reflection-magicsymbols-invoke.check b/test/files/run/reflection-magicsymbols-invoke.check index 674716adfe..bef492eb54 100644 --- a/test/files/run/reflection-magicsymbols-invoke.check +++ b/test/files/run/reflection-magicsymbols-invoke.check @@ -121,4 +121,4 @@ testing String.+: 23 CTM
testing Predef.classOf: class scala.ScalaReflectionException: Predef.classOf is a compile-time function, it cannot be invoked with mirrors
testing Predef.classOf: class scala.ScalaReflectionException: scala.Predef.classOf[T]: Class[T] takes 0 arguments
-testing Universe.reify: class scala.ScalaReflectionException: scala.reflect.base.Universe.reify is a macro, i.e. a compile-time function, it cannot be invoked with mirrors
+testing Universe.reify: class scala.ScalaReflectionException: scala.reflect.api.Universe.reify is a macro, i.e. a compile-time function, it cannot be invoked with mirrors
diff --git a/test/files/run/reflection-magicsymbols-invoke.scala b/test/files/run/reflection-magicsymbols-invoke.scala index 61ecc6458d..b38d1be7b2 100644 --- a/test/files/run/reflection-magicsymbols-invoke.scala +++ b/test/files/run/reflection-magicsymbols-invoke.scala @@ -90,5 +90,5 @@ object Test extends App { println("============\nCTM") test(PredefModule.moduleClass.typeSignature, Predef, "classOf") test(PredefModule.moduleClass.typeSignature, Predef, "classOf", typeOf[String]) - test(typeOf[scala.reflect.base.Universe], scala.reflect.runtime.universe, "reify", "2") + test(typeOf[scala.reflect.api.Universe], scala.reflect.runtime.universe, "reify", "2") }
\ No newline at end of file diff --git a/test/files/run/t6394b.check b/test/files/run/t6394b.check new file mode 100644 index 0000000000..34997f71e3 --- /dev/null +++ b/test/files/run/t6394b.check @@ -0,0 +1 @@ +TEST
diff --git a/test/files/run/t6394b.flags b/test/files/run/t6394b.flags new file mode 100644 index 0000000000..cd66464f2f --- /dev/null +++ b/test/files/run/t6394b.flags @@ -0,0 +1 @@ +-language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/t6394b/Macros_1.scala b/test/files/run/t6394b/Macros_1.scala new file mode 100644 index 0000000000..5d93e1cda8 --- /dev/null +++ b/test/files/run/t6394b/Macros_1.scala @@ -0,0 +1,12 @@ +import scala.reflect.macros.Context + +object Macros { + def impl(c:Context): c.Expr[Any] = { + import c.universe._ + + val selfTree = This(tpnme.EMPTY) + c.Expr[AnyRef](selfTree) + } + + def foo: Any = macro impl +}
\ No newline at end of file diff --git a/test/files/run/t6394b/Test_2.scala b/test/files/run/t6394b/Test_2.scala new file mode 100644 index 0000000000..75e84f0e38 --- /dev/null +++ b/test/files/run/t6394b/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + println(Macros.foo) + override def toString = "TEST" +}
\ No newline at end of file diff --git a/test/files/run/toolbox_typecheck_macrosdisabled.check b/test/files/run/toolbox_typecheck_macrosdisabled.check index 4d253f31fc..49e25bd0e7 100644 --- a/test/files/run/toolbox_typecheck_macrosdisabled.check +++ b/test/files/run/toolbox_typecheck_macrosdisabled.check @@ -1,41 +1,41 @@ -{ - val $u: ru.type = ru; - val $m: $u.Mirror = ru.runtimeMirror({ - final class $anon extends scala.AnyRef { - def <init>(): anonymous class $anon = { - $anon.super.<init>(); - () - }; - () - }; - new $anon() -}.getClass().getClassLoader()); - $u.Expr.apply[Int(2)]($m, { - final class $treecreator1 extends TreeCreator { - def <init>(): $treecreator1 = { - $treecreator1.super.<init>(); - () - }; - def apply[U <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Tree = { - val $u: U = $m$untyped.universe; - val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; - $u.Literal.apply($u.Constant.apply(2)) - } - }; - new $treecreator1() - })($u.TypeTag.apply[Int(2)]($m, { - final class $typecreator2 extends TypeCreator { - def <init>(): $typecreator2 = { - $typecreator2.super.<init>(); - () - }; - def apply[U <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[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)) - } - }; - new $typecreator2() - })) -} -ru.reify[Int](2) +{
+ val $u: ru.type = ru;
+ val $m: $u.Mirror = ru.runtimeMirror({
+ final class $anon extends scala.AnyRef {
+ def <init>(): anonymous class $anon = {
+ $anon.super.<init>();
+ ()
+ };
+ ()
+ };
+ new $anon()
+}.getClass().getClassLoader());
+ $u.Expr.apply[Int(2)]($m, {
+ final class $treecreator1 extends TreeCreator {
+ def <init>(): $treecreator1 = {
+ $treecreator1.super.<init>();
+ ()
+ };
+ def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.MirrorOf[U]): U#Tree = {
+ val $u: U = $m$untyped.universe;
+ val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
+ $u.Literal.apply($u.Constant.apply(2))
+ }
+ };
+ new $treecreator1()
+ })($u.TypeTag.apply[Int(2)]($m, {
+ final class $typecreator2 extends TypeCreator {
+ def <init>(): $typecreator2 = {
+ $typecreator2.super.<init>();
+ ()
+ };
+ def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.MirrorOf[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))
+ }
+ };
+ new $typecreator2()
+ }))
+}
+ru.reify[Int](2)
diff --git a/test/files/run/toolbox_typecheck_macrosdisabled2.check b/test/files/run/toolbox_typecheck_macrosdisabled2.check index 149c3def12..8bbe65e21b 100644 --- a/test/files/run/toolbox_typecheck_macrosdisabled2.check +++ b/test/files/run/toolbox_typecheck_macrosdisabled2.check @@ -1,41 +1,41 @@ -{ - val $u: ru.type = ru; - val $m: $u.Mirror = ru.runtimeMirror({ - final class $anon extends scala.AnyRef { - def <init>(): anonymous class $anon = { - $anon.super.<init>(); - () - }; - () - }; - new $anon() -}.getClass().getClassLoader()); - $u.Expr.apply[Array[Int]]($m, { - final class $treecreator1 extends TreeCreator { - def <init>(): $treecreator1 = { - $treecreator1.super.<init>(); - () - }; - def apply[U <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[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.Select.apply($u.build.Ident($m.staticPackage("scala")), $u.newTermName("Array")), $u.newTermName("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2)))) - } - }; - new $treecreator1() - })($u.TypeTag.apply[Array[Int]]($m, { - final class $typecreator2 extends TypeCreator { - def <init>(): $typecreator2 = { - $typecreator2.super.<init>(); - () - }; - def apply[U <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[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)) - } - }; - new $typecreator2() - })) -} -ru.reify[Array[Int]](scala.Array.apply(2)) +{
+ val $u: ru.type = ru;
+ val $m: $u.Mirror = ru.runtimeMirror({
+ final class $anon extends scala.AnyRef {
+ def <init>(): anonymous class $anon = {
+ $anon.super.<init>();
+ ()
+ };
+ ()
+ };
+ new $anon()
+}.getClass().getClassLoader());
+ $u.Expr.apply[Array[Int]]($m, {
+ final class $treecreator1 extends TreeCreator {
+ def <init>(): $treecreator1 = {
+ $treecreator1.super.<init>();
+ ()
+ };
+ def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.MirrorOf[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.Select.apply($u.build.Ident($m.staticPackage("scala")), $u.newTermName("Array")), $u.newTermName("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2))))
+ }
+ };
+ new $treecreator1()
+ })($u.TypeTag.apply[Array[Int]]($m, {
+ final class $typecreator2 extends TypeCreator {
+ def <init>(): $typecreator2 = {
+ $typecreator2.super.<init>();
+ ()
+ };
+ def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.MirrorOf[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))
+ }
+ };
+ new $typecreator2()
+ }))
+}
+ru.reify[Array[Int]](scala.Array.apply(2))
diff --git a/test/files/run/typetags_serialize.check b/test/files/run/typetags_serialize.check index 1b898250fb..30952113f6 100644 --- a/test/files/run/typetags_serialize.check +++ b/test/files/run/typetags_serialize.check @@ -1,2 +1,2 @@ -java.io.NotSerializableException: scala.reflect.base.TypeTags$PredefTypeCreator
+java.io.NotSerializableException: scala.reflect.api.TypeTags$PredefTypeCreator
java.io.NotSerializableException: Test$$typecreator1$1
diff --git a/test/files/run/typetags_serialize.scala b/test/files/run/typetags_serialize.scala index 3917b69a93..3c842e6cc9 100644 --- a/test/files/run/typetags_serialize.scala +++ b/test/files/run/typetags_serialize.scala @@ -1,5 +1,6 @@ import java.io._ import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} import scala.reflect.runtime.{currentMirror => cm} object Test extends App { @@ -13,7 +14,7 @@ object Test extends App { val fin = new ByteArrayInputStream(fout.toByteArray) val in = new ObjectInputStream(fin) - val retag = in.readObject().asInstanceOf[scala.reflect.basis.TypeTag[_]].in(cm) + val retag = in.readObject().asInstanceOf[ru.TypeTag[_]].in(cm) in.close() fin.close() |