diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-06-04 13:53:13 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-06-08 15:32:17 +0200 |
commit | 7b0f0a142bb526f4bd108a8c208ec9a8952398c9 (patch) | |
tree | ee13d036756be41521a9eb3f1e05898410ab744e /test/files/run | |
parent | d9103e01b467634d61baa3b131aeb93fca9e20a5 (diff) | |
download | scala-7b0f0a142bb526f4bd108a8c208ec9a8952398c9.tar.gz scala-7b0f0a142bb526f4bd108a8c208ec9a8952398c9.tar.bz2 scala-7b0f0a142bb526f4bd108a8c208ec9a8952398c9.zip |
repairs the tests after the refactoring spree
Diffstat (limited to 'test/files/run')
402 files changed, 2036 insertions, 1359 deletions
diff --git a/test/files/run/arrayclone-new.scala b/test/files/run/arrayclone-new.scala index a4ba021409..a8fb9ee58c 100644 --- a/test/files/run/arrayclone-new.scala +++ b/test/files/run/arrayclone-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ArrayTag, arrayTag} + object Test extends App{ BooleanArrayClone; ByteArrayClone; @@ -103,4 +105,4 @@ object PolymorphicArrayClone{ val y : Array[Int] = mangled.it; // make sure it's unboxed testIt(mangled.it, 0, 1); -} +}
\ No newline at end of file diff --git a/test/files/run/arraytags_basic.scala b/test/files/run/arraytags_basic.scala index edc20e9bc1..629ee26192 100644 --- a/test/files/run/arraytags_basic.scala +++ b/test/files/run/arraytags_basic.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ArrayTag, arrayTag} + object Test extends App { def test[T: ArrayTag] = { println(implicitly[ArrayTag[T]].newArray(10).getClass) diff --git a/test/files/run/arraytags_core.scala b/test/files/run/arraytags_core.scala index a59ae24f30..58b9094230 100644 --- a/test/files/run/arraytags_core.scala +++ b/test/files/run/arraytags_core.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ArrayTag, arrayTag} + object Test extends App { println(implicitly[ArrayTag[Byte]].newArray(10).getClass) println(implicitly[ArrayTag[Byte]].wrap.newArray(10).getClass) diff --git a/test/files/run/arraytags_usage.scala b/test/files/run/arraytags_usage.scala index 60b0a8f218..507e91987b 100644 --- a/test/files/run/arraytags_usage.scala +++ b/test/files/run/arraytags_usage.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ArrayTag, arrayTag} + object Test extends App { def foo[T] = { class MyArrayTag extends ArrayTag[T] { diff --git a/test/files/run/classtags_contextbound.scala b/test/files/run/classtags_contextbound.scala index 5bb0ae8d80..2f12792154 100644 --- a/test/files/run/classtags_contextbound.scala +++ b/test/files/run/classtags_contextbound.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ClassTag, classTag} + object Test extends App { def mkArray[T: ClassTag] = Array[T]() def foo[T: ClassTag] = mkArray[T] diff --git a/test/files/run/classtags_core.check b/test/files/run/classtags_core.check index ebccfcd54c..7beada3f1c 100644 --- a/test/files/run/classtags_core.check +++ b/test/files/run/classtags_core.check @@ -1,32 +1,28 @@ -true -ClassTag[byte] -true -ClassTag[short] -true -ClassTag[char] -true -ClassTag[int] -true -ClassTag[long] -true -ClassTag[float] -true -ClassTag[double] -true -ClassTag[boolean] -true -ClassTag[void] -true -ClassTag[class java.lang.Object] -true -ClassTag[class java.lang.Object] -true -ClassTag[class java.lang.Object] -true -ClassTag[class java.lang.Object] -true -ClassTag[class scala.runtime.Null$] -true -ClassTag[class scala.runtime.Nothing$] -true -ClassTag[class java.lang.String] +true
+ClassTag[byte]
+true
+ClassTag[short]
+true
+ClassTag[char]
+true
+ClassTag[int]
+true
+ClassTag[long]
+true
+ClassTag[float]
+true
+ClassTag[double]
+true
+ClassTag[boolean]
+true
+ClassTag[void]
+true
+ClassTag[class java.lang.Object]
+true
+ClassTag[class java.lang.Object]
+true
+ClassTag[class scala.runtime.Null$]
+true
+ClassTag[class scala.runtime.Nothing$]
+true
+ClassTag[class java.lang.String]
diff --git a/test/files/run/classtags_core.scala b/test/files/run/classtags_core.scala index 9f2031377d..17c69d9c41 100644 --- a/test/files/run/classtags_core.scala +++ b/test/files/run/classtags_core.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ClassTag, classTag} + object Test extends App { println(implicitly[ClassTag[Byte]] eq ClassTag.Byte) println(implicitly[ClassTag[Byte]]) @@ -21,10 +23,6 @@ object Test extends App { println(implicitly[ClassTag[Any]]) println(implicitly[ClassTag[Object]] eq ClassTag.Object) println(implicitly[ClassTag[Object]]) - println(implicitly[ClassTag[AnyVal]] eq ClassTag.AnyVal) - println(implicitly[ClassTag[AnyVal]]) - println(implicitly[ClassTag[AnyRef]] eq ClassTag.AnyRef) - println(implicitly[ClassTag[AnyRef]]) println(implicitly[ClassTag[Null]] eq ClassTag.Null) println(implicitly[ClassTag[Null]]) println(implicitly[ClassTag[Nothing]] eq ClassTag.Nothing) diff --git a/test/files/run/classtags_multi.scala b/test/files/run/classtags_multi.scala index 5aafb55223..b4b47bcf0e 100644 --- a/test/files/run/classtags_multi.scala +++ b/test/files/run/classtags_multi.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ClassTag, classTag} + object Test extends App { println(classTag[Int]) println(classTag[Array[Int]]) diff --git a/test/files/run/classtags_use_concretetypetags.scala b/test/files/run/classtags_use_concretetypetags.scala deleted file mode 100644 index 57e7085cec..0000000000 --- a/test/files/run/classtags_use_concretetypetags.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test extends App { - def foo[T: ConcreteTypeTag] = Array[T]() -}
\ No newline at end of file diff --git a/test/files/run/concretetypetags_core.check b/test/files/run/concretetypetags_core.check index f124aa6a35..e5308bf9c7 100644 --- a/test/files/run/concretetypetags_core.check +++ b/test/files/run/concretetypetags_core.check @@ -1,32 +1,28 @@ -true -ConcreteTypeTag[Byte] -true -ConcreteTypeTag[Short] -true -ConcreteTypeTag[Char] -true -ConcreteTypeTag[Int] -true -ConcreteTypeTag[Long] -true -ConcreteTypeTag[Float] -true -ConcreteTypeTag[Double] -true -ConcreteTypeTag[Boolean] -true -ConcreteTypeTag[Unit] -true -ConcreteTypeTag[Any] -true -ConcreteTypeTag[Object] -true -ConcreteTypeTag[AnyVal] -true -ConcreteTypeTag[AnyRef] -true -ConcreteTypeTag[Null] -true -ConcreteTypeTag[Nothing] -true -ConcreteTypeTag[String] +true
+ConcreteTypeTag[Byte]
+true
+ConcreteTypeTag[Short]
+true
+ConcreteTypeTag[Char]
+true
+ConcreteTypeTag[Int]
+true
+ConcreteTypeTag[Long]
+true
+ConcreteTypeTag[Float]
+true
+ConcreteTypeTag[Double]
+true
+ConcreteTypeTag[Boolean]
+true
+ConcreteTypeTag[Unit]
+true
+ConcreteTypeTag[Any]
+true
+ConcreteTypeTag[java.lang.Object]
+true
+ConcreteTypeTag[Null]
+true
+ConcreteTypeTag[Nothing]
+true
+ConcreteTypeTag[java.lang.String]
diff --git a/test/files/run/concretetypetags_core.scala b/test/files/run/concretetypetags_core.scala index b6cfea3895..ea7060ec6c 100644 --- a/test/files/run/concretetypetags_core.scala +++ b/test/files/run/concretetypetags_core.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + object Test extends App { println(implicitly[ConcreteTypeTag[Byte]] eq ConcreteTypeTag.Byte) println(implicitly[ConcreteTypeTag[Byte]]) @@ -21,10 +23,6 @@ object Test extends App { println(implicitly[ConcreteTypeTag[Any]]) println(implicitly[ConcreteTypeTag[Object]] eq ConcreteTypeTag.Object) println(implicitly[ConcreteTypeTag[Object]]) - println(implicitly[ConcreteTypeTag[AnyVal]] eq ConcreteTypeTag.AnyVal) - println(implicitly[ConcreteTypeTag[AnyVal]]) - println(implicitly[ConcreteTypeTag[AnyRef]] eq ConcreteTypeTag.AnyRef) - println(implicitly[ConcreteTypeTag[AnyRef]]) println(implicitly[ConcreteTypeTag[Null]] eq ConcreteTypeTag.Null) println(implicitly[ConcreteTypeTag[Null]]) println(implicitly[ConcreteTypeTag[Nothing]] eq ConcreteTypeTag.Nothing) diff --git a/test/files/run/concretetypetags_multi.scala b/test/files/run/concretetypetags_multi.scala index 7e19d7db34..0b5d648877 100644 --- a/test/files/run/concretetypetags_multi.scala +++ b/test/files/run/concretetypetags_multi.scala @@ -1,7 +1,9 @@ +import scala.reflect.runtime.universe._ + object Test extends App { - println(concreteTypeTag[Int]) - println(concreteTypeTag[Array[Int]]) - println(concreteTypeTag[Array[Array[Int]]]) - println(concreteTypeTag[Array[Array[Array[Int]]]]) - println(concreteTypeTag[Array[Array[Array[Array[Int]]]]]) + println(implicitly[ConcreteTypeTag[Int]]) + println(implicitly[ConcreteTypeTag[Array[Int]]]) + println(implicitly[ConcreteTypeTag[Array[Array[Int]]]]) + println(implicitly[ConcreteTypeTag[Array[Array[Array[Int]]]]]) + println(implicitly[ConcreteTypeTag[Array[Array[Array[Array[Int]]]]]]) }
\ No newline at end of file diff --git a/test/files/run/ctries-new/main.scala b/test/files/run/ctries-new/main.scala index 1d40dab6c5..d7fe087e4d 100644 --- a/test/files/run/ctries-new/main.scala +++ b/test/files/run/ctries-new/main.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ClassTag, classTag} + @@ -35,11 +37,11 @@ trait Spec { var produced = false try body catch { - case e => if (e.getClass == implicitly[ClassTag[T]].erasure) produced = true + case e => if (e.getClass == implicitly[ClassTag[T]].runtimeClass) produced = true } finally { assert(produced, "Did not produce exception of type: " + implicitly[ClassTag[T]]) } } } -} +}
\ No newline at end of file diff --git a/test/files/run/ctries-old/main.scala b/test/files/run/ctries-old/main.scala index 8db7fcef54..78ba7f0db1 100644 --- a/test/files/run/ctries-old/main.scala +++ b/test/files/run/ctries-old/main.scala @@ -6,30 +6,30 @@ object Test { - + def main(args: Array[String]) { ConcurrentMapSpec.test() IteratorSpec.test() LNodeSpec.test() SnapshotSpec.test() } - + } trait Spec { - + implicit def str2ops(s: String) = new { def in[U](body: =>U) { // just execute body body } } - + implicit def any2ops(a: Any) = new { def shouldEqual(other: Any) = assert(a == other) } - + def evaluating[U](body: =>U) = new { def shouldProduce[T <: Throwable: ClassManifest]() = { var produced = false @@ -41,5 +41,5 @@ trait Spec { } } } - + } diff --git a/test/files/run/erasuretags_abstract.check b/test/files/run/erasuretags_abstract.check deleted file mode 100644 index 17e7204664..0000000000 --- a/test/files/run/erasuretags_abstract.check +++ /dev/null @@ -1,4 +0,0 @@ -class java.lang.Object
-class java.lang.Object
-class java.lang.Object
-int
diff --git a/test/files/run/erasuretags_abstract.scala b/test/files/run/erasuretags_abstract.scala deleted file mode 100644 index 8e4ad0d090..0000000000 --- a/test/files/run/erasuretags_abstract.scala +++ /dev/null @@ -1,9 +0,0 @@ -object Test extends App { - def foo1[T] = erasureTag[T] - println(foo1[Int].erasure) - println(foo1[String].erasure) - println(foo1[Array[Int]].erasure) - - def foo2[T <: Int] = erasureTag[T] - println(foo2[Int].erasure) -}
\ No newline at end of file diff --git a/test/files/run/erasuretags_basic.check b/test/files/run/erasuretags_basic.check deleted file mode 100644 index c02a4d32af..0000000000 --- a/test/files/run/erasuretags_basic.check +++ /dev/null @@ -1,24 +0,0 @@ -int
-class [I
-class scala.collection.immutable.List
-class [Lscala.collection.immutable.List;
-class scala.collection.immutable.List
-class [Lscala.collection.immutable.List;
-interface scala.collection.immutable.Map
-class [Lscala.collection.immutable.Map;
-class [I
-class [[I
-class [Lscala.collection.immutable.List;
-class [[Lscala.collection.immutable.List;
-class [Lscala.collection.immutable.List;
-class [[Lscala.collection.immutable.List;
-class [Lscala.collection.immutable.Map;
-class [[Lscala.collection.immutable.Map;
-class [[I
-class [[[I
-class [[Lscala.collection.immutable.List;
-class [[[Lscala.collection.immutable.List;
-class [[Lscala.collection.immutable.List;
-class [[[Lscala.collection.immutable.List;
-class [[Lscala.collection.immutable.Map;
-class [[[Lscala.collection.immutable.Map;
diff --git a/test/files/run/erasuretags_basic.scala b/test/files/run/erasuretags_basic.scala deleted file mode 100644 index d894fdf2e9..0000000000 --- a/test/files/run/erasuretags_basic.scala +++ /dev/null @@ -1,21 +0,0 @@ -object Test extends App { - def test[T: ErasureTag] = { - println(implicitly[ErasureTag[T]].erasure) - println(implicitly[ErasureTag[Array[T]]].erasure) - } - - test[Int] - test[List[Int]] - test[List[String]] - test[Map[Int, String]] - - test[Array[Int]] - test[Array[List[Int]]] - test[Array[List[String]]] - test[Array[Map[Int, String]]] - - test[Array[Array[Int]]] - test[Array[Array[List[Int]]]] - test[Array[Array[List[String]]]] - test[Array[Array[Map[Int, String]]]] -}
\ No newline at end of file diff --git a/test/files/run/erasuretags_core.check b/test/files/run/erasuretags_core.check deleted file mode 100644 index 2c544678d1..0000000000 --- a/test/files/run/erasuretags_core.check +++ /dev/null @@ -1,32 +0,0 @@ -byte
-class [B
-short
-class [S
-char
-class [C
-int
-class [I
-long
-class [J
-float
-class [F
-double
-class [D
-boolean
-class [Z
-void
-class [Lscala.runtime.BoxedUnit;
-class java.lang.Object
-class [Ljava.lang.Object;
-class java.lang.Object
-class [Ljava.lang.Object;
-class java.lang.Object
-class [Ljava.lang.Object;
-class java.lang.Object
-class [Ljava.lang.Object;
-class scala.runtime.Null$
-class [Lscala.runtime.Null$;
-class scala.runtime.Nothing$
-class [Lscala.runtime.Nothing$;
-class java.lang.String
-class [Ljava.lang.String;
diff --git a/test/files/run/erasuretags_core.scala b/test/files/run/erasuretags_core.scala deleted file mode 100644 index 5ed06dcd31..0000000000 --- a/test/files/run/erasuretags_core.scala +++ /dev/null @@ -1,34 +0,0 @@ -object Test extends App { - println(implicitly[ErasureTag[Byte]].erasure) - println(implicitly[ErasureTag[Array[Byte]]].erasure) - println(implicitly[ErasureTag[Short]].erasure) - println(implicitly[ErasureTag[Array[Short]]].erasure) - println(implicitly[ErasureTag[Char]].erasure) - println(implicitly[ErasureTag[Array[Char]]].erasure) - println(implicitly[ErasureTag[Int]].erasure) - println(implicitly[ErasureTag[Array[Int]]].erasure) - println(implicitly[ErasureTag[Long]].erasure) - println(implicitly[ErasureTag[Array[Long]]].erasure) - println(implicitly[ErasureTag[Float]].erasure) - println(implicitly[ErasureTag[Array[Float]]].erasure) - println(implicitly[ErasureTag[Double]].erasure) - println(implicitly[ErasureTag[Array[Double]]].erasure) - println(implicitly[ErasureTag[Boolean]].erasure) - println(implicitly[ErasureTag[Array[Boolean]]].erasure) - println(implicitly[ErasureTag[Unit]].erasure) - println(implicitly[ErasureTag[Array[Unit]]].erasure) - println(implicitly[ErasureTag[Any]].erasure) - println(implicitly[ErasureTag[Array[Any]]].erasure) - println(implicitly[ErasureTag[Object]].erasure) - println(implicitly[ErasureTag[Array[Object]]].erasure) - println(implicitly[ErasureTag[AnyVal]].erasure) - println(implicitly[ErasureTag[Array[AnyVal]]].erasure) - println(implicitly[ErasureTag[AnyRef]].erasure) - println(implicitly[ErasureTag[Array[AnyRef]]].erasure) - println(implicitly[ErasureTag[Null]].erasure) - println(implicitly[ErasureTag[Array[Null]]].erasure) - println(implicitly[ErasureTag[Nothing]].erasure) - println(implicitly[ErasureTag[Array[Nothing]]].erasure) - println(implicitly[ErasureTag[String]].erasure) - println(implicitly[ErasureTag[Array[String]]].erasure) -}
\ No newline at end of file diff --git a/test/files/run/erasuretags_usage.scala b/test/files/run/erasuretags_usage.scala deleted file mode 100644 index 16e53af071..0000000000 --- a/test/files/run/erasuretags_usage.scala +++ /dev/null @@ -1,12 +0,0 @@ -object Test extends App { - def foo[T] = { - class MyErasureTag(_erasure: Class[_]) extends ErasureTag[T] { - def erasure: Class[T] = _erasure.asInstanceOf[Class[T]] - } - - implicit val tag = new MyErasureTag(classOf[Int]) - println(typeTag[T]) - println(typeTag[T].tpe) - println(typeTag[T].erasure) - } -}
\ No newline at end of file diff --git a/test/files/run/existentials-in-compiler.scala b/test/files/run/existentials-in-compiler.scala index 8c04e4782c..1f314aa4e0 100644 --- a/test/files/run/existentials-in-compiler.scala +++ b/test/files/run/existentials-in-compiler.scala @@ -4,6 +4,7 @@ import scala.collection.{ mutable, immutable, generic } object Test extends CompilerTest { import global._ + import rootMirror._ import definitions._ override def code = """ @@ -21,7 +22,7 @@ package extest { trait Cov07[-A <: AnyRef, +B] { } trait Cov08[-A <: AnyRef, B] { } trait Cov09[-A <: AnyRef, -B] { } - + trait Cov11[+A <: AnyRef, +B <: List[_]] { } trait Cov12[+A <: AnyRef, B <: List[_]] { } trait Cov13[+A <: AnyRef, -B <: List[_]] { } @@ -31,7 +32,7 @@ package extest { trait Cov17[-A <: AnyRef, +B <: List[_]] { } trait Cov18[-A <: AnyRef, B <: List[_]] { } trait Cov19[-A <: AnyRef, -B <: List[_]] { } - + trait Cov21[+A, +B] { } trait Cov22[+A, B] { } trait Cov23[+A, -B] { } @@ -41,7 +42,7 @@ package extest { trait Cov27[-A, +B] { } trait Cov28[-A, B] { } trait Cov29[-A, -B] { } - + trait Cov31[+A, +B, C <: ((A, B))] { } trait Cov32[+A, B, C <: ((A, B))] { } trait Cov33[+A, -B, C <: ((A, _))] { } @@ -51,7 +52,7 @@ package extest { trait Cov37[-A, +B, C <: ((_, B))] { } trait Cov38[-A, B, C <: ((_, B))] { } trait Cov39[-A, -B, C <: ((_, _))] { } - + trait Cov41[+A >: Null, +B] { } trait Cov42[+A >: Null, B] { } trait Cov43[+A >: Null, -B] { } diff --git a/test/files/run/existentials3-new.check b/test/files/run/existentials3-new.check index 66674fbbd6..0d6f694a68 100644 --- a/test/files/run/existentials3-new.check +++ b/test/files/run/existentials3-new.check @@ -1,24 +1,24 @@ -ConcreteTypeTag[Bar.type], t=AbstractTypeRef, s= <: scala.runtime.AbstractFunction0[Bar] with Serializable{case def unapply(x$0: Bar): Boolean} with Singleton -ConcreteTypeTag[Bar], t=AbstractTypeRef, s= <: Test.ToS with Product with Serializable{def copy(): Bar} -ConcreteTypeTag[Test.ToS], t=RefinedType, s=f3 -ConcreteTypeTag[Test.ToS], t=RefinedType, s=f4 -ConcreteTypeTag[Test.ToS], t=RefinedType, s=f5 -ConcreteTypeTag[() => Test.ToS], t=TypeRef, s=class Function0 -ConcreteTypeTag[() => Test.ToS], t=TypeRef, s=class Function0 -ConcreteTypeTag[$anon], t=AbstractTypeRef, s= <: B with Test.ToS -ConcreteTypeTag[$anon], t=AbstractTypeRef, s= <: B with A with Test.ToS -TypeTag[List[Object{type T1}#T1]], t=TypeRef, s=class List -ConcreteTypeTag[List[Seq[Int]]], t=TypeRef, s=class List -ConcreteTypeTag[List[Seq[U forSome { type U <: Int }]]], t=TypeRef, s=class List -ConcreteTypeTag[Bar.type], t=AbstractTypeRef, s= <: scala.runtime.AbstractFunction0[Bar] with Serializable{case def unapply(x$0: Bar): Boolean} with Singleton -ConcreteTypeTag[Bar], t=AbstractTypeRef, s= <: Test.ToS with Product with Serializable{def copy(): Bar} -ConcreteTypeTag[Test.ToS], t=RefinedType, s=g3 -ConcreteTypeTag[Test.ToS], t=RefinedType, s=g4 -ConcreteTypeTag[Test.ToS], t=RefinedType, s=g5 -ConcreteTypeTag[() => Test.ToS], t=TypeRef, s=class Function0 -ConcreteTypeTag[() => Test.ToS], t=TypeRef, s=class Function0 -ConcreteTypeTag[$anon], t=AbstractTypeRef, s= <: B with Test.ToS -ConcreteTypeTag[$anon], t=AbstractTypeRef, s= <: B with A with Test.ToS -TypeTag[List[Object{type T1}#T1]], t=TypeRef, s=class List -ConcreteTypeTag[List[Seq[Int]]], t=TypeRef, s=class List -ConcreteTypeTag[List[Seq[U forSome { type U <: Int }]]], t=TypeRef, s=class List +Bar.type, t=AbstractTypeRef, s= <: scala.runtime.AbstractFunction0[Bar] with Serializable{case def unapply(x$0: Bar): Boolean} with Singleton
+Bar, t=AbstractTypeRef, s= <: Test.ToS with Product with Serializable{def copy(): 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=AbstractTypeRef, s= <: B with Test.ToS
+$anon, t=AbstractTypeRef, s= <: B with A with Test.ToS
+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=AbstractTypeRef, s= <: scala.runtime.AbstractFunction0[Bar] with Serializable{case def unapply(x$0: Bar): Boolean} with Singleton
+Bar, t=AbstractTypeRef, s= <: Test.ToS with Product with Serializable{def copy(): 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=AbstractTypeRef, s= <: B with Test.ToS
+$anon, t=AbstractTypeRef, s= <: B with A with Test.ToS
+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 32129a04c6..5e1490b778 100644 --- a/test/files/run/existentials3-new.scala +++ b/test/files/run/existentials3-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + object Test { trait ToS { final override def toString = getClass.getName } @@ -31,12 +33,12 @@ object Test { val g11 = { abstract class A extends Seq[Int] ; List[A]() } val g12 = { abstract class A extends Seq[U forSome { type U <: Int }] ; List[A]() } - def printTag(t: TypeTag[_]) = { - val s = if (t.sym.isFreeType) t.sym.typeSignature.toString else t.sym.toString - println("%s, t=%s, s=%s".format(t, t.tpe.kind, s)) + def printTpe(t: Type) = { + val s = if (t.typeSymbol.isFreeType) t.typeSymbol.typeSignature.toString else t.typeSymbol.toString + println("%s, t=%s, s=%s".format(t, t.kind, s)) } - def m[T: ConcreteTypeTag](x: T) = printTag(concreteTypeTag[T]) - def m2[T: TypeTag](x: T) = printTag(typeTag[T]) + def m[T: ConcreteTypeTag](x: T) = printTpe(typeOf[T]) + def m2[T: TypeTag](x: T) = printTpe(typeOf[T]) // tags do work for f10/g10 def main(args: Array[String]): Unit = { @@ -75,4 +77,4 @@ object Misc { } def g1 = o1.f1 _ def g2 = o1.f2 _ -} +}
\ No newline at end of file diff --git a/test/files/run/freetypes_false_alarm1.check b/test/files/run/freetypes_false_alarm1.check new file mode 100644 index 0000000000..92efacc2b7 --- /dev/null +++ b/test/files/run/freetypes_false_alarm1.check @@ -0,0 +1 @@ +List[Int]
diff --git a/test/files/run/freetypes_false_alarm1.scala b/test/files/run/freetypes_false_alarm1.scala new file mode 100644 index 0000000000..8d6797f792 --- /dev/null +++ b/test/files/run/freetypes_false_alarm1.scala @@ -0,0 +1,10 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends App { + reify { + val ru = scala.reflect.runtime.universe + val tpe: ru.Type = ru.typeOf[List[Int]] + println(tpe) + }.eval +}
\ No newline at end of file diff --git a/test/files/run/freetypes_false_alarm2.check b/test/files/run/freetypes_false_alarm2.check new file mode 100644 index 0000000000..02e4a84d62 --- /dev/null +++ b/test/files/run/freetypes_false_alarm2.check @@ -0,0 +1 @@ +false
\ No newline at end of file diff --git a/test/files/run/freetypes_false_alarm2.scala b/test/files/run/freetypes_false_alarm2.scala new file mode 100644 index 0000000000..3499f13fba --- /dev/null +++ b/test/files/run/freetypes_false_alarm2.scala @@ -0,0 +1,8 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.tools.reflect.Eval + +object Test extends App { + val tpe = typeOf[ru.Type] + println(tpe.typeSymbol.isFreeType) +}
\ No newline at end of file diff --git a/test/files/run/getClassTest-new.scala b/test/files/run/getClassTest-new.scala index 89778ca2d3..7d8ec930f4 100644 --- a/test/files/run/getClassTest-new.scala +++ b/test/files/run/getClassTest-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ClassTag, classTag} + class AnyVals { def f1 = (5: Any).getClass def f2 = (5: AnyVal).getClass @@ -52,7 +54,7 @@ class MoreAnyRefs { object Test { def returnTypes[T: ClassTag] = ( - classTag[T].erasure.getMethods.toList + classTag[T].runtimeClass.getMethods.toList filter (_.getName startsWith "f") sortBy (_.getName) map (m => m.getName + ": " + m.getGenericReturnType.toString) @@ -63,4 +65,4 @@ object Test { returnTypes[AnyRefs] foreach println returnTypes[MoreAnyRefs] foreach println } -} +}
\ No newline at end of file diff --git a/test/files/run/interop_classmanifests_arenot_typetags.check b/test/files/run/interop_classmanifests_arenot_typetags.check new file mode 100644 index 0000000000..d67491ed75 --- /dev/null +++ b/test/files/run/interop_classmanifests_arenot_typetags.check @@ -0,0 +1,3 @@ +T +T +T diff --git a/test/files/run/interop_classmanifests_arenot_typetags.scala b/test/files/run/interop_classmanifests_arenot_typetags.scala new file mode 100644 index 0000000000..d65a5124d7 --- /dev/null +++ b/test/files/run/interop_classmanifests_arenot_typetags.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + def classManifestIsnotTypeTag[T: ClassManifest] = { + println(typeOf[T]) + } + + classManifestIsnotTypeTag[Int] + classManifestIsnotTypeTag[String] + classManifestIsnotTypeTag[Array[Int]] +}
\ No newline at end of file diff --git a/test/files/run/interop_classmanifests_arepartially_typetags.check b/test/files/run/interop_classmanifests_arepartially_typetags.check deleted file mode 100644 index 3dfcdccbec..0000000000 --- a/test/files/run/interop_classmanifests_arepartially_typetags.check +++ /dev/null @@ -1,6 +0,0 @@ -T
-int
-T
-class java.lang.String
-T
-class [I
diff --git a/test/files/run/interop_classmanifests_arepartially_typetags.scala b/test/files/run/interop_classmanifests_arepartially_typetags.scala deleted file mode 100644 index 9bc1f32e86..0000000000 --- a/test/files/run/interop_classmanifests_arepartially_typetags.scala +++ /dev/null @@ -1,10 +0,0 @@ -object Test extends App { - def classManifestIspartiallyTypeTag[T: ClassManifest] = { - println(typeTag[T].tpe) - println(typeTag[T].erasure) - } - - classManifestIspartiallyTypeTag[Int] - classManifestIspartiallyTypeTag[String] - classManifestIspartiallyTypeTag[Array[Int]] -}
\ No newline at end of file diff --git a/test/files/run/interop_classtags_are_classmanifests.scala b/test/files/run/interop_classtags_are_classmanifests.scala index 309c99a3f5..498a947879 100644 --- a/test/files/run/interop_classtags_are_classmanifests.scala +++ b/test/files/run/interop_classtags_are_classmanifests.scala @@ -1,3 +1,6 @@ +import scala.reflect.{ArrayTag, arrayTag} +import scala.reflect.{ClassTag, classTag} + object Test extends App { def arrayTagIsClassManifest[T: ArrayTag] = { println(classManifest[T]) diff --git a/test/files/run/interop_concretetypetags_are_classmanifests.check b/test/files/run/interop_concretetypetags_are_classmanifests.check deleted file mode 100644 index c59e92d4eb..0000000000 --- a/test/files/run/interop_concretetypetags_are_classmanifests.check +++ /dev/null @@ -1,3 +0,0 @@ -Int
-java.lang.String
-Array[Int]
diff --git a/test/files/run/interop_concretetypetags_are_classmanifests.scala b/test/files/run/interop_concretetypetags_are_classmanifests.scala deleted file mode 100644 index b578d7e626..0000000000 --- a/test/files/run/interop_concretetypetags_are_classmanifests.scala +++ /dev/null @@ -1,9 +0,0 @@ -object Test extends App { - def concreteTypeTagIsClassManifest[T: ConcreteTypeTag] = { - println(classManifest[T]) - } - - concreteTypeTagIsClassManifest[Int] - concreteTypeTagIsClassManifest[String] - concreteTypeTagIsClassManifest[Array[Int]] -}
\ No newline at end of file diff --git a/test/files/run/interop_concretetypetags_are_manifests.check b/test/files/run/interop_concretetypetags_are_manifests.check index c59e92d4eb..871167e3ab 100644 --- a/test/files/run/interop_concretetypetags_are_manifests.check +++ b/test/files/run/interop_concretetypetags_are_manifests.check @@ -1,3 +1,3 @@ -Int
+int
java.lang.String
Array[Int]
diff --git a/test/files/run/interop_concretetypetags_are_manifests.scala b/test/files/run/interop_concretetypetags_are_manifests.scala index 731410bc10..84647a3a5a 100644 --- a/test/files/run/interop_concretetypetags_are_manifests.scala +++ b/test/files/run/interop_concretetypetags_are_manifests.scala @@ -1,5 +1,8 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.ClassTag + object Test extends App { - def concreteTypeTagIsManifest[T: ConcreteTypeTag] = { + def concreteTypeTagIsManifest[T: ConcreteTypeTag : ClassTag] = { println(manifest[T]) } diff --git a/test/files/run/interop_manifests_are_classtags.check b/test/files/run/interop_manifests_are_classtags.check index 07ff6b984a..aaf4aba012 100644 --- a/test/files/run/interop_manifests_are_classtags.check +++ b/test/files/run/interop_manifests_are_classtags.check @@ -1,24 +1,18 @@ Int
-Int
List()
List(0, 0, 0, 0, 0)
java.lang.String
-java.lang.String
List()
List(null, null, null, null, null)
Array[Int]
-Array[Int]
List()
List(null, null, null, null, null)
Int
-Int
List()
List(0, 0, 0, 0, 0)
java.lang.String
-java.lang.String
List()
List(null, null, null, null, null)
Array[Int]
-Array[Int]
List()
List(null, null, null, null, null)
diff --git a/test/files/run/interop_manifests_are_classtags.scala b/test/files/run/interop_manifests_are_classtags.scala index 582cea3467..d2b8bdea5c 100644 --- a/test/files/run/interop_manifests_are_classtags.scala +++ b/test/files/run/interop_manifests_are_classtags.scala @@ -1,7 +1,8 @@ +import scala.reflect.{ArrayTag, ClassTag, arrayTag, classTag} + object Test extends App { def classManifestIsClassTag[T: ClassManifest] = { println(arrayTag[T]) - println(erasureTag[T]) println(Array[T]().toList) println(new Array[T](5).toList) } @@ -12,7 +13,6 @@ object Test extends App { def manifestIsClassTag[T: Manifest] = { println(arrayTag[T]) - println(erasureTag[T]) println(Array[T]().toList) println(new Array[T](5).toList) } diff --git a/test/files/run/interop_manifests_are_concretetypetags.check b/test/files/run/interop_manifests_are_concretetypetags.check index edab85ecf1..c59e92d4eb 100644 --- a/test/files/run/interop_manifests_are_concretetypetags.check +++ b/test/files/run/interop_manifests_are_concretetypetags.check @@ -1,6 +1,3 @@ -Int -int -String -class java.lang.String -Array[Int] -class [I +Int
+java.lang.String
+Array[Int]
diff --git a/test/files/run/interop_manifests_are_concretetypetags.scala b/test/files/run/interop_manifests_are_concretetypetags.scala index 0b82a56d0a..85ad748173 100644 --- a/test/files/run/interop_manifests_are_concretetypetags.scala +++ b/test/files/run/interop_manifests_are_concretetypetags.scala @@ -1,7 +1,8 @@ +import scala.reflect.runtime.universe._ + object Test extends App { def manifestIsConcreteTypeTag[T: Manifest] = { - println(concreteTypeTag[T].tpe) - println(concreteTypeTag[T].erasure) + println(implicitly[ConcreteTypeTag[T]].tpe) } manifestIsConcreteTypeTag[Int] diff --git a/test/files/run/interop_manifests_are_typetags.check b/test/files/run/interop_manifests_are_typetags.check index edab85ecf1..c59e92d4eb 100644 --- a/test/files/run/interop_manifests_are_typetags.check +++ b/test/files/run/interop_manifests_are_typetags.check @@ -1,6 +1,3 @@ -Int -int -String -class java.lang.String -Array[Int] -class [I +Int
+java.lang.String
+Array[Int]
diff --git a/test/files/run/interop_manifests_are_typetags.scala b/test/files/run/interop_manifests_are_typetags.scala index 03a7b7b6d5..294d3c22de 100644 --- a/test/files/run/interop_manifests_are_typetags.scala +++ b/test/files/run/interop_manifests_are_typetags.scala @@ -1,7 +1,8 @@ +import scala.reflect.runtime.universe._ + object Test extends App { def manifestIsTypeTag[T: Manifest] = { - println(typeTag[T].tpe) - println(typeTag[T].erasure) + println(typeOf[T]) } manifestIsTypeTag[Int] diff --git a/test/files/run/macro-abort-fresh/Macros_1.scala b/test/files/run/macro-abort-fresh/Macros_1.scala index 4186c4c4a6..440d1e2915 100644 --- a/test/files/run/macro-abort-fresh/Macros_1.scala +++ b/test/files/run/macro-abort-fresh/Macros_1.scala @@ -2,7 +2,7 @@ import scala.reflect.makro.Context object Impls { def impl(c: Context) = { - import c.mirror._ + import c.universe._ println(c.fresh()) println(c.fresh("qwe")) println(c.fresh(newTypeName("qwe"))) diff --git a/test/files/run/macro-abort-fresh/Test_2.scala b/test/files/run/macro-abort-fresh/Test_2.scala index ecf48b9752..c6caa2b585 100644 --- a/test/files/run/macro-abort-fresh/Test_2.scala +++ b/test/files/run/macro-abort-fresh/Test_2.scala @@ -1,6 +1,8 @@ object Test extends App { - import scala.reflect.mirror._ + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox val tree = Select(Ident("Macros"), newTermName("foo")) - try Expr(tree).eval + try cm.mkToolBox().runExpr(tree) catch { case ex: Throwable => println(ex.getMessage) } }
\ No newline at end of file diff --git a/test/files/run/macro-basic-ma-md-mi/Impls_1.scala b/test/files/run/macro-basic-ma-md-mi/Impls_1.scala index 3f23e349d5..039488ba3e 100644 --- a/test/files/run/macro-basic-ma-md-mi/Impls_1.scala +++ b/test/files/run/macro-basic-ma-md-mi/Impls_1.scala @@ -2,20 +2,20 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { - import c.mirror._ + import c.universe._ val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))) - Expr[Int](body) + c.Expr[Int](body) } def bar(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { - import c.mirror._ + import c.universe._ val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2)))) - Expr[Int](body) + c.Expr[Int](body) } def quux(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { - import c.mirror._ + import c.universe._ val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3)))) - Expr[Int](body) + c.Expr[Int](body) } -} +}
\ No newline at end of file diff --git a/test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala b/test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala index 44bfe861e3..6e1e37a485 100644 --- a/test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala +++ b/test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala @@ -2,21 +2,21 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { - import c.mirror._ + import c.universe._ val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))) - Expr[Int](body) + c.Expr[Int](body) } def bar(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { - import c.mirror._ + import c.universe._ val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2)))) - Expr[Int](body) + c.Expr[Int](body) } def quux(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { - import c.mirror._ + import c.universe._ val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3)))) - Expr[Int](body) + c.Expr[Int](body) } } diff --git a/test/files/run/macro-basic-mamd-mi/Impls_1.scala b/test/files/run/macro-basic-mamd-mi/Impls_1.scala index 82d2cce2f5..96d26741f7 100644 --- a/test/files/run/macro-basic-mamd-mi/Impls_1.scala +++ b/test/files/run/macro-basic-mamd-mi/Impls_1.scala @@ -2,18 +2,18 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { - import c.mirror._ - Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1))))) + import c.universe._ + c.Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1))))) } def bar(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { - import c.mirror._ - Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2))))) + import c.universe._ + c.Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2))))) } def quux(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { - import c.mirror._ + import c.universe._ val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3)))) - Expr[Int](body) + c.Expr[Int](body) } -} +}
\ No newline at end of file diff --git a/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala b/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala index 5c5ec2c999..7de1e59cc7 100644 --- a/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala +++ b/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala @@ -5,8 +5,8 @@ object Impls { def refToFoo(dummy: Int) = macro refToFoo_impl def refToFoo_impl(c: Ctx)(dummy: c.Expr[Int]) = { - import c.mirror._ + import c.universe._ val body = Select(Ident(newTermName("Impls")), newTermName("foo")) - Expr[Int](body) + c.Expr[Int](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-annotation/Impls_1.scala b/test/files/run/macro-declared-in-annotation/Impls_1.scala index a1234a7374..2b309e1cc8 100644 --- a/test/files/run/macro-declared-in-annotation/Impls_1.scala +++ b/test/files/run/macro-declared-in-annotation/Impls_1.scala @@ -3,9 +3,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(List(printPrefix), Literal(Constant("this is deprecated"))) - Expr[String](body) + c.Expr[String](body) } -} +}
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-anonymous/Impls_1.scala b/test/files/run/macro-declared-in-anonymous/Impls_1.scala index c0827ace31..d95dbd42c6 100644 --- a/test/files/run/macro-declared-in-anonymous/Impls_1.scala +++ b/test/files/run/macro-declared-in-anonymous/Impls_1.scala @@ -3,9 +3,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +}
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-block/Impls_1.scala b/test/files/run/macro-declared-in-block/Impls_1.scala index c0827ace31..d95dbd42c6 100644 --- a/test/files/run/macro-declared-in-block/Impls_1.scala +++ b/test/files/run/macro-declared-in-block/Impls_1.scala @@ -3,9 +3,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +}
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-class-class/Impls_1.scala b/test/files/run/macro-declared-in-class-class/Impls_1.scala index c2e6933582..5c61086a40 100644 --- a/test/files/run/macro-declared-in-class-class/Impls_1.scala +++ b/test/files/run/macro-declared-in-class-class/Impls_1.scala @@ -3,9 +3,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(printPrefix, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +}
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-class-object/Impls_1.scala b/test/files/run/macro-declared-in-class-object/Impls_1.scala index c2e6933582..5c61086a40 100644 --- a/test/files/run/macro-declared-in-class-object/Impls_1.scala +++ b/test/files/run/macro-declared-in-class-object/Impls_1.scala @@ -3,9 +3,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(printPrefix, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +}
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-class/Impls_1.scala b/test/files/run/macro-declared-in-class/Impls_1.scala index c2e6933582..5c61086a40 100644 --- a/test/files/run/macro-declared-in-class/Impls_1.scala +++ b/test/files/run/macro-declared-in-class/Impls_1.scala @@ -3,9 +3,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(printPrefix, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +}
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-default-param/Impls_1.scala b/test/files/run/macro-declared-in-default-param/Impls_1.scala index e45095812a..5e7351e954 100644 --- a/test/files/run/macro-declared-in-default-param/Impls_1.scala +++ b/test/files/run/macro-declared-in-default-param/Impls_1.scala @@ -3,9 +3,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(List(printPrefix), Literal(Constant("it works"))) - Expr[String](body) + c.Expr[String](body) } -} +}
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala b/test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala index 8605d4a8be..e5fb4bcdf3 100644 --- a/test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala +++ b/test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala @@ -3,10 +3,10 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def toOptionOfInt(c: Ctx) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(printPrefix, Apply(Ident(definitions.SomeModule), List(Select(Select(prefix.tree, newTermName("x")), newTermName("toInt"))))) - Expr[Option[Int]](body) + c.Expr[Option[Int]](body) } } @@ -16,4 +16,4 @@ object Macros { class Foo(val x: String) { def toOptionOfInt = macro Impls.toOptionOfInt } -} +}
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-method/Impls_1.scala b/test/files/run/macro-declared-in-method/Impls_1.scala index c2e6933582..5c61086a40 100644 --- a/test/files/run/macro-declared-in-method/Impls_1.scala +++ b/test/files/run/macro-declared-in-method/Impls_1.scala @@ -3,9 +3,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(printPrefix, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +}
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-object-class/Impls_1.scala b/test/files/run/macro-declared-in-object-class/Impls_1.scala index c2e6933582..5c61086a40 100644 --- a/test/files/run/macro-declared-in-object-class/Impls_1.scala +++ b/test/files/run/macro-declared-in-object-class/Impls_1.scala @@ -3,9 +3,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(printPrefix, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +}
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-object-object/Impls_1.scala b/test/files/run/macro-declared-in-object-object/Impls_1.scala index c2e6933582..5c61086a40 100644 --- a/test/files/run/macro-declared-in-object-object/Impls_1.scala +++ b/test/files/run/macro-declared-in-object-object/Impls_1.scala @@ -3,9 +3,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(printPrefix, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +}
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-object/Impls_1.scala b/test/files/run/macro-declared-in-object/Impls_1.scala index c2e6933582..5c61086a40 100644 --- a/test/files/run/macro-declared-in-object/Impls_1.scala +++ b/test/files/run/macro-declared-in-object/Impls_1.scala @@ -3,9 +3,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(printPrefix, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +}
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-package-object/Impls_1.scala b/test/files/run/macro-declared-in-package-object/Impls_1.scala index c2e6933582..5c61086a40 100644 --- a/test/files/run/macro-declared-in-package-object/Impls_1.scala +++ b/test/files/run/macro-declared-in-package-object/Impls_1.scala @@ -3,9 +3,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(printPrefix, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +}
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-refinement/Impls_1.scala b/test/files/run/macro-declared-in-refinement/Impls_1.scala index c2e6933582..5c61086a40 100644 --- a/test/files/run/macro-declared-in-refinement/Impls_1.scala +++ b/test/files/run/macro-declared-in-refinement/Impls_1.scala @@ -3,9 +3,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(printPrefix, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +}
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-trait/Impls_1.scala b/test/files/run/macro-declared-in-trait/Impls_1.scala index c2e6933582..5c61086a40 100644 --- a/test/files/run/macro-declared-in-trait/Impls_1.scala +++ b/test/files/run/macro-declared-in-trait/Impls_1.scala @@ -3,9 +3,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(printPrefix, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +}
\ No newline at end of file diff --git a/test/files/run/macro-def-infer-return-type-b/Test_2.scala b/test/files/run/macro-def-infer-return-type-b/Test_2.scala index f8f15b4224..0f84859545 100644 --- a/test/files/run/macro-def-infer-return-type-b/Test_2.scala +++ b/test/files/run/macro-def-infer-return-type-b/Test_2.scala @@ -1,6 +1,8 @@ object Test extends App { - import scala.reflect.mirror._ + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox val tree = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(42)))) - try Expr(tree).eval + try cm.mkToolBox().runExpr(tree) catch { case ex: Throwable => println(ex.getMessage) } -}
\ No newline at end of file +} diff --git a/test/files/run/macro-def-path-dependent-d/Impls_Macros_1.scala b/test/files/run/macro-def-path-dependent-d/Impls_Macros_1.scala index 32f03e778e..aca7f999d5 100644 --- a/test/files/run/macro-def-path-dependent-d/Impls_Macros_1.scala +++ b/test/files/run/macro-def-path-dependent-d/Impls_Macros_1.scala @@ -1,3 +1,4 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.Context import scala.reflect.api.Universe @@ -5,4 +6,4 @@ object Test { def materializeTypeTag[T](u: Universe)(e: T) = macro materializeTypeTag_impl[T] def materializeTypeTag_impl[T: c.TypeTag](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-macro-has-implicit/Impls_1.scala b/test/files/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala index 39db275e1c..b59555539c 100644 --- a/test/files/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala +++ b/test/files/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala @@ -2,8 +2,8 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]) = { - import c.mirror._ + import c.universe._ val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(x.tree)) - Expr[Unit](body) + c.Expr[Unit](body) } -} +}
\ No newline at end of file diff --git a/test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala b/test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala index 0262485994..68ead9b9a5 100644 --- a/test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala +++ b/test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala @@ -2,8 +2,8 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[String]): c.Expr[Option[Int]] = { - import c.mirror._ + import c.universe._ val body = Apply(Ident(definitions.SomeModule), List(Select(x.tree, newTermName("toInt")))) - Expr[Option[Int]](body) + c.Expr[Option[Int]](body) } -} +}
\ No newline at end of file diff --git a/test/files/run/macro-expand-implicit-macro-is-val/Impls_1.scala b/test/files/run/macro-expand-implicit-macro-is-val/Impls_1.scala index 510d8502f6..a1dd5aa801 100644 --- a/test/files/run/macro-expand-implicit-macro-is-val/Impls_1.scala +++ b/test/files/run/macro-expand-implicit-macro-is-val/Impls_1.scala @@ -2,8 +2,8 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { - import c.mirror._ + import c.universe._ val body = Literal(Constant(2)) - Expr[Int](body) + c.Expr[Int](body) } -} +}
\ No newline at end of file diff --git a/test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala b/test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala index 0262485994..68ead9b9a5 100644 --- a/test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala +++ b/test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala @@ -2,8 +2,8 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[String]): c.Expr[Option[Int]] = { - import c.mirror._ + import c.universe._ val body = Apply(Ident(definitions.SomeModule), List(Select(x.tree, newTermName("toInt")))) - Expr[Option[Int]](body) + c.Expr[Option[Int]](body) } -} +}
\ No newline at end of file diff --git a/test/files/run/macro-expand-multiple-arglists/Impls_1.scala b/test/files/run/macro-expand-multiple-arglists/Impls_1.scala index ae1c50eace..2c1748bc29 100644 --- a/test/files/run/macro-expand-multiple-arglists/Impls_1.scala +++ b/test/files/run/macro-expand-multiple-arglists/Impls_1.scala @@ -2,9 +2,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int])(y: c.Expr[Int]) = { - import c.mirror._ + import c.universe._ val sum = Apply(Select(x.tree, newTermName("$minus")), List(y.tree)) val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(sum)) - Expr[Unit](body) + c.Expr[Unit](body) } -} +}
\ No newline at end of file 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 10352594f5..edbe6d504a 100644 --- a/test/files/run/macro-expand-nullary-generic/Impls_1.scala +++ b/test/files/run/macro-expand-nullary-generic/Impls_1.scala @@ -1,14 +1,15 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.{Context => Ctx} object Impls { def impl[T: c.TypeTag](c: Ctx) = { - import c.mirror._ + import c.universe._ val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works " + implicitly[c.TypeTag[T]])))) - Expr[Unit](body) + c.Expr[Unit](body) } def fooNullary[T: c.TypeTag](c: Ctx) = impl[T](c) def fooEmpty[T: c.TypeTag](c: Ctx)() = impl[T](c) def barNullary[T: c.TypeTag](c: Ctx)(x: c.Expr[Int]) = impl[T](c) def barEmpty[T: c.TypeTag](c: Ctx)(x: c.Expr[Int])() = impl[T](c) -} +}
\ No newline at end of file diff --git a/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala b/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala index 7dc58abba8..0d849a085d 100644 --- a/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala +++ b/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala @@ -2,13 +2,13 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def impl(c: Ctx) = { - import c.mirror._ + import c.universe._ val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works")))) - Expr[Unit](body) + c.Expr[Unit](body) } def fooNullary(c: Ctx) = impl(c) def fooEmpty(c: Ctx)() = impl(c) def barNullary(c: Ctx)(x: c.Expr[Int]) = impl(c) def barEmpty(c: Ctx)(x: c.Expr[Int])() = impl(c) -} +}
\ No newline at end of file diff --git a/test/files/run/macro-expand-overload/Impls_1.scala b/test/files/run/macro-expand-overload/Impls_1.scala index 1dc4adc20e..f4646d43df 100644 --- a/test/files/run/macro-expand-overload/Impls_1.scala +++ b/test/files/run/macro-expand-overload/Impls_1.scala @@ -3,13 +3,13 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def impl(c: Ctx)(tag: String, x: c.Expr[_]) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(tag)), Literal(Constant(prefix.toString)), x.tree)) - Expr[Unit](body) + c.Expr[Unit](body) } def fooObjectString(c: Ctx)(x: c.Expr[_]) = impl(c)("fooObjectString", x) def fooObjectInt(c: Ctx)(x: c.Expr[_]) = impl(c)("fooObjectInt", x) def fooClassString(c: Ctx)(x: c.Expr[_]) = impl(c)("fooClassString", x) def fooClassInt(c: Ctx)(x: c.Expr[_]) = impl(c)("fooClassInt", x) -} +}
\ No newline at end of file diff --git a/test/files/run/macro-expand-override/Impls_1.scala b/test/files/run/macro-expand-override/Impls_1.scala index 0b127f5a59..d6493caad9 100644 --- a/test/files/run/macro-expand-override/Impls_1.scala +++ b/test/files/run/macro-expand-override/Impls_1.scala @@ -3,13 +3,13 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def impl(c: Ctx)(tag: String, x: c.Expr[_]) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(tag)), Literal(Constant(prefix.toString)), x.tree)) - Expr[Unit](body) + c.Expr[Unit](body) } def fooBString(c: Ctx)(x: c.Expr[_]) = impl(c)("fooBString", x) def fooBInt(c: Ctx)(x: c.Expr[_]) = impl(c)("fooBInt", x) def fooDInt(c: Ctx)(x: c.Expr[_]) = impl(c)("fooDInt", x) def fooZString(c: Ctx)(x: c.Expr[_]) = impl(c)("fooZString", x) -} +}
\ No newline at end of file diff --git a/test/files/run/macro-expand-recursive/Impls_1.scala b/test/files/run/macro-expand-recursive/Impls_1.scala index 6eff805989..26833ca0b9 100644 --- a/test/files/run/macro-expand-recursive/Impls_1.scala +++ b/test/files/run/macro-expand-recursive/Impls_1.scala @@ -2,14 +2,14 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { - import c.mirror._ + import c.universe._ val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works")))) - Expr[Unit](body) + c.Expr[Unit](body) } def fooFoo(c: Ctx) = { - import c.mirror._ + import c.universe._ val body = Select(Ident(newTermName("Macros")), newTermName("foo")) - Expr[Unit](body) + c.Expr[Unit](body) } -} +}
\ 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 957d8331fc..d1843275d0 100644 --- a/test/files/run/macro-expand-tparams-explicit/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-explicit/Impls_1.scala @@ -1,10 +1,11 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.{Context => Ctx} object Impls { def foo[U: c.TypeTag](c: Ctx) = { - import c.mirror._ + import c.universe._ val U = implicitly[c.TypeTag[U]] val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(U.toString)))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +}
\ No newline at end of file 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 c25d12be60..cbc5460720 100644 --- a/test/files/run/macro-expand-tparams-implicit/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-implicit/Impls_1.scala @@ -1,10 +1,11 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.{Context => Ctx} object Impls { def foo[U: c.TypeTag](c: Ctx)(x: c.Expr[U]) = { - import c.mirror._ + import c.universe._ val U = implicitly[c.TypeTag[U]] val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(U.toString)))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +}
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-optional/Impls_1.scala b/test/files/run/macro-expand-tparams-optional/Impls_1.scala index 37efb009c4..97363edd9a 100644 --- a/test/files/run/macro-expand-tparams-optional/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-optional/Impls_1.scala @@ -2,8 +2,8 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo[U](c: Ctx) = { - import c.mirror._ + import c.universe._ val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("don't know U")))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +}
\ No newline at end of file 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 c25d12be60..cbc5460720 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 @@ -1,10 +1,11 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.{Context => Ctx} object Impls { def foo[U: c.TypeTag](c: Ctx)(x: c.Expr[U]) = { - import c.mirror._ + import c.universe._ val U = implicitly[c.TypeTag[U]] val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(U.toString)))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +}
\ No newline at end of file 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 8af3ecc9ae..3d29fa467d 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 @@ -1,11 +1,12 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.{Context => Ctx} object Impls { def foo[T: c.TypeTag, U: c.TypeTag](c: Ctx)(x: c.Expr[U]) = { - import c.mirror._ + import c.universe._ val T = implicitly[c.TypeTag[T]] val U = implicitly[c.TypeTag[U]] val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString + " " + U.toString)))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +}
\ No newline at end of file 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 4da5a9b823..a834d809da 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 @@ -1,12 +1,13 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.{Context => Ctx} object Impls { def foo[T, U: c.TypeTag, V](c: Ctx)(implicit T: c.TypeTag[T], V: c.TypeTag[V]): c.Expr[Unit] = { - import c.mirror._ - Expr(Block(List( + 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.TypeTag[U]].toString)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))), Literal(Constant(())))) } -} +}
\ No newline at end of file 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 4d137a4aef..e0de1f3f83 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 @@ -1,9 +1,10 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.{Context => Ctx} object Impls { def foo[T, U: c.TypeTag, V](c: Ctx)(implicit T: c.TypeTag[T], V: c.TypeTag[V]): c.Expr[Unit] = { - import c.mirror._ - Expr(Block(List( + 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.TypeTag[U]].toString)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))), @@ -15,4 +16,4 @@ class D[T] { class C[U] { def foo[V] = macro Impls.foo[T, U, V] } -} +}
\ No newline at end of file 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 4da5a9b823..a834d809da 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 @@ -1,12 +1,13 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.{Context => Ctx} object Impls { def foo[T, U: c.TypeTag, V](c: Ctx)(implicit T: c.TypeTag[T], V: c.TypeTag[V]): c.Expr[Unit] = { - import c.mirror._ - Expr(Block(List( + 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.TypeTag[U]].toString)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))), Literal(Constant(())))) } -} +}
\ No newline at end of file diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala index d97f0af786..b83fa046e5 100644 --- a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala +++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala @@ -2,8 +2,8 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx)(xs: c.Expr[Int]*) = { - import c.mirror._ + import c.universe._ val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), xs.map(_.tree).toList) - Expr[Unit](body) + c.Expr[Unit](body) } -} +}
\ No newline at end of file diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Macros_Test_2.scala b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Macros_Test_2.scala index 01fc9d4462..c0319fcd6c 100644 --- a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Macros_Test_2.scala +++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Macros_Test_2.scala @@ -3,8 +3,10 @@ object Macros { } object Test extends App { - import scala.reflect.mirror._ + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox val tree = Apply(Select(Ident("Macros"), newTermName("foo")), List(Typed(Apply(Ident(definitions.ListModule), List(Literal(Constant(1)), Literal(Constant(2)))), Ident(tpnme.WILDCARD_STAR)))) - try Expr(tree).eval + try cm.mkToolBox().runExpr(tree) catch { case ex: Throwable => println(ex.getMessage) } }
\ No newline at end of file diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala index f9667d78b8..5f550064e1 100644 --- a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala +++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala @@ -2,12 +2,12 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx)(xs: c.Expr[Int]*) = { - import c.mirror._ + import c.universe._ val stripped_xs = xs map (_.tree) toList match { case List(Typed(stripped, Ident(wildstar))) if wildstar == tpnme.WILDCARD_STAR => List(stripped) case _ => ??? } val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), stripped_xs) - Expr[Unit](body) + c.Expr[Unit](body) } -} +}
\ No newline at end of file diff --git a/test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala b/test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala index 8c609daa0e..8c75a7e0ea 100644 --- a/test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala +++ b/test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala @@ -6,8 +6,8 @@ object Impls { } def foo(c: Ctx)(xs: c.Expr[Int]*) = { - import c.mirror._ + import c.universe._ val body = Apply(Select(Ident(newTermName("Impls")), newTermName("myprintln")), xs.map(_.tree).toList) - Expr[Unit](body) + c.Expr[Unit](body) } -} +}
\ No newline at end of file diff --git a/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala b/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala index d97f0af786..b83fa046e5 100644 --- a/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala +++ b/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala @@ -2,8 +2,8 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx)(xs: c.Expr[Int]*) = { - import c.mirror._ + import c.universe._ val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), xs.map(_.tree).toList) - Expr[Unit](body) + c.Expr[Unit](body) } -} +}
\ No newline at end of file diff --git a/test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala b/test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala index 8c609daa0e..8c75a7e0ea 100644 --- a/test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala +++ b/test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala @@ -6,8 +6,8 @@ object Impls { } def foo(c: Ctx)(xs: c.Expr[Int]*) = { - import c.mirror._ + import c.universe._ val body = Apply(Select(Ident(newTermName("Impls")), newTermName("myprintln")), xs.map(_.tree).toList) - Expr[Unit](body) + c.Expr[Unit](body) } -} +}
\ No newline at end of file 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 cece1c09e4..8154ab0341 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 @@ -1,20 +1,21 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.{Context => Ctx} object Impls { def foo_targs[T, U: c.TypeTag](c: Ctx = null)(x: c.Expr[Int] = null) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val U = implicitly[c.TypeTag[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.tpe)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("type of prefix is: " + prefix.staticTpe)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("type of prefix tree is: " + prefix.tree.tpe)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("U is: " + U.tpe)))), Literal(Constant(()))) - Expr[Unit](body) + c.Expr[Unit](body) } } class Macros[T] { def foo_targs[U](x: Int) = macro Impls.foo_targs[T, U] -} +}
\ No newline at end of file diff --git a/test/files/run/macro-impl-rename-context/Impls_Macros_1.scala b/test/files/run/macro-impl-rename-context/Impls_Macros_1.scala index 000e351f4d..367a45a2c3 100644 --- a/test/files/run/macro-impl-rename-context/Impls_Macros_1.scala +++ b/test/files/run/macro-impl-rename-context/Impls_Macros_1.scala @@ -2,11 +2,11 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(unconventionalName: Ctx)(x: unconventionalName.Expr[Int]) = { - import unconventionalName.mirror._ + import unconventionalName.universe._ val body = Block( Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("invoking foo...")))), Literal(Constant(()))) - Expr[Unit](body) + unconventionalName.Expr[Unit](body) } } diff --git a/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Impls_Macros_1.scala b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Impls_Macros_1.scala index 828ccf34e2..5a7d1a6b9a 100644 --- a/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Impls_Macros_1.scala +++ b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Impls_Macros_1.scala @@ -2,8 +2,8 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx): c.Expr[Int] = { - import c.mirror._ - Expr(Literal(Constant("42"))) + import c.universe._ + c.Expr(Literal(Constant("42"))) } } diff --git a/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Test_2.scala b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Test_2.scala index ecf48b9752..c6caa2b585 100644 --- a/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Test_2.scala +++ b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Test_2.scala @@ -1,6 +1,8 @@ object Test extends App { - import scala.reflect.mirror._ + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox val tree = Select(Ident("Macros"), newTermName("foo")) - try Expr(tree).eval + try cm.mkToolBox().runExpr(tree) catch { case ex: Throwable => println(ex.getMessage) } }
\ No newline at end of file diff --git a/test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala b/test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala index f3a0476a35..04eef976c5 100644 --- a/test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala +++ b/test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala @@ -2,12 +2,12 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { - import c.mirror._ + import c.universe._ val body = Ident("IDoNotExist") - Expr[Int](body) + c.Expr[Int](body) } } object Macros { def foo = macro Impls.foo -} +}
\ No newline at end of file diff --git a/test/files/run/macro-invalidret-nontypeable/Test_2.scala b/test/files/run/macro-invalidret-nontypeable/Test_2.scala index ecf48b9752..c6caa2b585 100644 --- a/test/files/run/macro-invalidret-nontypeable/Test_2.scala +++ b/test/files/run/macro-invalidret-nontypeable/Test_2.scala @@ -1,6 +1,8 @@ object Test extends App { - import scala.reflect.mirror._ + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox val tree = Select(Ident("Macros"), newTermName("foo")) - try Expr(tree).eval + try cm.mkToolBox().runExpr(tree) catch { case ex: Throwable => println(ex.getMessage) } }
\ No newline at end of file diff --git a/test/files/run/macro-invalidusage-badret/Test_2.scala b/test/files/run/macro-invalidusage-badret/Test_2.scala index aeb3c26eaa..8322e8a4e0 100644 --- a/test/files/run/macro-invalidusage-badret/Test_2.scala +++ b/test/files/run/macro-invalidusage-badret/Test_2.scala @@ -1,6 +1,8 @@ object Test extends App { - import scala.reflect.mirror._ + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox val tree = Typed(Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(42)))), Ident(newTypeName("String"))) - try Expr(tree).eval + try cm.mkToolBox().runExpr(tree) catch { case ex: Throwable => println(ex.getMessage) } -}
\ No newline at end of file +} diff --git a/test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala b/test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala index 449b91d074..e5bdca008e 100644 --- a/test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala +++ b/test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala @@ -2,10 +2,10 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int])(y: c.Expr[Int]) = { - import c.mirror._ + import c.universe._ val sum = Apply(Select(x.tree, newTermName("$plus")), List(y.tree)) val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(sum)) - Expr[Unit](body) + c.Expr[Unit](body) } } diff --git a/test/files/run/macro-invalidusage-partialapplication/Test_2.scala b/test/files/run/macro-invalidusage-partialapplication/Test_2.scala index 293d906048..64020b2aa9 100644 --- a/test/files/run/macro-invalidusage-partialapplication/Test_2.scala +++ b/test/files/run/macro-invalidusage-partialapplication/Test_2.scala @@ -1,6 +1,8 @@ object Test extends App { - import scala.reflect.mirror._ + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox val tree = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(40)))) - try Expr(tree).eval + try cm.mkToolBox().runExpr(tree) catch { case ex: Throwable => println(ex.getMessage) } } diff --git a/test/files/run/macro-openmacros/Impls_Macros_1.scala b/test/files/run/macro-openmacros/Impls_Macros_1.scala index 9fd658656e..ffeccce1e8 100644 --- a/test/files/run/macro-openmacros/Impls_Macros_1.scala +++ b/test/files/run/macro-openmacros/Impls_Macros_1.scala @@ -5,7 +5,7 @@ object Macros { // we're macros, so we can reflect against our source path // so we don't need any partests to clean up after us! val c.CompilationUnit(file, _, _) = c.enclosingUnit - val dir = file.getParentFile + val dir = file.getCanonicalFile.getParentFile def normalizePaths(s: String) = { val base = (dir.getCanonicalPath + java.io.File.separator).replace('\\', '/') var regex = """\Q%s\E""" format base @@ -13,12 +13,12 @@ object Macros { if (isWin) regex = "(?i)" + regex s.replace('\\', '/').replaceAll(regex, "") } - - import c.mirror._ - val next = if (c.enclosingMacros.length < 3) Expr[Unit](Select(Ident(staticModule("Macros")), newTermName("foo"))) else c.literalUnit + + import c.universe._ + val next = if (c.enclosingMacros.length < 3) c.Expr[Unit](Select(Ident(c.mirror.staticModule("Macros")), newTermName("foo"))) else c.literalUnit c.reify { - println(c.literal(normalizePaths(c.enclosingMacros.toString)).eval) - next.eval + println(c.literal(normalizePaths(c.enclosingMacros.toString)).splice) + next.splice } } diff --git a/test/files/run/macro-range/Common_1.scala b/test/files/run/macro-range/Common_1.scala index bd46e1f529..650257ae16 100644 --- a/test/files/run/macro-range/Common_1.scala +++ b/test/files/run/macro-range/Common_1.scala @@ -1,4 +1,3 @@ -import reflect.api.Modifier import reflect.makro.Context abstract class RangeDefault { @@ -12,7 +11,7 @@ abstract class RangeDefault { /** This class should go into reflect.macro once it is a bit more stable. */ abstract class Utils { val context: Context - import context.mirror._ + import context.universe._ class TreeSubstituter(from: List[Symbol], to: List[Tree]) extends Transformer { override def transform(tree: Tree): Tree = tree match { diff --git a/test/files/run/macro-range/Expansion_Impossible_2.scala b/test/files/run/macro-range/Expansion_Impossible_2.scala index 051afff99c..fecce6bc48 100644 --- a/test/files/run/macro-range/Expansion_Impossible_2.scala +++ b/test/files/run/macro-range/Expansion_Impossible_2.scala @@ -1,4 +1,3 @@ -import reflect.api.Modifier import reflect.makro.Context object Impls { @@ -7,14 +6,15 @@ object Impls { //println("macro-expand, _this = "+ _this) object utils extends Utils { val context: c.type = c } import utils._ - import c.mirror._ + import c.universe._ + import Flag._ - val initName = newTermName("<init>") + val initName = nme.CONSTRUCTOR // Either: // scala"{ var i = $low; val h = $hi; while (i < h) { $f(i); i = i + 1 } } // or: // scala"($_this: RangeDefault).foreach($f)" - Expr(c.prefix.tree match { + c.Expr(c.prefix.tree match { case Apply(Select(New(tpt), initName), List(lo, hi)) if tpt.symbol.fullName == "Range" => val iname = newTermName("$i") val hname = newTermName("$h") @@ -28,7 +28,7 @@ object Impls { val generated = Block( List( - ValDef(Modifiers(Set(Modifier.mutable)), iname, TypeTree(), lo), + ValDef(Modifiers(MUTABLE), iname, TypeTree(), lo), ValDef(Modifiers(), hname, TypeTree(), hi)), makeWhile(labelname, cond, body)) // todo. read the compiler config and print if -Ydebug is set diff --git a/test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala b/test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala index f6caf89dca..b10f4121a6 100644 --- a/test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala +++ b/test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala @@ -2,9 +2,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]) = { - import c.mirror._ + import c.universe._ val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))) - Expr[Int](body) + c.Expr[Int](body) } } diff --git a/test/files/run/macro-reflective-ma-normal-mdmi/Test_2.scala b/test/files/run/macro-reflective-ma-normal-mdmi/Test_2.scala index 632708a125..67666a632b 100644 --- a/test/files/run/macro-reflective-ma-normal-mdmi/Test_2.scala +++ b/test/files/run/macro-reflective-ma-normal-mdmi/Test_2.scala @@ -1,5 +1,7 @@ object Test extends App { - import scala.reflect.mirror._ + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox val tree = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(42)))) - println(Expr(tree).eval) + println(cm.mkToolBox().runExpr(tree)) } diff --git a/test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala b/test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala index dc7d42d23e..dd8fcd4d9e 100644 --- a/test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala +++ b/test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala @@ -2,8 +2,8 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]) = { - import c.mirror._ + import c.universe._ val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))) - Expr[Int](body) + c.Expr[Int](body) } -} +}
\ No newline at end of file diff --git a/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala b/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala index cf34f1685d..32a8958577 100644 --- a/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala +++ b/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala @@ -3,15 +3,18 @@ //} object Test extends App { - import scala.reflect.mirror._ + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.universe.Flag._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox val macrobody = Select(Ident(newTermName("Impls")), newTermName("foo")) val macroparam = ValDef(NoMods, newTermName("x"), TypeTree(definitions.IntClass.asType), EmptyTree) - val macrodef = DefDef(Modifiers(Set(scala.reflect.api.Modifier.`macro`)), newTermName("foo"), Nil, List(List(macroparam)), TypeTree(), macrobody) + val macrodef = DefDef(Modifiers(MACRO), newTermName("foo"), Nil, List(List(macroparam)), TypeTree(), macrobody) val modulector = DefDef(NoMods, nme.CONSTRUCTOR, Nil, List(List()), TypeTree(), Block(Apply(Select(Super(This(EmptyTypeName), EmptyTypeName), nme.CONSTRUCTOR), List()))) val module = ModuleDef(NoMods, newTermName("Macros"), Template(Nil, emptyValDef, List(modulector, macrodef))) val macroapp = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(42)))) val tree = Block(macrodef, module, macroapp) - val toolbox = mkToolBox(options = "-language:experimental.macros") + val toolbox = cm.mkToolBox(options = "-language:experimental.macros") println(toolbox.runExpr(tree)) } diff --git a/test/files/run/macro-reify-basic/Macros_1.scala b/test/files/run/macro-reify-basic/Macros_1.scala index b2243d131c..7a43ee58be 100644 --- a/test/files/run/macro-reify-basic/Macros_1.scala +++ b/test/files/run/macro-reify-basic/Macros_1.scala @@ -5,7 +5,7 @@ object Macros { object Impls { def foo(c: Ctx)(s: c.Expr[String]) = c.reify { - println("hello " + s.eval) + println("hello " + s.splice) } } }
\ No newline at end of file diff --git a/test/files/run/macro-reify-eval-outside-reify/Impls_Macros_1.scala b/test/files/run/macro-reify-eval-outside-reify/Impls_Macros_1.scala deleted file mode 100644 index 086f9aeef2..0000000000 --- a/test/files/run/macro-reify-eval-outside-reify/Impls_Macros_1.scala +++ /dev/null @@ -1,12 +0,0 @@ -import scala.reflect.makro.{Context => Ctx} - -object Impls { - def foo(c: Ctx)(x: c.Expr[Int]) = { - val x1 = c.Expr[Int](c.resetAllAttrs(x.tree)) - c.literal(x1.eval) - } -} - -object Macros { - def foo(x: Int) = macro Impls.foo -} diff --git a/test/files/run/macro-reify-eval-outside-reify/Test_2.scala b/test/files/run/macro-reify-eval-outside-reify/Test_2.scala deleted file mode 100644 index 632708a125..0000000000 --- a/test/files/run/macro-reify-eval-outside-reify/Test_2.scala +++ /dev/null @@ -1,5 +0,0 @@ -object Test extends App { - import scala.reflect.mirror._ - val tree = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(42)))) - println(Expr(tree).eval) -} diff --git a/test/files/run/macro-reify-freevars.check b/test/files/run/macro-reify-freevars.check index 068742f0b6..2e925f9fa8 100644 --- a/test/files/run/macro-reify-freevars.check +++ b/test/files/run/macro-reify-freevars.check @@ -1,3 +1,3 @@ -reflective compilation has failed: - -Macro expansion contains free term variable code defined by map in Macros_1.scala:8:9. Have you forgotten to use eval when splicing this variable into a reifee? If you have troubles tracking free term variables, consider using -Xlog-free-terms +reflective compilation has failed:
+
+Macro expansion contains free term variable code defined by map in Macros_1.scala:9:9. Have you forgotten to use splice when splicing this variable into a reifee? If you have troubles tracking free term variables, consider using -Xlog-free-terms
diff --git a/test/files/run/macro-reify-freevars/Macros_1.scala b/test/files/run/macro-reify-freevars/Macros_1.scala index 3cc559a0af..eafc7f9a82 100644 --- a/test/files/run/macro-reify-freevars/Macros_1.scala +++ b/test/files/run/macro-reify-freevars/Macros_1.scala @@ -1,13 +1,14 @@ package scala.collection.slick + object QueryableMacros{ def map[T:c.TypeTag, S:c.TypeTag] (c: scala.reflect.makro.Context) - (projection: c.mirror.Expr[T => S]) - : c.mirror.Expr[scala.collection.slick.Queryable[S]] = { - import c.mirror._ + (projection: c.Expr[T => S]) + : c.Expr[scala.collection.slick.Queryable[S]] = { + import c.universe._ val code = EmptyTree c.reify{ - Queryable.factory[S]( code.asInstanceOf[reflect.mirror.Tree] ) + Queryable.factory[S]( code.asInstanceOf[reflect.runtime.universe.Tree] ) } } } @@ -15,5 +16,5 @@ class Queryable[T]{ def map[S]( projection: T => S ) : Queryable[S] = macro QueryableMacros.map[T,S] } object Queryable{ - def factory[S]( projection:scala.reflect.mirror.Tree ) : Queryable[S] = null + def factory[S]( projection:reflect.runtime.universe.Tree ) : Queryable[S] = null }
\ No newline at end of file diff --git a/test/files/run/macro-reify-freevars/Test_2.scala b/test/files/run/macro-reify-freevars/Test_2.scala index e7077f9c7f..603cf10d41 100644 --- a/test/files/run/macro-reify-freevars/Test_2.scala +++ b/test/files/run/macro-reify-freevars/Test_2.scala @@ -1,9 +1,11 @@ object Test extends App { - import scala.reflect.mirror._ + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox val q = New(AppliedTypeTree(Select(Select(Select(Ident("scala"), newTermName("collection")), newTermName("slick")), newTypeName("Queryable")), List(Ident("Int")))) val x = ValDef(NoMods, newTermName("x"), Ident("Int"), EmptyTree) val fn = Function(List(x), Apply(Select(Ident(newTermName("x")), newTermName("$plus")), List(Literal(Constant("5"))))) val tree = Apply(Select(q, newTermName("map")), List(fn)) - try Expr(tree).eval + try cm.mkToolBox().runExpr(tree) catch { case ex: Throwable => println(ex.getMessage) } }
\ No newline at end of file diff --git a/test/files/run/macro-reify-groundtypetag-notypeparams/Test.scala b/test/files/run/macro-reify-groundtypetag-notypeparams/Test.scala index d2f8fab5ec..2bead07dd9 100644 --- a/test/files/run/macro-reify-groundtypetag-notypeparams/Test.scala +++ b/test/files/run/macro-reify-groundtypetag-notypeparams/Test.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { println(implicitly[ConcreteTypeTag[Int]]) diff --git a/test/files/run/macro-reify-groundtypetag-typeparams-tags/Test.scala b/test/files/run/macro-reify-groundtypetag-typeparams-tags/Test.scala index 6d7eab5f9a..245bbe98e1 100644 --- a/test/files/run/macro-reify-groundtypetag-typeparams-tags/Test.scala +++ b/test/files/run/macro-reify-groundtypetag-typeparams-tags/Test.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { def fooTypeTag[T: ConcreteTypeTag] = { 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 1ce8f44671..f9a08df90d 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 @@ -1,17 +1,19 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} import scala.reflect.makro.Context case class Utils[C <: Context]( c:C ) { - import c.mirror._ + import c.universe._ import c.{Tree=>_} - object removeDoubleReify extends c.mirror.Transformer { + object removeDoubleReify extends c.universe.Transformer { def apply( tree:Tree ) = transform(tree) override def transform(tree: Tree): Tree = { super.transform { tree match { - case Apply(TypeApply(Select(_this, termname), _), reified::Nil ) - if termname.toString == "factory" => c.unreifyTree(reified) - case Apply(Select(_this, termname), reified::Nil ) - if termname.toString == "factory" => c.unreifyTree(reified) + case Apply(TypeApply(Select(_this, termname), _), reification::Nil ) + if termname.toString == "factory" => c.unreifyTree(reification) + case Apply(Select(_this, termname), reification::Nil ) + if termname.toString == "factory" => c.unreifyTree(reification) case _ => tree } } @@ -19,25 +21,25 @@ case class Utils[C <: Context]( c:C ) { } } object QueryableMacros{ - def _helper[C <: Context,S:c.TypeTag]( c:C )( name:String, projection:c.mirror.Expr[_] ) = { - import c.mirror._ - val element_type = implicitly[c.TypeTag[S]].tpe - val foo = Expr[reflect.mirror.Expr[Queryable[S]]]( - c.reifyTree( c.reflectMirrorPrefix, c.typeCheck( + def _helper[C <: Context,S:c.TypeTag]( c:C )( name:String, projection:c.Expr[_] ) = { + import c.universe._ + val element_type = c.typeOf[S] + val foo = c.Expr[ru.Expr[Queryable[S]]]( + c.reifyTree( c.runtimeUniverse, EmptyTree, c.typeCheck( Utils[c.type](c).removeDoubleReify( Apply(Select(c.prefix.tree, newTermName( name )), List( projection.tree )) ).asInstanceOf[Tree] ))) - c.reify{ Queryable.factory[S]( foo.eval )} + c.reify{ Queryable.factory[S]( foo.splice )} } def map[T:c.TypeTag, S:c.TypeTag] (c: scala.reflect.makro.Context) - (projection: c.mirror.Expr[T => S]): c.mirror.Expr[Queryable[S]] = _helper[c.type,S]( c )( "_map", projection ) + (projection: c.Expr[T => S]): c.Expr[Queryable[S]] = _helper[c.type,S]( c )( "_map", projection ) } class Queryable[T]{ def _map[S]( projection: T => S ) : Queryable[S] = ??? def map[S]( projection: T => S ) : Queryable[S] = macro QueryableMacros.map[T,S] } object Queryable{ - def factory[S]( projection:scala.reflect.mirror.Expr[Queryable[S]] ) : Queryable[S] = null + def factory[S]( projection:ru.Expr[Queryable[S]] ) : Queryable[S] = null }
\ No newline at end of file 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 1ce8f44671..f9a08df90d 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 @@ -1,17 +1,19 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} import scala.reflect.makro.Context case class Utils[C <: Context]( c:C ) { - import c.mirror._ + import c.universe._ import c.{Tree=>_} - object removeDoubleReify extends c.mirror.Transformer { + object removeDoubleReify extends c.universe.Transformer { def apply( tree:Tree ) = transform(tree) override def transform(tree: Tree): Tree = { super.transform { tree match { - case Apply(TypeApply(Select(_this, termname), _), reified::Nil ) - if termname.toString == "factory" => c.unreifyTree(reified) - case Apply(Select(_this, termname), reified::Nil ) - if termname.toString == "factory" => c.unreifyTree(reified) + case Apply(TypeApply(Select(_this, termname), _), reification::Nil ) + if termname.toString == "factory" => c.unreifyTree(reification) + case Apply(Select(_this, termname), reification::Nil ) + if termname.toString == "factory" => c.unreifyTree(reification) case _ => tree } } @@ -19,25 +21,25 @@ case class Utils[C <: Context]( c:C ) { } } object QueryableMacros{ - def _helper[C <: Context,S:c.TypeTag]( c:C )( name:String, projection:c.mirror.Expr[_] ) = { - import c.mirror._ - val element_type = implicitly[c.TypeTag[S]].tpe - val foo = Expr[reflect.mirror.Expr[Queryable[S]]]( - c.reifyTree( c.reflectMirrorPrefix, c.typeCheck( + def _helper[C <: Context,S:c.TypeTag]( c:C )( name:String, projection:c.Expr[_] ) = { + import c.universe._ + val element_type = c.typeOf[S] + val foo = c.Expr[ru.Expr[Queryable[S]]]( + c.reifyTree( c.runtimeUniverse, EmptyTree, c.typeCheck( Utils[c.type](c).removeDoubleReify( Apply(Select(c.prefix.tree, newTermName( name )), List( projection.tree )) ).asInstanceOf[Tree] ))) - c.reify{ Queryable.factory[S]( foo.eval )} + c.reify{ Queryable.factory[S]( foo.splice )} } def map[T:c.TypeTag, S:c.TypeTag] (c: scala.reflect.makro.Context) - (projection: c.mirror.Expr[T => S]): c.mirror.Expr[Queryable[S]] = _helper[c.type,S]( c )( "_map", projection ) + (projection: c.Expr[T => S]): c.Expr[Queryable[S]] = _helper[c.type,S]( c )( "_map", projection ) } class Queryable[T]{ def _map[S]( projection: T => S ) : Queryable[S] = ??? def map[S]( projection: T => S ) : Queryable[S] = macro QueryableMacros.map[T,S] } object Queryable{ - def factory[S]( projection:scala.reflect.mirror.Expr[Queryable[S]] ) : Queryable[S] = null + def factory[S]( projection:ru.Expr[Queryable[S]] ) : Queryable[S] = null }
\ No newline at end of file diff --git a/test/files/run/macro-reify-eval-outside-reify.check b/test/files/run/macro-reify-splice-outside-reify.check index 2f562a182f..2f562a182f 100644 --- a/test/files/run/macro-reify-eval-outside-reify.check +++ b/test/files/run/macro-reify-splice-outside-reify.check diff --git a/test/files/run/macro-reify-eval-eval.flags b/test/files/run/macro-reify-splice-outside-reify.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-reify-eval-eval.flags +++ b/test/files/run/macro-reify-splice-outside-reify.flags diff --git a/test/files/run/macro-reify-splice-outside-reify/Impls_Macros_1.scala b/test/files/run/macro-reify-splice-outside-reify/Impls_Macros_1.scala new file mode 100644 index 0000000000..3ddfe6a737 --- /dev/null +++ b/test/files/run/macro-reify-splice-outside-reify/Impls_Macros_1.scala @@ -0,0 +1,24 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(x: c.Expr[Int]) = { + val x1 = c.Expr[Int](c.resetAllAttrs(x.tree)) +// was: c.literal(x1.splice) + c.literal(eval(c)(x1)) + } + + private def eval[T](c: Ctx)(x: c.Expr[T]): T = { + import scala.reflect.runtime.{universe => ru} + val mirror = ru.runtimeMirror(c.libraryClassLoader) + import scala.tools.reflect.ToolBox + val toolBox = mirror.mkToolBox() + val importer = ru.mkImporter(c.universe).asInstanceOf[ru.Importer { val from: c.universe.type }] + val tree = c.resetAllAttrs(x.tree.duplicate) + val imported = importer.importTree(tree) + toolBox.runExpr(imported).asInstanceOf[T] + } +} + +object Macros { + def foo(x: Int) = macro Impls.foo +} diff --git a/test/files/run/macro-reify-value-outside-reify/Test_2.scala b/test/files/run/macro-reify-splice-outside-reify/Test_2.scala index 128cad4510..5bca7db668 100644 --- a/test/files/run/macro-reify-value-outside-reify/Test_2.scala +++ b/test/files/run/macro-reify-splice-outside-reify/Test_2.scala @@ -1,6 +1,8 @@ object Test extends App { - import scala.reflect.mirror._ + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox val tree = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(42)))) - try println(Expr(tree).eval) + try println(cm.mkToolBox().runExpr(tree)) catch { case ex: Throwable => println(ex.getMessage) } } diff --git a/test/files/run/macro-reify-eval-eval.check b/test/files/run/macro-reify-splice-splice.check index f35d3e67b4..f35d3e67b4 100644 --- a/test/files/run/macro-reify-eval-eval.check +++ b/test/files/run/macro-reify-splice-splice.check diff --git a/test/files/run/macro-reify-eval-outside-reify.flags b/test/files/run/macro-reify-splice-splice.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-reify-eval-outside-reify.flags +++ b/test/files/run/macro-reify-splice-splice.flags diff --git a/test/files/run/macro-reify-eval-eval/Macros_1.scala b/test/files/run/macro-reify-splice-splice/Macros_1.scala index 6b8ac94f0e..030a0a217e 100644 --- a/test/files/run/macro-reify-eval-eval/Macros_1.scala +++ b/test/files/run/macro-reify-splice-splice/Macros_1.scala @@ -6,7 +6,7 @@ object Macros { object Impls { def foo(c: Ctx) = c.reify { - { c.reify(c.reify("hello world")) }.eval.eval + { c.reify(c.reify("hello world")) }.splice.splice } } }
\ No newline at end of file diff --git a/test/files/run/macro-reify-eval-eval/Test_2.scala b/test/files/run/macro-reify-splice-splice/Test_2.scala index f697da6020..f697da6020 100644 --- a/test/files/run/macro-reify-eval-eval/Test_2.scala +++ b/test/files/run/macro-reify-splice-splice/Test_2.scala 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 2ff12091a1..63f117220a 100644 --- a/test/files/run/macro-reify-tagful-a/Macros_1.scala +++ b/test/files/run/macro-reify-tagful-a/Macros_1.scala @@ -1,3 +1,4 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.{Context => Ctx} object Macros { @@ -5,7 +6,7 @@ object Macros { object Impls { def foo[T: c.TypeTag](c: Ctx)(s: c.Expr[T]) = c.reify { - List(s.eval) + List(s.splice) } } }
\ No newline at end of file diff --git a/test/files/run/macro-reify-tagless-a/Impls_Macros_1.scala b/test/files/run/macro-reify-tagless-a/Impls_Macros_1.scala index 45e39d7d1c..3796ae99cb 100644 --- a/test/files/run/macro-reify-tagless-a/Impls_Macros_1.scala +++ b/test/files/run/macro-reify-tagless-a/Impls_Macros_1.scala @@ -5,7 +5,7 @@ object Macros { object Impls { def foo[T](c: Ctx)(s: c.Expr[T]) = c.reify { - List[T](s.eval) + List[T](s.splice) } } }
\ No newline at end of file diff --git a/test/files/run/macro-reify-tagless-a/Test_2.scala b/test/files/run/macro-reify-tagless-a/Test_2.scala index 94efbd0c37..7029e59ea1 100644 --- a/test/files/run/macro-reify-tagless-a/Test_2.scala +++ b/test/files/run/macro-reify-tagless-a/Test_2.scala @@ -2,11 +2,13 @@ object Test extends App { //val list: List[String] = Macros.foo("hello world") //println(list) - import scala.reflect.mirror._ + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox val tpt = AppliedTypeTree(Ident(definitions.ListClass), List(Ident(definitions.StringClass))) val rhs = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant("hello world")))) val list = ValDef(NoMods, newTermName("list"), tpt, rhs) val tree = Block(list, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Ident(list.name)))) - try Expr(tree).eval + try cm.mkToolBox().runExpr(tree) catch { case ex: Throwable => println(ex.getMessage) } } diff --git a/test/files/run/macro-reify-typetag-notypeparams/Test.scala b/test/files/run/macro-reify-typetag-notypeparams/Test.scala index 041a44273d..be9feac4ca 100644 --- a/test/files/run/macro-reify-typetag-notypeparams/Test.scala +++ b/test/files/run/macro-reify-typetag-notypeparams/Test.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { println(implicitly[TypeTag[Int]]) diff --git a/test/files/run/macro-reify-typetag-typeparams-notags/Test.scala b/test/files/run/macro-reify-typetag-typeparams-notags/Test.scala index a89499e7fe..6d849cde3f 100644 --- a/test/files/run/macro-reify-typetag-typeparams-notags/Test.scala +++ b/test/files/run/macro-reify-typetag-typeparams-notags/Test.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { def fooNoTypeTag[T] = { diff --git a/test/files/run/macro-reify-typetag-typeparams-tags.check b/test/files/run/macro-reify-typetag-typeparams-tags.check index 458593c449..5fd767d565 100644 --- a/test/files/run/macro-reify-typetag-typeparams-tags.check +++ b/test/files/run/macro-reify-typetag-typeparams-tags.check @@ -1,2 +1,2 @@ ConcreteTypeTag[Int]
-*ConcreteTypeTag[List[Int]]
+TypeTag[List[Int]]
diff --git a/test/files/run/macro-reify-typetag-typeparams-tags/Test.scala b/test/files/run/macro-reify-typetag-typeparams-tags/Test.scala index b32680a4b8..be0ce33e41 100644 --- a/test/files/run/macro-reify-typetag-typeparams-tags/Test.scala +++ b/test/files/run/macro-reify-typetag-typeparams-tags/Test.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { def fooTypeTag[T: TypeTag] = { diff --git a/test/files/run/macro-reify-typetag-usegroundtypetag.check b/test/files/run/macro-reify-typetag-usegroundtypetag.check index 458593c449..5fd767d565 100644 --- a/test/files/run/macro-reify-typetag-usegroundtypetag.check +++ b/test/files/run/macro-reify-typetag-usegroundtypetag.check @@ -1,2 +1,2 @@ ConcreteTypeTag[Int]
-*ConcreteTypeTag[List[Int]]
+TypeTag[List[Int]]
diff --git a/test/files/run/macro-reify-typetag-usegroundtypetag/Test.scala b/test/files/run/macro-reify-typetag-usegroundtypetag/Test.scala index de235f51cc..6363c5d472 100644 --- a/test/files/run/macro-reify-typetag-usegroundtypetag/Test.scala +++ b/test/files/run/macro-reify-typetag-usegroundtypetag/Test.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { def fooTypeTag[T: ConcreteTypeTag] = { diff --git a/test/files/run/macro-reify-unreify.check b/test/files/run/macro-reify-unreify.check index a5334cc355..8f8d9d944d 100644 --- a/test/files/run/macro-reify-unreify.check +++ b/test/files/run/macro-reify-unreify.check @@ -1 +1 @@ -hello world = Expr[String("hello world")]("hello world")
+hello world = Expr[java.lang.String("hello world")]("hello world")
diff --git a/test/files/run/macro-reify-unreify/Macros_1.scala b/test/files/run/macro-reify-unreify/Macros_1.scala index 1b0b9c6421..14777506d3 100644 --- a/test/files/run/macro-reify-unreify/Macros_1.scala +++ b/test/files/run/macro-reify-unreify/Macros_1.scala @@ -5,14 +5,14 @@ object Macros { object Impls { def foo(c: Ctx)(s: c.Expr[String]) = { - import c.mirror._ + import c.universe._ - val world = c.reifyTree(c.reflectMirrorPrefix, s.tree) - val greeting = c.reifyTree(c.reflectMirrorPrefix, c.typeCheck(Apply(Select(Literal(Constant("hello ")), newTermName("$plus")), List(c.unreifyTree(world))))) - val typedGreeting = Expr[String](greeting) + val world = c.reifyTree(c.runtimeUniverse, EmptyTree, s.tree) + val greeting = c.reifyTree(c.runtimeUniverse, EmptyTree, c.typeCheck(Apply(Select(Literal(Constant("hello ")), newTermName("$plus")), List(c.unreifyTree(world))))) + val typedGreeting = c.Expr[String](greeting) c.reify { - println("hello " + s.eval + " = " + typedGreeting.eval) + println("hello " + s.splice + " = " + typedGreeting.splice) } } } diff --git a/test/files/run/macro-reify-value-outside-reify.check b/test/files/run/macro-reify-value-outside-reify.check deleted file mode 100644 index 2f562a182f..0000000000 --- a/test/files/run/macro-reify-value-outside-reify.check +++ /dev/null @@ -1 +0,0 @@ -42
diff --git a/test/files/run/macro-reify-value-outside-reify.flags b/test/files/run/macro-reify-value-outside-reify.flags deleted file mode 100644 index cd66464f2f..0000000000 --- a/test/files/run/macro-reify-value-outside-reify.flags +++ /dev/null @@ -1 +0,0 @@ --language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-reify-value-outside-reify/Impls_Macros_1.scala b/test/files/run/macro-reify-value-outside-reify/Impls_Macros_1.scala deleted file mode 100644 index 109e19e44a..0000000000 --- a/test/files/run/macro-reify-value-outside-reify/Impls_Macros_1.scala +++ /dev/null @@ -1,12 +0,0 @@ -import scala.reflect.makro.{Context => Ctx} - -object Impls { - def foo(c: Ctx)(x: c.Expr[Int]) = { - val x1 = c.Expr[Int](c.resetAllAttrs(x.tree)) - c.literal(x1.value) - } -} - -object Macros { - def foo(x: Int) = macro Impls.foo -} diff --git a/test/files/run/macro-repl-basic.check b/test/files/run/macro-repl-basic.check index 9e0f9aa1a2..dc65e5c55b 100644 --- a/test/files/run/macro-repl-basic.check +++ b/test/files/run/macro-repl-basic.check @@ -1,54 +1,54 @@ -Type in expressions to have them evaluated. -Type :help for more information. - -scala> - -scala> import language.experimental.macros -import language.experimental.macros - -scala> import scala.reflect.makro.{Context => Ctx} -import scala.reflect.makro.{Context=>Ctx} - -scala> - -scala> object Impls { - def foo(c: Ctx)(x: c.Expr[Int]) = { - import c.mirror._ - val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))) - Expr[Int](body) - } - - def bar(c: Ctx)(x: c.Expr[Int]) = { - import c.mirror._ - val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2)))) - Expr[Int](body) - } - - def quux(c: Ctx)(x: c.Expr[Int]) = { - import c.mirror._ - val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3)))) - Expr[Int](body) - } -} -defined module Impls - -scala> object Macros { - object Shmacros { - def foo(x: Int): Int = macro Impls.foo - } - def bar(x: Int): Int = macro Impls.bar -}; class Macros { - def quux(x: Int): Int = macro Impls.quux -} -defined module Macros -defined class Macros - -scala> - -scala> import Macros.Shmacros._ -import Macros.Shmacros._ - -scala> println(foo(2) + Macros.bar(2) * new Macros().quux(4)) -31 - -scala> +Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala>
+
+scala> import language.experimental.macros
+import language.experimental.macros
+
+scala> import scala.reflect.makro.{Context => Ctx}
+import scala.reflect.makro.{Context=>Ctx}
+
+scala>
+
+scala> object Impls {
+ def foo(c: Ctx)(x: c.Expr[Int]) = {
+ import c.universe._
+ val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1))))
+ c.Expr[Int](body)
+ }
+
+ def bar(c: Ctx)(x: c.Expr[Int]) = {
+ import c.universe._
+ val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2))))
+ c.Expr[Int](body)
+ }
+
+ def quux(c: Ctx)(x: c.Expr[Int]) = {
+ import c.universe._
+ val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3))))
+ c.Expr[Int](body)
+ }
+}
+defined module Impls
+
+scala> object Macros {
+ object Shmacros {
+ def foo(x: Int): Int = macro Impls.foo
+ }
+ def bar(x: Int): Int = macro Impls.bar
+}; class Macros {
+ def quux(x: Int): Int = macro Impls.quux
+}
+defined module Macros
+defined class Macros
+
+scala>
+
+scala> import Macros.Shmacros._
+import Macros.Shmacros._
+
+scala> println(foo(2) + Macros.bar(2) * new Macros().quux(4))
+31
+
+scala>
diff --git a/test/files/run/macro-repl-basic.scala b/test/files/run/macro-repl-basic.scala index e8849b4b56..fba0aab116 100644 --- a/test/files/run/macro-repl-basic.scala +++ b/test/files/run/macro-repl-basic.scala @@ -7,21 +7,21 @@ object Test extends ReplTest { | |object Impls { | def foo(c: Ctx)(x: c.Expr[Int]) = { - | import c.mirror._ + | import c.universe._ | val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))) - | Expr[Int](body) + | c.Expr[Int](body) | } | | def bar(c: Ctx)(x: c.Expr[Int]) = { - | import c.mirror._ + | import c.universe._ | val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2)))) - | Expr[Int](body) + | c.Expr[Int](body) | } | | def quux(c: Ctx)(x: c.Expr[Int]) = { - | import c.mirror._ + | import c.universe._ | val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3)))) - | Expr[Int](body) + | c.Expr[Int](body) | } |} |object Macros { diff --git a/test/files/run/macro-settings/Impls_Macros_1.scala b/test/files/run/macro-settings/Impls_Macros_1.scala index 8c7254c79a..56e28b506c 100644 --- a/test/files/run/macro-settings/Impls_Macros_1.scala +++ b/test/files/run/macro-settings/Impls_Macros_1.scala @@ -2,7 +2,7 @@ import scala.reflect.makro.Context object Impls { def impl(c: Context) = c.reify { - println(c.literal(c.settings.toString).eval) + println(c.literal(c.settings.toString).splice) } } diff --git a/test/files/run/macro-sip19-revised/Impls_Macros_1.scala b/test/files/run/macro-sip19-revised/Impls_Macros_1.scala index e8f6e1df85..994421808e 100644 --- a/test/files/run/macro-sip19-revised/Impls_Macros_1.scala +++ b/test/files/run/macro-sip19-revised/Impls_Macros_1.scala @@ -2,16 +2,16 @@ import scala.reflect.makro.Context object Macros { def impl(c: Context) = { - import c.mirror._ + import c.universe._ - val inscope = c.inferImplicitValue(staticClass("SourceLocation").asType) - val outer = Expr[SourceLocation](if (!inscope.isEmpty) inscope else Literal(Constant(null))) + val inscope = c.inferImplicitValue(c.mirror.staticClass("SourceLocation").asType) + val outer = c.Expr[SourceLocation](if (!inscope.isEmpty) inscope else Literal(Constant(null))) val Apply(fun, args) = c.enclosingImplicits(0)._2 val fileName = fun.pos.fileInfo.getName val line = fun.pos.line val charOffset = fun.pos.point - c.reify { SourceLocation1(outer.eval, c.literal(fileName).eval, c.literal(line).eval, c.literal(charOffset).eval) } + c.reify { SourceLocation1(outer.splice, c.literal(fileName).splice, c.literal(line).splice, c.literal(charOffset).splice) } } implicit def sourceLocation: SourceLocation1 = macro impl @@ -31,4 +31,4 @@ trait SourceLocation { val charOffset: Int } -case class SourceLocation1(val outer: SourceLocation, val fileName: String, val line: Int, val charOffset: Int) extends SourceLocation +case class SourceLocation1(val outer: SourceLocation, val fileName: String, val line: Int, val charOffset: Int) extends SourceLocation
\ No newline at end of file diff --git a/test/files/run/macro-sip19/Impls_Macros_1.scala b/test/files/run/macro-sip19/Impls_Macros_1.scala index 39b29ad64c..c006ceb691 100644 --- a/test/files/run/macro-sip19/Impls_Macros_1.scala +++ b/test/files/run/macro-sip19/Impls_Macros_1.scala @@ -2,12 +2,12 @@ import scala.reflect.makro.Context object Macros { def impl(c: Context) = { - import c.mirror._ + import c.universe._ val Apply(fun, args) = c.enclosingImplicits(0)._2 val fileName = fun.pos.fileInfo.getName val line = fun.pos.line val charOffset = fun.pos.point - c.reify { SourceLocation(c.literal(fileName).eval, c.literal(line).eval, c.literal(charOffset).eval) } + c.reify { SourceLocation(c.literal(fileName).splice, c.literal(line).splice, c.literal(charOffset).splice) } } implicit def sourceLocation: SourceLocation = macro impl @@ -22,4 +22,4 @@ case class SourceLocation( /** The character offset */ val charOffset: Int -) +)
\ No newline at end of file diff --git a/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala b/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala index 4f0f76aed6..8ed435d629 100644 --- a/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala +++ b/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala @@ -2,7 +2,7 @@ import scala.reflect.makro.Context object Macros { def impl_with_implicits_enabled(c: Context) = { - import c.mirror._ + import c.universe._ val tree1 = Apply(Select(Literal(Constant(1)), newTermName("$minus$greater")), List(Literal(Constant(2)))) val ttree1 = c.typeCheck(tree1, withImplicitViewsDisabled = false) @@ -12,7 +12,7 @@ object Macros { def foo_with_implicits_enabled = macro impl_with_implicits_enabled def impl_with_implicits_disabled(c: Context) = { - import c.mirror._ + import c.universe._ try { val tree2 = Apply(Select(Literal(Constant(1)), newTermName("$minus$greater")), List(Literal(Constant(2)))) diff --git a/test/files/run/macro-typecheck-macrosdisabled.check b/test/files/run/macro-typecheck-macrosdisabled.check index 3e1057520b..da1a28bc24 100644 --- a/test/files/run/macro-typecheck-macrosdisabled.check +++ b/test/files/run/macro-typecheck-macrosdisabled.check @@ -1,5 +1,37 @@ {
- val $mr: reflect.mirror.type = scala.reflect.`package`.mirror;
- $mr.Expr.apply[Int(2)]($mr.Literal.apply($mr.Constant.apply(2)))($mr.ConcreteTypeTag.apply[Int(2)]($mr.ConstantType.apply($mr.Constant.apply(2)), classOf[scala.Int]))
+ val $u: reflect.runtime.universe.type = scala.reflect.runtime.`package`.universe;
+ val $m: $u.Mirror = scala.reflect.runtime.`package`.universe.runtimeMirror(this.getClass().getClassLoader());
+ $u.Expr.apply[Int(2)]($m, {
+ final class $treecreator1 extends TreeCreator {
+ def <init>(): $treecreator1 = {
+ $treecreator1.super.<init>();
+ ()
+ };
+ def apply[U >: Nothing <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Tree = {
+ val $u: scala.reflect.api.Universe = $m$untyped.universe.asInstanceOf[scala.reflect.api.Universe];
+ val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
+ $treecreator1.this.applyImpl[$u.type]($m).asInstanceOf[U#Tree]
+ };
+ private def applyImpl[U >: Nothing <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): scala.reflect.base.Universe#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 >: Nothing <: 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()
+ }))
}
-mr.reify[Int](2)
+ru.reify[Int](2)
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 3de9367994..2c9bce92a5 100644 --- a/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala +++ b/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala @@ -2,10 +2,10 @@ import scala.reflect.makro.Context object Macros { def impl_with_macros_enabled(c: Context) = { - import c.mirror._ + import c.universe._ - val mr = Select(Select(Select(Ident(newTermName("scala")), newTermName("reflect")), newTermName("package")), newTermName("mirror")) - val tree1 = Apply(Select(mr, newTermName("reify")), List(Literal(Constant(2)))) + val ru = Select(Select(Select(Select(Ident(newTermName("scala")), newTermName("reflect")), newTermName("runtime")), newTermName("package")), newTermName("universe")) + val tree1 = Apply(Select(ru, newTermName("reify")), List(Literal(Constant(2)))) val ttree1 = c.typeCheck(tree1, withMacrosDisabled = false) c.literal(ttree1.toString) } @@ -13,14 +13,14 @@ object Macros { def foo_with_macros_enabled = macro impl_with_macros_enabled def impl_with_macros_disabled(c: Context) = { - import c.mirror._ + import c.universe._ - val mrPkg = staticModule("scala.reflect.package") - val mrSym = selectTerm(mrPkg, "mirror") - val NullaryMethodType(mrTpe) = mrSym.typeSignature - val mr = newFreeTerm("mr", mrTpe, scala.reflect.mirror) + 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 tree2 = Apply(Select(Ident(mr), newTermName("reify")), List(Literal(Constant(2)))) + val tree2 = Apply(Select(Ident(ru), newTermName("reify")), List(Literal(Constant(2)))) val ttree2 = c.typeCheck(tree2, withMacrosDisabled = true) c.literal(ttree2.toString) } diff --git a/test/files/run/macro-typecheck-macrosdisabled2.check b/test/files/run/macro-typecheck-macrosdisabled2.check index 02da6ad0c7..e440b2c0cb 100644 --- a/test/files/run/macro-typecheck-macrosdisabled2.check +++ b/test/files/run/macro-typecheck-macrosdisabled2.check @@ -1,5 +1,37 @@ {
- val $mr: reflect.mirror.type = scala.reflect.`package`.mirror;
- $mr.Expr.apply[Array[Int]]($mr.Apply.apply($mr.Select.apply($mr.Select.apply($mr.Ident($mr.staticModule("scala")), $mr.newTermName("Array")), $mr.newTermName("apply")), scala.collection.immutable.List.apply[$mr.Literal]($mr.Literal.apply($mr.Constant.apply(2)))))($mr.ConcreteTypeTag.apply[Array[Int]]($mr.TypeRef.apply($mr.thisModuleType("scala"), $mr.staticClass("scala.Array"), scala.collection.immutable.List.apply[$mr.Type]($mr.staticClass("scala.Int").asTypeConstructor)), ScalaRunTime.this.arrayClass(classOf[scala.Int])))
+ val $u: reflect.runtime.universe.type = scala.reflect.runtime.`package`.universe;
+ val $m: $u.Mirror = scala.reflect.runtime.`package`.universe.runtimeMirror(this.getClass().getClassLoader());
+ $u.Expr.apply[Array[Int]]($m, {
+ final class $treecreator1 extends TreeCreator {
+ def <init>(): $treecreator1 = {
+ $treecreator1.super.<init>();
+ ()
+ };
+ def apply[U >: Nothing <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Tree = {
+ val $u: scala.reflect.api.Universe = $m$untyped.universe.asInstanceOf[scala.reflect.api.Universe];
+ val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
+ $treecreator1.this.applyImpl[$u.type]($m).asInstanceOf[U#Tree]
+ };
+ private def applyImpl[U >: Nothing <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): scala.reflect.base.Universe#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.staticModule("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 >: Nothing <: 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.staticModule("scala").asModuleSymbol.moduleClass), $m.staticClass("scala.Array"), scala.collection.immutable.List.apply[$u.Type]($m.staticClass("scala.Int").asTypeSymbol.asTypeConstructor))
+ }
+ };
+ new $typecreator2()
+ }))
}
-mr.reify[Array[Int]](scala.Array.apply(2))
+ru.reify[Array[Int]](scala.Array.apply(2))
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 1b840a6204..0aca9781f4 100644 --- a/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala +++ b/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala @@ -2,10 +2,10 @@ import scala.reflect.makro.Context object Macros { def impl_with_macros_enabled(c: Context) = { - import c.mirror._ + import c.universe._ - val mr = Select(Select(Select(Ident(newTermName("scala")), newTermName("reflect")), newTermName("package")), newTermName("mirror")) - val tree1 = Apply(Select(mr, newTermName("reify")), List(Apply(Select(Ident(newTermName("scala")), newTermName("Array")), List(Literal(Constant(2)))))) + val ru = Select(Select(Select(Select(Ident(newTermName("scala")), newTermName("reflect")), newTermName("runtime")), newTermName("package")), newTermName("universe")) + val tree1 = Apply(Select(ru, newTermName("reify")), List(Apply(Select(Ident(newTermName("scala")), newTermName("Array")), List(Literal(Constant(2)))))) val ttree1 = c.typeCheck(tree1, withMacrosDisabled = false) c.literal(ttree1.toString) } @@ -13,17 +13,17 @@ object Macros { def foo_with_macros_enabled = macro impl_with_macros_enabled def impl_with_macros_disabled(c: Context) = { - import c.mirror._ + import c.universe._ - val mrPkg = staticModule("scala.reflect.package") - val mrSym = selectTerm(mrPkg, "mirror") - val NullaryMethodType(mrTpe) = mrSym.typeSignature - val mr = newFreeTerm("mr", mrTpe, scala.reflect.mirror) + 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 tree2 = Apply(Select(Ident(mr), newTermName("reify")), List(Apply(Select(Ident(newTermName("scala")), newTermName("Array")), List(Literal(Constant(2)))))) + 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) c.literal(ttree2.toString) } def foo_with_macros_disabled = macro impl_with_macros_disabled -}
\ No newline at end of file +} 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 c22ff96028..bd3cd3009a 100644 --- a/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala +++ b/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala @@ -1,13 +1,14 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.Context object Macros { def cons_impl[A: c.TypeTag](c: Context)(x: c.Expr[A], xs: c.Expr[List[A]]): c.Expr[List[A]] = c.reify { - println("A = " + c.literal(implicitly[c.TypeTag[A]].toString).eval) - x.eval :: xs.eval + println("A = " + c.literal(implicitly[c.TypeTag[A]].toString).splice) + x.splice :: xs.splice } def nil_impl[B: c.TypeTag](c: Context): c.Expr[List[B]] = c.reify { - println("B = " + c.literal(implicitly[c.TypeTag[B]].toString).eval) + println("B = " + c.literal(implicitly[c.TypeTag[B]].toString).splice) Nil } diff --git a/test/files/run/macro-undetparams-implicitval/Test.scala b/test/files/run/macro-undetparams-implicitval/Test.scala index 5278295451..72fd2f3d72 100644 --- a/test/files/run/macro-undetparams-implicitval/Test.scala +++ b/test/files/run/macro-undetparams-implicitval/Test.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + object Test extends App { def foo[T: TypeTag] = println(implicitly[TypeTag[T]]) foo 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 9d65e8b0da..9b1dd8e017 100644 --- a/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala +++ b/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala @@ -1,7 +1,8 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.Context object Macros { - def impl[T: c.TypeTag](c: Context)(foo: c.Expr[T]): c.Expr[Unit] = c.reify { println(c.literal(implicitly[c.TypeTag[T]].toString).eval) } + def impl[T: c.TypeTag](c: Context)(foo: c.Expr[T]): c.Expr[Unit] = c.reify { println(c.literal(implicitly[c.TypeTag[T]].toString).splice) } def foo[T](foo: T) = macro impl[T] }
\ No newline at end of file diff --git a/test/files/run/manifests-new.scala b/test/files/run/manifests-new.scala index 4485ce9124..f1596dee81 100644 --- a/test/files/run/manifests-new.scala +++ b/test/files/run/manifests-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + object Test { object Variances extends Enumeration { @@ -54,15 +56,15 @@ object Test } def assertAnyRef[T: TypeTag] = List( - typeTag[T].tpe <:< typeTag[Any].tpe, - typeTag[T].tpe <:< typeTag[AnyRef].tpe, - !(typeTag[T].tpe <:< typeTag[AnyVal].tpe) + typeOf[T] <:< typeOf[Any], + typeOf[T] <:< typeOf[AnyRef], + !(typeOf[T] <:< typeOf[AnyVal]) ) foreach (assert(_, "assertAnyRef")) def assertAnyVal[T: TypeTag] = List( - typeTag[T].tpe <:< typeTag[Any].tpe, - !(typeTag[T].tpe <:< typeTag[AnyRef].tpe), - typeTag[T].tpe <:< typeTag[AnyVal].tpe + typeOf[T] <:< typeOf[Any], + !(typeOf[T] <:< typeOf[AnyRef]), + typeOf[T] <:< typeOf[AnyVal] ) foreach (assert(_, "assertAnyVal")) def assertSameType[T: TypeTag, U: TypeTag] = assert(typeCompare[T, U] == SAME, "assertSameType") @@ -144,4 +146,4 @@ object Test } def main(args: Array[String]): Unit = runAllTests -} +}
\ No newline at end of file diff --git a/test/files/run/newTags.check b/test/files/run/newTags.check new file mode 100644 index 0000000000..3ef7254f87 --- /dev/null +++ b/test/files/run/newTags.check @@ -0,0 +1,5 @@ +TypeRef(ThisType(class immutable),class List,List(TypeRef(ThisType(class scala),class Int,List())))
+List[Int]
+TypeRef(ThisType(class immutable),class Map,List(TypeRef(ThisType(class lang),class String,List()), TypeRef(ThisType(class lang),class String,List())))
+scala.collection.immutable.Map[java.lang.String,java.lang.String]
+ConcreteTypeTag[TypeRef(ThisType(class immutable),class Map,List(TypeRef(ThisType(class lang),class String,List()), TypeRef(ThisType(class lang),class String,List())))]
diff --git a/test/files/run/newTags.scala b/test/files/run/newTags.scala new file mode 100644 index 0000000000..a758599515 --- /dev/null +++ b/test/files/run/newTags.scala @@ -0,0 +1,14 @@ +import scala.reflect.base.{Universe => BaseUniverse} +import scala.reflect.{basis => rb} +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]) + println(ru.typeOf[T]) + println(implicitly[BaseUniverse#TypeTag[T]]) + } + foo[Map[String, String]] +}
\ No newline at end of file diff --git a/test/files/run/primitive-sigs-2-new.scala b/test/files/run/primitive-sigs-2-new.scala index 7e13014cb2..ef87a11a61 100644 --- a/test/files/run/primitive-sigs-2-new.scala +++ b/test/files/run/primitive-sigs-2-new.scala @@ -1,3 +1,4 @@ +import scala.reflect.{ArrayTag, arrayTag} import java.{ lang => jl } trait T[A] { @@ -28,4 +29,4 @@ object Test { println(new C f) c3m.sorted foreach println } -} +}
\ No newline at end of file diff --git a/test/files/run/reflect-overload.scala b/test/files/run/reflect-overload.scala index af82a1948d..ea3767903c 100644 --- a/test/files/run/reflect-overload.scala +++ b/test/files/run/reflect-overload.scala @@ -1,16 +1,19 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} + object Test extends App { - import reflect.mirror._ val s = "hello world" - val sc = symbolOfInstance(s) + val m = cm.reflect(s) + val sc = m.reflectClass.symbol val st = sc.asType - val m = st member newTermName("indexOf") + val meth = (st member newTermName("indexOf")).asTermSymbol val IntType = definitions.IntClass.asType - val indexOf = m resolveOverloaded(actuals = List(IntType)) - assert(invoke(s, indexOf)('w') == 6) - assert((invoke(s, indexOf)('w') match { case x: Int => x }) == 6) + val indexOf = (meth resolveOverloaded(actuals = List(IntType))).asMethodSymbol + assert(m.reflectMethod(indexOf)('w') == 6) + assert((m.reflectMethod(indexOf)('w') match { case x: Int => x }) == 6) - val m2 = st member newTermName("substring") - val substring = m2 resolveOverloaded(actuals = List(IntType, IntType)) - assert(invoke(s, substring)(2, 6) == "llo ") + val meth2 = (st member newTermName("substring")).asTermSymbol + val substring = (meth2 resolveOverloaded(actuals = List(IntType, IntType))).asMethodSymbol + assert(m.reflectMethod(substring)(2, 6) == "llo ") } diff --git a/test/files/run/reflection-implClass-new.scala b/test/files/run/reflection-implClass-new.scala deleted file mode 100644 index 27374f2106..0000000000 --- a/test/files/run/reflection-implClass-new.scala +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Tries to load a symbol for the `Foo$class` using Scala reflection. - * Since trait implementation classes do not get pickling information - * symbol for them should be created using fallback mechanism - * that exposes Java reflection information dressed up in - * a Scala symbol. - */ -object Test extends App with Outer { - import scala.reflect.mirror - - assert(mirror.classToSymbol(classTag[Foo].erasure).typeSignature.declaration(mirror.newTermName("bar")).typeSignature == - mirror.classToSymbol(classTag[Bar].erasure).typeSignature.declaration(mirror.newTermName("foo")).typeSignature) - - val s1 = implClass(classTag[Foo].erasure) - assert(s1 != mirror.NoSymbol) - assert(s1.typeSignature != mirror.NoType) - assert(s1.companionSymbol.typeSignature != mirror.NoType) - assert(s1.companionSymbol.typeSignature.declaration(mirror.newTermName("bar")) != mirror.NoSymbol) - val s2 = implClass(classTag[Bar].erasure) - assert(s2 != mirror.NoSymbol) - assert(s2.typeSignature != mirror.NoType) - assert(s2.companionSymbol.typeSignature != mirror.NoType) - assert(s2.companionSymbol.typeSignature.declaration(mirror.newTermName("foo")) != mirror.NoSymbol) - def implClass(clazz: Class[_]) = { - val implClass = Class.forName(clazz.getName + "$class") - mirror.classToSymbol(implClass) - } -} - -trait Foo { - def bar = 1 -} - -trait Outer { - trait Bar { - def foo = 1 - } -} diff --git a/test/files/run/reflection-implClass-old.scala b/test/files/run/reflection-implClass-old.scala deleted file mode 100644 index 6583624d8b..0000000000 --- a/test/files/run/reflection-implClass-old.scala +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Tries to load a symbol for the `Foo$class` using Scala reflection. - * Since trait implementation classes do not get pickling information - * symbol for them should be created using fallback mechanism - * that exposes Java reflection information dressed up in - * a Scala symbol. - */ -object Test extends App with Outer { - import scala.reflect.mirror - - assert(mirror.classToSymbol(manifest[Foo].erasure).typeSignature.declaration(mirror.newTermName("bar")).typeSignature == - mirror.classToSymbol(manifest[Bar].erasure).typeSignature.declaration(mirror.newTermName("foo")).typeSignature) - - val s1 = implClass(manifest[Foo].erasure) - assert(s1 != mirror.NoSymbol) - assert(s1.typeSignature != mirror.NoType) - assert(s1.companionSymbol.typeSignature != mirror.NoType) - assert(s1.companionSymbol.typeSignature.declaration(mirror.newTermName("bar")) != mirror.NoSymbol) - val s2 = implClass(manifest[Bar].erasure) - assert(s2 != mirror.NoSymbol) - assert(s2.typeSignature != mirror.NoType) - assert(s2.companionSymbol.typeSignature != mirror.NoType) - assert(s2.companionSymbol.typeSignature.declaration(mirror.newTermName("foo")) != mirror.NoSymbol) - def implClass(clazz: Class[_]) = { - val implClass = Class.forName(clazz.getName + "$class") - mirror.classToSymbol(implClass) - } -} - -trait Foo { - def bar = 1 -} - -trait Outer { - trait Bar { - def foo = 1 - } -} diff --git a/test/files/run/reflection-implClass.scala b/test/files/run/reflection-implClass.scala new file mode 100644 index 0000000000..91288562f4 --- /dev/null +++ b/test/files/run/reflection-implClass.scala @@ -0,0 +1,40 @@ +/** + * Tries to load a symbol for the `Foo$class` using Scala reflection. + * Since trait implementation classes do not get pickling information + * symbol for them should be created using fallback mechanism + * that exposes Java reflection information dressed up in + * a Scala symbol. + */ +object Test extends App with Outer { + import scala.reflect.{ClassTag, classTag} + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + + assert(cm.reflectClass(classTag[Foo].runtimeClass).symbol.typeSignature.declaration(newTermName("bar")).typeSignature == + cm.reflectClass(classTag[Bar].runtimeClass).symbol.typeSignature.declaration(newTermName("foo")).typeSignature) + + val s1 = implClass(classTag[Foo].runtimeClass) + assert(s1 != NoSymbol) + assert(s1.typeSignature != NoType) + assert(s1.companionSymbol.typeSignature != NoType) + assert(s1.companionSymbol.typeSignature.declaration(newTermName("bar")) != NoSymbol) + val s2 = implClass(classTag[Bar].runtimeClass) + assert(s2 != NoSymbol) + assert(s2.typeSignature != NoType) + assert(s2.companionSymbol.typeSignature != NoType) + assert(s2.companionSymbol.typeSignature.declaration(newTermName("foo")) != NoSymbol) + def implClass(clazz: Class[_]) = { + val implClass = Class.forName(clazz.getName + "$class") + cm.reflectClass(implClass).symbol + } +} + +trait Foo { + def bar = 1 +} + +trait Outer { + trait Bar { + def foo = 1 + } +} diff --git a/test/files/run/reflection-repl.check b/test/files/run/reflection-repl.check new file mode 100644 index 0000000000..e93fb6d6e7 --- /dev/null +++ b/test/files/run/reflection-repl.check @@ -0,0 +1,9 @@ +Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala>
+
+scala> scala.reflect.runtime.universe.typeOf[List[Nothing]]
+res0: reflect.runtime.universe.Type = List[Nothing]
+
+scala>
diff --git a/test/files/run/reflection-repl.scala b/test/files/run/reflection-repl.scala new file mode 100644 index 0000000000..72b65a1a70 --- /dev/null +++ b/test/files/run/reflection-repl.scala @@ -0,0 +1,7 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + def code = """ + |scala.reflect.runtime.universe.typeOf[List[Nothing]] + |""".stripMargin +} diff --git a/test/files/run/reflection-simple.scala b/test/files/run/reflection-simple.scala index fb3feec3cb..152d8c4505 100644 --- a/test/files/run/reflection-simple.scala +++ b/test/files/run/reflection-simple.scala @@ -5,7 +5,8 @@ object Test { def main(args: Array[String]) { System.out.println("Running") case class Foo(a: Int, b: Int, c: Int) - val props = reflect.mirror.classToType(classOf[Foo]).members.filter(_.isTerm).map(_.toString) + import scala.reflect.runtime.{currentMirror => cm} + val props = cm.reflectClass(classOf[Foo]).symbol.typeSignature.members.filter(_.isTerm).map(_.toString) props.toList.sorted foreach System.out.println } } diff --git a/test/files/run/reflinit.check b/test/files/run/reflinit.check new file mode 100644 index 0000000000..a9df3544ac --- /dev/null +++ b/test/files/run/reflinit.check @@ -0,0 +1 @@ +List[Int] diff --git a/test/files/run/reflinit.scala b/test/files/run/reflinit.scala new file mode 100644 index 0000000000..6d3ba3a4df --- /dev/null +++ b/test/files/run/reflinit.scala @@ -0,0 +1,6 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + val tt2 = typeOf[List[Int]] + println(tt2) +}
\ No newline at end of file diff --git a/test/files/run/reify-repl-fail-gracefully.check b/test/files/run/reify-repl-fail-gracefully.check index 680db12667..5a97983e54 100644 --- a/test/files/run/reify-repl-fail-gracefully.check +++ b/test/files/run/reify-repl-fail-gracefully.check @@ -1,21 +1,21 @@ -Type in expressions to have them evaluated. -Type :help for more information. - -scala> - -scala> import language.experimental.macros -import language.experimental.macros - -scala> import scala.reflect.mirror._ -import scala.reflect.mirror._ - -scala> - -scala> reify -<console>:12: error: macros cannot be partially applied - reify - ^ - -scala> - -scala> +Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala>
+
+scala> import language.experimental.macros
+import language.experimental.macros
+
+scala> import scala.reflect.runtime.universe._
+import scala.reflect.runtime.universe._
+
+scala>
+
+scala> reify
+<console>:12: error: macros cannot be partially applied
+ reify
+ ^
+
+scala>
+
+scala>
diff --git a/test/files/run/reify-repl-fail-gracefully.scala b/test/files/run/reify-repl-fail-gracefully.scala index d7a06e8da8..ed6d6cb6c9 100644 --- a/test/files/run/reify-repl-fail-gracefully.scala +++ b/test/files/run/reify-repl-fail-gracefully.scala @@ -3,7 +3,7 @@ import scala.tools.partest.ReplTest object Test extends ReplTest { def code = """ |import language.experimental.macros - |import scala.reflect.mirror._ + |import scala.reflect.runtime.universe._ | |reify """.stripMargin diff --git a/test/files/run/reify_ann1a.check b/test/files/run/reify_ann1a.check index a3944ae1ee..9df18b2362 100644 --- a/test/files/run/reify_ann1a.check +++ b/test/files/run/reify_ann1a.check @@ -14,15 +14,15 @@ ()
}
{
- @ann(immutable.this.List.apply[String]("1a")) @ann(immutable.this.List.apply[String]("1b")) class C[@ann(immutable.this.List.apply[String]("2a")) @ann(immutable.this.List.apply[String]("2b")) T] extends Object {
- @ann(immutable.this.List.apply[String]("3a")) @ann(immutable.this.List.apply[String]("3b")) <paramaccessor> private[this] val x: T @ann(immutable.this.List.apply[String]("4b")) @ann(immutable.this.List.apply[String]("4a")) = _;
- def <init>(@ann(immutable.this.List.apply[String]("3a")) @ann(immutable.this.List.apply[String]("3b")) x: T @ann(immutable.this.List.apply[String]("4b")) @ann(immutable.this.List.apply[String]("4a"))): C[T] = {
+ @ann(immutable.this.List.apply[java.lang.String]("1a")) @ann(immutable.this.List.apply[java.lang.String]("1b")) class C[@ann(immutable.this.List.apply[java.lang.String]("2a")) @ann(immutable.this.List.apply[java.lang.String]("2b")) T] extends Object {
+ @ann(immutable.this.List.apply[java.lang.String]("3a")) @ann(immutable.this.List.apply[java.lang.String]("3b")) <paramaccessor> private[this] val x: T @ann(immutable.this.List.apply[java.lang.String]("4b")) @ann(immutable.this.List.apply[java.lang.String]("4a")) = _;
+ def <init>(@ann(immutable.this.List.apply[java.lang.String]("3a")) @ann(immutable.this.List.apply[java.lang.String]("3b")) x: T @ann(immutable.this.List.apply[java.lang.String]("4b")) @ann(immutable.this.List.apply[java.lang.String]("4a"))): C[T] = {
C.super.<init>();
()
};
- @ann(immutable.this.List.apply[String]("5a")) @ann(immutable.this.List.apply[String]("5b")) def f(x: Int @ann(immutable.this.List.apply[String]("6b")) @ann(immutable.this.List.apply[String]("6a"))): Int = {
- @ann(immutable.this.List.apply[String]("7a")) @ann(immutable.this.List.apply[String]("7b")) val r: Int @ann(immutable.this.List.apply[String]("8b")) @ann(immutable.this.List.apply[String]("8a")) = ((x.+(3): Int @ann(immutable.this.List.apply[String]("8a"))): Int @ann(immutable.this.List.apply[String]("8b")) @ann(immutable.this.List.apply[String]("8a")));
- val s: Int @ann(immutable.this.List.apply[String]("9b")) @ann(immutable.this.List.apply[String]("9a")) = (4: Int @ann(immutable.this.List.apply[String]("9b")) @ann(immutable.this.List.apply[String]("9a")));
+ @ann(immutable.this.List.apply[java.lang.String]("5a")) @ann(immutable.this.List.apply[java.lang.String]("5b")) def f(x: Int @ann(immutable.this.List.apply[java.lang.String]("6b")) @ann(immutable.this.List.apply[java.lang.String]("6a"))): Int = {
+ @ann(immutable.this.List.apply[java.lang.String]("7a")) @ann(immutable.this.List.apply[java.lang.String]("7b")) val r: Int @ann(immutable.this.List.apply[java.lang.String]("8b")) @ann(immutable.this.List.apply[java.lang.String]("8a")) = ((x.+(3): Int @ann(immutable.this.List.apply[java.lang.String]("8a"))): Int @ann(immutable.this.List.apply[java.lang.String]("8b")) @ann(immutable.this.List.apply[java.lang.String]("8a")));
+ val s: Int @ann(immutable.this.List.apply[java.lang.String]("9b")) @ann(immutable.this.List.apply[java.lang.String]("9a")) = (4: Int @ann(immutable.this.List.apply[java.lang.String]("9b")) @ann(immutable.this.List.apply[java.lang.String]("9a")));
r.+(s)
}
};
diff --git a/test/files/run/reify_ann1a.scala b/test/files/run/reify_ann1a.scala index 6c062ca2c2..9f994fb2eb 100644 --- a/test/files/run/reify_ann1a.scala +++ b/test/files/run/reify_ann1a.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox class ann(bar: List[String]) extends annotation.StaticAnnotation @@ -16,7 +19,7 @@ object Test extends App { println(tree.toString) // test 2: import and typecheck - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val ttree = toolbox.typeCheck(tree) println(ttree.toString) diff --git a/test/files/run/reify_ann1b.scala b/test/files/run/reify_ann1b.scala index 4faddef72c..3e0d3e0802 100644 --- a/test/files/run/reify_ann1b.scala +++ b/test/files/run/reify_ann1b.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox class ann(bar: String) extends annotation.ClassfileAnnotation @@ -16,7 +19,7 @@ object Test extends App { println(tree.toString) // test 2: import and typecheck - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val ttree = toolbox.typeCheck(tree) println(ttree.toString) diff --git a/test/files/run/reify_ann2a.check b/test/files/run/reify_ann2a.check index 5022c50ca8..bb30441f8c 100644 --- a/test/files/run/reify_ann2a.check +++ b/test/files/run/reify_ann2a.check @@ -22,21 +22,21 @@ }
{
class ann extends scala.annotation.Annotation with scala.annotation.StaticAnnotation {
- <paramaccessor> private[this] val bar: List[String] = _;
- def <init>(bar: List[String]): ann = {
+ <paramaccessor> private[this] val bar: List[java.lang.String] = _;
+ def <init>(bar: List[java.lang.String]): ann = {
ann.super.<init>();
()
}
};
- @ann(immutable.this.List.apply[String]("1a")) @ann(immutable.this.List.apply[String]("1b")) class C[@ann(immutable.this.List.apply[String]("2a")) @ann(immutable.this.List.apply[String]("2b")) T] extends Object {
- @ann(immutable.this.List.apply[String]("3a")) @ann(immutable.this.List.apply[String]("3b")) <paramaccessor> private[this] val x: T @ann(immutable.this.List.apply[String]("4b")) @ann(immutable.this.List.apply[String]("4a")) = _;
- def <init>(@ann(immutable.this.List.apply[String]("3a")) @ann(immutable.this.List.apply[String]("3b")) x: T @ann(immutable.this.List.apply[String]("4b")) @ann(immutable.this.List.apply[String]("4a"))): C[T] = {
+ @ann(immutable.this.List.apply[java.lang.String]("1a")) @ann(immutable.this.List.apply[java.lang.String]("1b")) class C[@ann(immutable.this.List.apply[java.lang.String]("2a")) @ann(immutable.this.List.apply[java.lang.String]("2b")) T] extends Object {
+ @ann(immutable.this.List.apply[java.lang.String]("3a")) @ann(immutable.this.List.apply[java.lang.String]("3b")) <paramaccessor> private[this] val x: T @ann(immutable.this.List.apply[java.lang.String]("4b")) @ann(immutable.this.List.apply[java.lang.String]("4a")) = _;
+ def <init>(@ann(immutable.this.List.apply[java.lang.String]("3a")) @ann(immutable.this.List.apply[java.lang.String]("3b")) x: T @ann(immutable.this.List.apply[java.lang.String]("4b")) @ann(immutable.this.List.apply[java.lang.String]("4a"))): C[T] = {
C.super.<init>();
()
};
- @ann(immutable.this.List.apply[String]("5a")) @ann(immutable.this.List.apply[String]("5b")) def f(x: Int @ann(immutable.this.List.apply[String]("6b")) @ann(immutable.this.List.apply[String]("6a"))): Int = {
- @ann(immutable.this.List.apply[String]("7a")) @ann(immutable.this.List.apply[String]("7b")) val r: Int @ann(immutable.this.List.apply[String]("8b")) @ann(immutable.this.List.apply[String]("8a")) = ((x.+(3): Int @ann(immutable.this.List.apply[String]("8a"))): Int @ann(immutable.this.List.apply[String]("8b")) @ann(immutable.this.List.apply[String]("8a")));
- val s: Int @ann(immutable.this.List.apply[String]("9b")) @ann(immutable.this.List.apply[String]("9a")) = (4: Int @ann(immutable.this.List.apply[String]("9b")) @ann(immutable.this.List.apply[String]("9a")));
+ @ann(immutable.this.List.apply[java.lang.String]("5a")) @ann(immutable.this.List.apply[java.lang.String]("5b")) def f(x: Int @ann(immutable.this.List.apply[java.lang.String]("6b")) @ann(immutable.this.List.apply[java.lang.String]("6a"))): Int = {
+ @ann(immutable.this.List.apply[java.lang.String]("7a")) @ann(immutable.this.List.apply[java.lang.String]("7b")) val r: Int @ann(immutable.this.List.apply[java.lang.String]("8b")) @ann(immutable.this.List.apply[java.lang.String]("8a")) = ((x.+(3): Int @ann(immutable.this.List.apply[java.lang.String]("8a"))): Int @ann(immutable.this.List.apply[java.lang.String]("8b")) @ann(immutable.this.List.apply[java.lang.String]("8a")));
+ val s: Int @ann(immutable.this.List.apply[java.lang.String]("9b")) @ann(immutable.this.List.apply[java.lang.String]("9a")) = (4: Int @ann(immutable.this.List.apply[java.lang.String]("9b")) @ann(immutable.this.List.apply[java.lang.String]("9a")));
r.+(s)
}
};
diff --git a/test/files/run/reify_ann2a.scala b/test/files/run/reify_ann2a.scala index a1723c221d..63a17ee192 100644 --- a/test/files/run/reify_ann2a.scala +++ b/test/files/run/reify_ann2a.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox object Test extends App { // test 1: reify @@ -16,7 +19,7 @@ object Test extends App { println(tree.toString) // test 2: import and typecheck - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val ttree = toolbox.typeCheck(tree) println(ttree.toString) diff --git a/test/files/run/reify_ann3.scala b/test/files/run/reify_ann3.scala index d65e641619..dbb6a1b443 100644 --- a/test/files/run/reify_ann3.scala +++ b/test/files/run/reify_ann3.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox import scala.annotation._ import scala.annotation.meta._ @@ -10,10 +13,10 @@ object Test extends App { println(tree.toString) // test 2: import and typecheck - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val ttree = toolbox.typeCheck(tree) println(ttree.toString) // test 3: import and compile toolbox.runExpr(tree) -} +}
\ No newline at end of file diff --git a/test/files/run/reify_ann4.scala b/test/files/run/reify_ann4.scala index 5655812689..b4845d1586 100644 --- a/test/files/run/reify_ann4.scala +++ b/test/files/run/reify_ann4.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox import scala.annotation._ import scala.annotation.meta._ @@ -14,10 +17,10 @@ object Test extends App { println(tree.toString) // test 2: import and typecheck - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val ttree = toolbox.typeCheck(tree) println(ttree.toString) // test 3: import and compile toolbox.runExpr(tree) -} +}
\ No newline at end of file diff --git a/test/files/run/reify_ann5.scala b/test/files/run/reify_ann5.scala index aecc61de46..0ae8d317ce 100644 --- a/test/files/run/reify_ann5.scala +++ b/test/files/run/reify_ann5.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox import scala.annotation._ import scala.annotation.meta._ import scala.beans._ @@ -11,10 +14,10 @@ object Test extends App { println(tree.toString) // test 2: import and typecheck - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val ttree = toolbox.typeCheck(tree) println(ttree.toString) // test 3: import and compile toolbox.runExpr(tree) -} +}
\ No newline at end of file diff --git a/test/files/run/reify_anonymous.scala b/test/files/run/reify_anonymous.scala index cd740f0190..d743014dfd 100644 --- a/test/files/run/reify_anonymous.scala +++ b/test/files/run/reify_anonymous.scala @@ -1,7 +1,8 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { println(new {def x = 2; def y = x * x}.y) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/reify_classfileann_a.scala b/test/files/run/reify_classfileann_a.scala index 9aec69b4a3..0abb7b8154 100644 --- a/test/files/run/reify_classfileann_a.scala +++ b/test/files/run/reify_classfileann_a.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox class ann(bar: String, quux: Array[String] = Array(), baz: ann = null) extends annotation.ClassfileAnnotation @@ -10,7 +13,7 @@ object Test extends App { println(tree.toString) // test 2: import and typecheck - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val ttree = toolbox.typeCheck(tree) println(ttree.toString) diff --git a/test/files/run/reify_classfileann_b.scala b/test/files/run/reify_classfileann_b.scala index a37f20e72e..5ceb652a8b 100644 --- a/test/files/run/reify_classfileann_b.scala +++ b/test/files/run/reify_classfileann_b.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox class ann(bar: String, quux: Array[String] = Array(), baz: ann = null) extends annotation.ClassfileAnnotation @@ -14,7 +17,7 @@ object Test extends App { println(tree.toString) // test 2: import and typecheck - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val ttree = toolbox.typeCheck(tree) println(ttree.toString) diff --git a/test/files/run/reify_closure1.scala b/test/files/run/reify_closure1.scala index 3f5c8a8724..ce68975acc 100644 --- a/test/files/run/reify_closure1.scala +++ b/test/files/run/reify_closure1.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox object Test extends App { def foo[T](ys: List[T]): Int => Int = { @@ -6,11 +9,11 @@ object Test extends App { x }} - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val dyn = toolbox.runExpr(fun.tree) dyn.asInstanceOf[Int => Int] } println(foo(List(1, 2, 3))(10)) println(foo(List(1, 2, 3, 4))(10)) -} +}
\ No newline at end of file diff --git a/test/files/run/reify_closure2a.scala b/test/files/run/reify_closure2a.scala index f5669a0e2c..cb53e7ffa8 100644 --- a/test/files/run/reify_closure2a.scala +++ b/test/files/run/reify_closure2a.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox object Test extends App { def foo(y: Int): Int => Int = { @@ -6,11 +9,11 @@ object Test extends App { x + y }} - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val dyn = toolbox.runExpr(fun.tree) dyn.asInstanceOf[Int => Int] } println(foo(1)(10)) println(foo(2)(10)) -} +}
\ No newline at end of file diff --git a/test/files/run/reify_closure3a.scala b/test/files/run/reify_closure3a.scala index 056a705d7d..cf8c161afa 100644 --- a/test/files/run/reify_closure3a.scala +++ b/test/files/run/reify_closure3a.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox object Test extends App { def foo(y: Int): Int => Int = { @@ -8,11 +11,11 @@ object Test extends App { x + y1 }} - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val dyn = toolbox.runExpr(fun.tree) dyn.asInstanceOf[Int => Int] } println(foo(1)(10)) println(foo(2)(10)) -} +}
\ No newline at end of file diff --git a/test/files/run/reify_closure4a.scala b/test/files/run/reify_closure4a.scala index a63d20e561..1521295f16 100644 --- a/test/files/run/reify_closure4a.scala +++ b/test/files/run/reify_closure4a.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox object Test extends App { def foo(y: Int): Int => Int = { @@ -8,11 +11,11 @@ object Test extends App { x + y1 }} - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val dyn = toolbox.runExpr(fun.tree) dyn.asInstanceOf[Int => Int] } println(foo(1)(10)) println(foo(2)(10)) -} +}
\ No newline at end of file diff --git a/test/files/run/reify_closure5a.scala b/test/files/run/reify_closure5a.scala index 2e8b413f4c..84c2c08727 100644 --- a/test/files/run/reify_closure5a.scala +++ b/test/files/run/reify_closure5a.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox object Test extends App { def foo[T: TypeTag](ys: List[T]): Int => Int = { @@ -6,7 +9,7 @@ object Test extends App { x + ys.length }} - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val dyn = toolbox.runExpr(fun.tree) dyn.asInstanceOf[Int => Int] } @@ -15,4 +18,4 @@ object Test extends App { println(fun1(10)) var fun2 = foo(List(1, 2, 3, 4)) println(fun2(10)) -} +}
\ No newline at end of file diff --git a/test/files/run/reify_closure6.scala b/test/files/run/reify_closure6.scala index 2cbd4ce819..d007e80899 100644 --- a/test/files/run/reify_closure6.scala +++ b/test/files/run/reify_closure6.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox object Test extends App { var q = 0 @@ -13,7 +16,7 @@ object Test extends App { x + ys.length * z + q + y }} - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val dyn = toolbox.runExpr(fun.tree) dyn.asInstanceOf[Int => Int] } diff --git a/test/files/run/reify_closure7.scala b/test/files/run/reify_closure7.scala index b9f87dbdeb..3d4956a724 100644 --- a/test/files/run/reify_closure7.scala +++ b/test/files/run/reify_closure7.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox object Test extends App { var q = 0 @@ -15,7 +18,7 @@ object Test extends App { }} if (clo == null) { - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val dyn = toolbox.runExpr(fun.tree) clo = dyn.asInstanceOf[Int => Int] } @@ -27,4 +30,4 @@ object Test extends App { println("first invocation = " + fun1(10)) val fun2 = foo(List(1, 2, 3, 4)) println("second invocation = " + fun2(10)) -} +}
\ No newline at end of file diff --git a/test/files/run/reify_closure8a.scala b/test/files/run/reify_closure8a.scala index 9de121b42f..8db3d38241 100644 --- a/test/files/run/reify_closure8a.scala +++ b/test/files/run/reify_closure8a.scala @@ -1,12 +1,15 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox object Test extends App { class Foo(val y: Int) { def fun = reify{y} } - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val dyn = toolbox.runExpr(new Foo(10).fun.tree) val foo = dyn.asInstanceOf[Int] println(foo) -} +}
\ No newline at end of file diff --git a/test/files/run/reify_closure8b.check b/test/files/run/reify_closure8b.check index e0ec7d2c8f..585e6d5740 100644 --- a/test/files/run/reify_closure8b.check +++ b/test/files/run/reify_closure8b.check @@ -1,3 +1,3 @@ -scala.reflect.runtime.ToolBoxes$ToolBox$ToolBoxError: reflective compilation has failed:
+scala.tools.reflect.ToolBoxError: reflective compilation has failed:
value y is not a member of Test.Foo
diff --git a/test/files/run/reify_closure8b.scala b/test/files/run/reify_closure8b.scala index 431da3230e..9cdc0e997f 100644 --- a/test/files/run/reify_closure8b.scala +++ b/test/files/run/reify_closure8b.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox object Test extends App { // will fail because y is a private field @@ -8,11 +11,11 @@ object Test extends App { } try { - val dyn = mkToolBox().runExpr(new Foo(10).fun.tree) + val dyn = cm.mkToolBox().runExpr(new Foo(10).fun.tree) val foo = dyn.asInstanceOf[Int] println(foo) } catch { case ex: Throwable => println(ex) } -} +}
\ No newline at end of file diff --git a/test/files/run/reify_closures10.scala b/test/files/run/reify_closures10.scala index 0ccce77a94..2d9b833851 100644 --- a/test/files/run/reify_closures10.scala +++ b/test/files/run/reify_closures10.scala @@ -1,10 +1,13 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox object Test extends App { val x = 2 val y = 3 val code = reify{println(x + y); x + y} - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() println(toolbox.runExpr(code.tree)) -} +}
\ No newline at end of file diff --git a/test/files/run/reify_complex.scala b/test/files/run/reify_complex.scala index ecc25ffca5..4abec3900e 100644 --- a/test/files/run/reify_complex.scala +++ b/test/files/run/reify_complex.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -21,4 +22,4 @@ object Test extends App { val x = new Complex(2, 1); val y = new Complex(1, 3) println(x + y) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/reify_copypaste1.check b/test/files/run/reify_copypaste1.check new file mode 100644 index 0000000000..49a25ea881 --- /dev/null +++ b/test/files/run/reify_copypaste1.check @@ -0,0 +1,2 @@ +List(1, 2)
+
diff --git a/test/files/run/reify_copypaste1.scala b/test/files/run/reify_copypaste1.scala new file mode 100644 index 0000000000..7eaa4fa7b5 --- /dev/null +++ b/test/files/run/reify_copypaste1.scala @@ -0,0 +1,19 @@ +import scala.reflect.runtime._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.universe.definitions._ +import scala.reflect.runtime.universe.Flag._ +import scala.tools.reflect.ToolBox + +object Test extends App { + val stdout = System.out + val output = new java.io.ByteArrayOutputStream() + System.setOut(new java.io.PrintStream(output)) + val toolBox = currentMirror.mkToolBox(options = "-Yreify-copypaste") + val reify = Select(Select(Select(Select(Ident(ScalaPackage), newTermName("reflect")), newTermName("runtime")), newTermName("universe")), newTermName("reify")) + val reifee = Block(List(ValDef(Modifiers(LAZY), newTermName("x"), TypeTree(), Apply(Ident(ListModule), List(Literal(Constant(1)), Literal(Constant(2)))))), Ident(newTermName("x"))) + toolBox.runExpr(Apply(reify, List(reifee))) + val Block(List(tpeCopypaste), exprCopypaste @ ModuleDef(_, _, Template(_, _, (_ :: stats) :+ expr))) = toolBox.parseExpr(output.toString()) + output.reset() + toolBox.runExpr(Block(stats, expr)) + stdout.println(output.toString) +}
\ No newline at end of file diff --git a/test/files/run/reify_copypaste2.check b/test/files/run/reify_copypaste2.check new file mode 100644 index 0000000000..9c34f5179b --- /dev/null +++ b/test/files/run/reify_copypaste2.check @@ -0,0 +1 @@ +scala.reflect.runtime.`package`.universe.reify(Test.this.x) diff --git a/test/files/run/reify_copypaste2.scala b/test/files/run/reify_copypaste2.scala new file mode 100644 index 0000000000..12d08cf244 --- /dev/null +++ b/test/files/run/reify_copypaste2.scala @@ -0,0 +1,10 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends App { + val x = 2 + val outer = reify{reify{x}} + println(outer.tree) +}
\ No newline at end of file diff --git a/test/files/run/reify_csv.scala b/test/files/run/reify_csv.scala index 966521575c..c35624469c 100644 --- a/test/files/run/reify_csv.scala +++ b/test/files/run/reify_csv.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { val csv = """ diff --git a/test/files/run/reify_extendbuiltins.scala b/test/files/run/reify_extendbuiltins.scala index f95e9ab6ec..a2d546579d 100644 --- a/test/files/run/reify_extendbuiltins.scala +++ b/test/files/run/reify_extendbuiltins.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -11,4 +12,4 @@ object Test extends App { println("10! = " + (10!)) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/reify_for1.scala b/test/files/run/reify_for1.scala index 9d1e32f7e5..e1f5347572 100644 --- a/test/files/run/reify_for1.scala +++ b/test/files/run/reify_for1.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -6,4 +7,4 @@ object Test extends App { val sumOfSquares2 = (1 to 100).filter(_ % 3 == 0).map(Math.pow(_, 2)).sum assert(sumOfSquares1 == sumOfSquares2) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/reify_fors.check b/test/files/run/reify_fors_newpatmat.check index eefddedc20..eefddedc20 100644 --- a/test/files/run/reify_fors.check +++ b/test/files/run/reify_fors_newpatmat.check diff --git a/test/files/run/reify_fors.scala b/test/files/run/reify_fors_newpatmat.scala index 635fce049e..6bee9538a8 100644 --- a/test/files/run/reify_fors.scala +++ b/test/files/run/reify_fors_newpatmat.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -97,4 +98,4 @@ object Test extends App { val ys = List(2.0, 1.0, 3.0) println("scalProd(" + xs + ", " + ys +") = " + scalProd(xs, ys)) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/reify_fors_oldpatmat.check b/test/files/run/reify_fors_oldpatmat.check new file mode 100644 index 0000000000..eefddedc20 --- /dev/null +++ b/test/files/run/reify_fors_oldpatmat.check @@ -0,0 +1,5 @@ +Persons over 20: John Richard +divisors(34) = List(1, 2, 17, 34) +findNums(15) = (4,1) (5,2) (6,1) (7,4) (8,3) (8,5) (9,2) (9,4) (10,1) (10,3) (10,7) (11,2) (11,6) (11,8) (12,1) (12,5) (12,7) (13,4) (13,6) (13,10) (14,3) (14,5) (14,9) +average(List(3.5, 5.0, 4.5)) = 4.333333333333333 +scalProd(List(3.5, 5.0, 4.5), List(2.0, 1.0, 3.0)) = 25.5 diff --git a/test/files/run/reify_fors.flags b/test/files/run/reify_fors_oldpatmat.flags index e69de29bb2..e69de29bb2 100644 --- a/test/files/run/reify_fors.flags +++ b/test/files/run/reify_fors_oldpatmat.flags diff --git a/test/files/run/reify_fors_oldpatmat.scala b/test/files/run/reify_fors_oldpatmat.scala new file mode 100644 index 0000000000..6bee9538a8 --- /dev/null +++ b/test/files/run/reify_fors_oldpatmat.scala @@ -0,0 +1,101 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends App { + reify { + object Persons { + /** A list of persons. To create a list, we use Predef.List + * which takes a variable number of arguments and constructs + * a list out of them. + */ + val persons = List( + new Person("Bob", 17), + new Person("John", 40), + new Person("Richard", 68) + ) + + /** A Person class. 'val' constructor parameters become + * public members of the class. + */ + class Person(val name: String, val age: Int) + + /** Return an iterator over persons that are older than 20. + */ + def olderThan20(xs: Seq[Person]): Iterator[String] = + olderThan20(xs.iterator) + + /** Return an iterator over persons older than 20, given + * an iterator over persons. + */ + def olderThan20(xs: Iterator[Person]): Iterator[String] = { + + // The first expression is called a 'generator' and makes + // 'p' take values from 'xs'. The second expression is + // called a 'filter' and it is a boolean expression which + // selects only persons older than 20. There can be more than + // one generator and filter. The 'yield' expression is evaluated + // for each 'p' which satisfies the filters and used to assemble + // the resulting iterator + for (p <- xs if p.age > 20) yield p.name + } + } + + /** Some functions over lists of numbers which demonstrate + * the use of for comprehensions. + */ + object Numeric { + + /** Return the divisors of n. */ + def divisors(n: Int): List[Int] = + for (i <- List.range(1, n+1) if n % i == 0) yield i + + /** Is 'n' a prime number? */ + def isPrime(n: Int) = divisors(n).length == 2 + + /** Return pairs of numbers whose sum is prime. */ + def findNums(n: Int): Iterable[(Int, Int)] = { + + // a for comprehension using two generators + for (i <- 1 until n; + j <- 1 until (i-1); + if isPrime(i + j)) yield (i, j) + } + + /** Return the sum of the elements of 'xs'. */ + def sum(xs: List[Double]): Double = + xs.foldLeft(0.0) { (x, y) => x + y } + + /** Return the sum of pairwise product of the two lists. */ + def scalProd(xs: List[Double], ys: List[Double]) = + sum(for((x, y) <- xs zip ys) yield x * y); + + /** Remove duplicate elements in 'xs'. */ + def removeDuplicates[A](xs: List[A]): List[A] = + if (xs.isEmpty) + xs + else + xs.head :: removeDuplicates(for (x <- xs.tail if x != xs.head) yield x) + } + + // import all members of object 'persons' in the current scope + import Persons._ + + print("Persons over 20:") + olderThan20(persons) foreach { x => print(" " + x) } + println + + import Numeric._ + + println("divisors(34) = " + divisors(34)) + + print("findNums(15) =") + findNums(15) foreach { x => print(" " + x) } + println + + val xs = List(3.5, 5.0, 4.5) + println("average(" + xs + ") = " + sum(xs) / xs.length) + + val ys = List(2.0, 1.0, 3.0) + println("scalProd(" + xs + ", " + ys +") = " + scalProd(xs, ys)) + }.eval +}
\ No newline at end of file diff --git a/test/files/run/reify_generic.scala b/test/files/run/reify_generic.scala index 7033c4e237..7baffac6a3 100644 --- a/test/files/run/reify_generic.scala +++ b/test/files/run/reify_generic.scala @@ -1,8 +1,9 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { val product = List(1, 2, 3).head * List[Any](4, 2, 0).head.asInstanceOf[Int] println(product) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/reify_generic2.scala b/test/files/run/reify_generic2.scala index 8f9def318e..36ab61e077 100644 --- a/test/files/run/reify_generic2.scala +++ b/test/files/run/reify_generic2.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -6,4 +7,4 @@ object Test extends App { val product = List(new C, new C).length * List[C](new C, new C).length println(product) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/reify_getter.scala b/test/files/run/reify_getter.scala index 8bae293e72..26767603a0 100644 --- a/test/files/run/reify_getter.scala +++ b/test/files/run/reify_getter.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox object Test extends App { val code = reify { @@ -9,7 +12,7 @@ object Test extends App { new C().x } - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +}
\ No newline at end of file diff --git a/test/files/run/reify_implicits-new.scala b/test/files/run/reify_implicits-new.scala index 69198391d1..d203fe2001 100644 --- a/test/files/run/reify_implicits-new.scala +++ b/test/files/run/reify_implicits-new.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.{ArrayTag, arrayTag} +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -11,4 +13,4 @@ object Test extends App { val x = Array(2, 3, 1, 4) println("x = "+ x.sort((x: Int, y: Int) => x < y).toList) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/reify_implicits-old.scala b/test/files/run/reify_implicits-old.scala index 60971c3cfb..8ff256d2d4 100644 --- a/test/files/run/reify_implicits-old.scala +++ b/test/files/run/reify_implicits-old.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -11,4 +12,4 @@ object Test extends App { val x = Array(2, 3, 1, 4) println("x = "+ x.sort((x: Int, y: Int) => x < y).toList) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/reify_inheritance.scala b/test/files/run/reify_inheritance.scala index dd86c355a3..c732664438 100644 --- a/test/files/run/reify_inheritance.scala +++ b/test/files/run/reify_inheritance.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -13,4 +14,4 @@ object Test extends App { println(new D().y * new C().x) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/reify_inner1.scala b/test/files/run/reify_inner1.scala index ea77ece6df..8da338ee4a 100644 --- a/test/files/run/reify_inner1.scala +++ b/test/files/run/reify_inner1.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -12,4 +13,4 @@ object Test extends App { val inner = new outer.D() println(inner.x) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/reify_inner2.scala b/test/files/run/reify_inner2.scala index 67c403f7e5..f82eff8f03 100644 --- a/test/files/run/reify_inner2.scala +++ b/test/files/run/reify_inner2.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -12,4 +13,4 @@ object Test extends App { val inner = outer.D println(inner.x) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/reify_inner3.scala b/test/files/run/reify_inner3.scala index ad401d81da..72f8d9a38a 100644 --- a/test/files/run/reify_inner3.scala +++ b/test/files/run/reify_inner3.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -12,4 +13,4 @@ object Test extends App { val inner = new outer.D println(inner.x) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/reify_inner4.scala b/test/files/run/reify_inner4.scala index 140c8e9ed4..ecbbf149a4 100644 --- a/test/files/run/reify_inner4.scala +++ b/test/files/run/reify_inner4.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -12,4 +13,4 @@ object Test extends App { val inner = outer.D println(inner.x) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/reify_lazyevaluation.scala b/test/files/run/reify_lazyevaluation.scala index 1a0c858914..5b310d95f7 100644 --- a/test/files/run/reify_lazyevaluation.scala +++ b/test/files/run/reify_lazyevaluation.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { diff --git a/test/files/run/reify_maps.check b/test/files/run/reify_maps_newpatmat.check index 08cbbb1359..08cbbb1359 100644 --- a/test/files/run/reify_maps.check +++ b/test/files/run/reify_maps_newpatmat.check diff --git a/test/files/run/reify_maps.scala b/test/files/run/reify_maps_newpatmat.scala index 3fcc21892f..b538355b03 100644 --- a/test/files/run/reify_maps.scala +++ b/test/files/run/reify_maps_newpatmat.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -16,4 +17,4 @@ object Test extends App { } ) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/reify_maps_oldpatmat.check b/test/files/run/reify_maps_oldpatmat.check new file mode 100644 index 0000000000..08cbbb1359 --- /dev/null +++ b/test/files/run/reify_maps_oldpatmat.check @@ -0,0 +1,4 @@ +red has code: 16711680 +Unknown color: green +Unknown color: blue +turquoise has code: 65535 diff --git a/test/files/run/reify_maps.flags b/test/files/run/reify_maps_oldpatmat.flags index e69de29bb2..e69de29bb2 100644 --- a/test/files/run/reify_maps.flags +++ b/test/files/run/reify_maps_oldpatmat.flags diff --git a/test/files/run/reify_maps_oldpatmat.scala b/test/files/run/reify_maps_oldpatmat.scala new file mode 100644 index 0000000000..b538355b03 --- /dev/null +++ b/test/files/run/reify_maps_oldpatmat.scala @@ -0,0 +1,20 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends App { + reify { + val colors = Map("red" -> 0xFF0000, + "turquoise" -> 0x00FFFF, + "black" -> 0x000000, + "orange" -> 0xFF8040, + "brown" -> 0x804000) + for (name <- List("red", "green", "blue", "turquoise")) println( + colors.get(name) match { + case Some(code) => + name + " has code: " + code + case None => + "Unknown color: " + name + } + ) + }.eval +}
\ No newline at end of file diff --git a/test/files/run/reify_metalevel_breach_+0_refers_to_1.scala b/test/files/run/reify_metalevel_breach_+0_refers_to_1.scala index fe23bc8438..8ea92c511b 100644 --- a/test/files/run/reify_metalevel_breach_+0_refers_to_1.scala +++ b/test/files/run/reify_metalevel_breach_+0_refers_to_1.scala @@ -1,13 +1,18 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { val code = reify{ val x = 2 val inner = reify{x} +// was: inner.splice inner.eval }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +}
\ No newline at end of file diff --git a/test/files/run/reify_metalevel_breach_-1_refers_to_0_a.scala b/test/files/run/reify_metalevel_breach_-1_refers_to_0_a.scala index 5d98a38592..7ff4f84de0 100644 --- a/test/files/run/reify_metalevel_breach_-1_refers_to_0_a.scala +++ b/test/files/run/reify_metalevel_breach_-1_refers_to_0_a.scala @@ -1,11 +1,16 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { val x = 2 val outer = reify{reify{x}} +// was: val code = reify{outer.splice.splice} val code = reify{outer.eval.eval} - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +}
\ No newline at end of file diff --git a/test/files/run/reify_metalevel_breach_-1_refers_to_0_b.scala b/test/files/run/reify_metalevel_breach_-1_refers_to_0_b.scala index ca31d83acd..7f1f9d8478 100644 --- a/test/files/run/reify_metalevel_breach_-1_refers_to_0_b.scala +++ b/test/files/run/reify_metalevel_breach_-1_refers_to_0_b.scala @@ -1,15 +1,21 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { val x = 2 val code = reify{ { val inner = reify{reify{x}} +// was: inner.splice inner.eval +// was: }.splice }.eval } - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +}
\ No newline at end of file diff --git a/test/files/run/reify_metalevel_breach_-1_refers_to_1.scala b/test/files/run/reify_metalevel_breach_-1_refers_to_1.scala index 56d85c6ba1..65e0931b6e 100644 --- a/test/files/run/reify_metalevel_breach_-1_refers_to_1.scala +++ b/test/files/run/reify_metalevel_breach_-1_refers_to_1.scala @@ -1,13 +1,18 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { val code = reify{ val x = 2 val inner = reify{reify{x}} +// was: inner.splice.splice inner.eval.eval }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +}
\ No newline at end of file diff --git a/test/files/run/reify_nested_inner_refers_to_global.scala b/test/files/run/reify_nested_inner_refers_to_global.scala index 14899bcf99..f45c1daed9 100644 --- a/test/files/run/reify_nested_inner_refers_to_global.scala +++ b/test/files/run/reify_nested_inner_refers_to_global.scala @@ -1,14 +1,17 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox object Test extends App { val code = { val x = 2 reify{ - reify{x}.eval + reify{x}.splice } } - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +}
\ No newline at end of file diff --git a/test/files/run/reify_nested_inner_refers_to_local.scala b/test/files/run/reify_nested_inner_refers_to_local.scala index fd56585f72..4a3d8bb02b 100644 --- a/test/files/run/reify_nested_inner_refers_to_local.scala +++ b/test/files/run/reify_nested_inner_refers_to_local.scala @@ -1,12 +1,17 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { val code = reify{ val x = 2 +// was: reify{x}.eval reify{x}.eval }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +}
\ No newline at end of file diff --git a/test/files/run/reify_nested_outer_refers_to_global.scala b/test/files/run/reify_nested_outer_refers_to_global.scala index f34e4fe04b..b628975e59 100644 --- a/test/files/run/reify_nested_outer_refers_to_global.scala +++ b/test/files/run/reify_nested_outer_refers_to_global.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox object Test extends App { val code = { @@ -6,11 +9,11 @@ object Test extends App { val outer = reify{x} reify{ val x = 42 - outer.eval + outer.splice }; } - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +}
\ No newline at end of file diff --git a/test/files/run/reify_nested_outer_refers_to_local.scala b/test/files/run/reify_nested_outer_refers_to_local.scala index e16c851d8d..80564fa9a2 100644 --- a/test/files/run/reify_nested_outer_refers_to_local.scala +++ b/test/files/run/reify_nested_outer_refers_to_local.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox object Test extends App { val outer = { @@ -7,10 +10,10 @@ object Test extends App { } val code = reify{ val x = 42 - outer.eval + outer.splice }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +}
\ No newline at end of file diff --git a/test/files/run/reify_newimpl_01.scala b/test/files/run/reify_newimpl_01.scala index f7539a15b0..e4b46e428f 100644 --- a/test/files/run/reify_newimpl_01.scala +++ b/test/files/run/reify_newimpl_01.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_02.scala b/test/files/run/reify_newimpl_02.scala index 2c085efa04..fa7ee17acf 100644 --- a/test/files/run/reify_newimpl_02.scala +++ b/test/files/run/reify_newimpl_02.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_03.scala b/test/files/run/reify_newimpl_03.scala index 361cfc50bb..8d65425528 100644 --- a/test/files/run/reify_newimpl_03.scala +++ b/test/files/run/reify_newimpl_03.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_04.scala b/test/files/run/reify_newimpl_04.scala index d80a7c9ffd..21341ed102 100644 --- a/test/files/run/reify_newimpl_04.scala +++ b/test/files/run/reify_newimpl_04.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_05.scala b/test/files/run/reify_newimpl_05.scala index 85c1711bdb..635eba3827 100644 --- a/test/files/run/reify_newimpl_05.scala +++ b/test/files/run/reify_newimpl_05.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_06.scala b/test/files/run/reify_newimpl_06.scala index 257b54167a..0bf37da8c6 100644 --- a/test/files/run/reify_newimpl_06.scala +++ b/test/files/run/reify_newimpl_06.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { class C(val y: Int) { diff --git a/test/files/run/reify_newimpl_09.scala b/test/files/run/reify_newimpl_09.scala index 2c81945a2a..27fbd37b71 100644 --- a/test/files/run/reify_newimpl_09.scala +++ b/test/files/run/reify_newimpl_09.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_10.scala b/test/files/run/reify_newimpl_10.scala index 6e70b4d216..791e52943a 100644 --- a/test/files/run/reify_newimpl_10.scala +++ b/test/files/run/reify_newimpl_10.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_11.check b/test/files/run/reify_newimpl_11.check index e2a8206132..21bd28667e 100644 --- a/test/files/run/reify_newimpl_11.check +++ b/test/files/run/reify_newimpl_11.check @@ -1,2 +1,2 @@ -scala.reflect.runtime.ToolBoxes$ToolBox$ToolBoxError: reflective toolbox has failed:
-unresolved free type variables (namely: T defined by C in reify_newimpl_11.scala:4:11). have you forgot to use TypeTag annotations for type parameters external to a reifee? if you have troubles tracking free type variables, consider using -Xlog-free-types
+scala.tools.reflect.ToolBoxError: reflective toolbox has failed:
+unresolved free type variables (namely: T defined by C in reify_newimpl_11.scala:6:11). have you forgot to use TypeTag annotations for type parameters external to a reifee? if you have troubles tracking free type variables, consider using -Xlog-free-types
diff --git a/test/files/run/reify_newimpl_11.scala b/test/files/run/reify_newimpl_11.scala index 4e91c7a457..e8ca664418 100644 --- a/test/files/run/reify_newimpl_11.scala +++ b/test/files/run/reify_newimpl_11.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { class C[T] { diff --git a/test/files/run/reify_newimpl_12.scala b/test/files/run/reify_newimpl_12.scala index 433168ce28..246d7b4d4c 100644 --- a/test/files/run/reify_newimpl_12.scala +++ b/test/files/run/reify_newimpl_12.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { class C[T: TypeTag] { diff --git a/test/files/run/reify_newimpl_13.check b/test/files/run/reify_newimpl_13.check index 7c47310cf2..e28732bd6a 100644 --- a/test/files/run/reify_newimpl_13.check +++ b/test/files/run/reify_newimpl_13.check @@ -1,2 +1,2 @@ -scala.reflect.runtime.ToolBoxes$ToolBox$ToolBoxError: reflective toolbox has failed:
-unresolved free type variables (namely: T defined by C in reify_newimpl_13.scala:5:13). have you forgot to use TypeTag annotations for type parameters external to a reifee? if you have troubles tracking free type variables, consider using -Xlog-free-types
+scala.tools.reflect.ToolBoxError: reflective toolbox has failed:
+unresolved free type variables (namely: T defined by C in reify_newimpl_13.scala:7:13). have you forgot to use TypeTag annotations for type parameters external to a reifee? if you have troubles tracking free type variables, consider using -Xlog-free-types
diff --git a/test/files/run/reify_newimpl_13.scala b/test/files/run/reify_newimpl_13.scala index dd1980b74f..1b2b8cb529 100644 --- a/test/files/run/reify_newimpl_13.scala +++ b/test/files/run/reify_newimpl_13.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_14.scala b/test/files/run/reify_newimpl_14.scala index 3f52f19cfb..284e87acd3 100644 --- a/test/files/run/reify_newimpl_14.scala +++ b/test/files/run/reify_newimpl_14.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_15.scala b/test/files/run/reify_newimpl_15.scala index b707b2583d..cb66e8549e 100644 --- a/test/files/run/reify_newimpl_15.scala +++ b/test/files/run/reify_newimpl_15.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { class C { diff --git a/test/files/run/reify_newimpl_16.scala b/test/files/run/reify_newimpl_16.scala index 98fc15878c..a0cadf4d48 100644 --- a/test/files/run/reify_newimpl_16.scala +++ b/test/files/run/reify_newimpl_16.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_17.check b/test/files/run/reify_newimpl_17.check index 0fb9ddfc2d..e592e0e94e 100644 --- a/test/files/run/reify_newimpl_17.check +++ b/test/files/run/reify_newimpl_17.check @@ -1,2 +1,2 @@ -scala.reflect.runtime.ToolBoxes$ToolBox$ToolBoxError: reflective toolbox has failed:
-unresolved free type variables (namely: U defined by C in reify_newimpl_17.scala:4:11). have you forgot to use TypeTag annotations for type parameters external to a reifee? if you have troubles tracking free type variables, consider using -Xlog-free-types
+scala.tools.reflect.ToolBoxError: reflective toolbox has failed:
+unresolved free type variables (namely: U defined by C in reify_newimpl_17.scala:6:11). have you forgot to use TypeTag annotations for type parameters external to a reifee? if you have troubles tracking free type variables, consider using -Xlog-free-types
diff --git a/test/files/run/reify_newimpl_17.scala b/test/files/run/reify_newimpl_17.scala index 331777fcfb..8fbcd52502 100644 --- a/test/files/run/reify_newimpl_17.scala +++ b/test/files/run/reify_newimpl_17.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { class C[U] { diff --git a/test/files/run/reify_newimpl_18.scala b/test/files/run/reify_newimpl_18.scala index 704e54928a..8456fd1b8f 100644 --- a/test/files/run/reify_newimpl_18.scala +++ b/test/files/run/reify_newimpl_18.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { class C[U: TypeTag] { diff --git a/test/files/run/reify_newimpl_19.check b/test/files/run/reify_newimpl_19.check index 32f9300f53..1d96992869 100644 --- a/test/files/run/reify_newimpl_19.check +++ b/test/files/run/reify_newimpl_19.check @@ -1,2 +1,2 @@ -scala.reflect.runtime.ToolBoxes$ToolBox$ToolBoxError: reflective toolbox has failed:
-unresolved free type variables (namely: T defined by C in reify_newimpl_19.scala:5:10). have you forgot to use TypeTag annotations for type parameters external to a reifee? if you have troubles tracking free type variables, consider using -Xlog-free-types
+scala.tools.reflect.ToolBoxError: reflective toolbox has failed:
+unresolved free type variables (namely: T defined by C in reify_newimpl_19.scala:7:10). have you forgot to use TypeTag annotations for type parameters external to a reifee? if you have troubles tracking free type variables, consider using -Xlog-free-types
diff --git a/test/files/run/reify_newimpl_19.scala b/test/files/run/reify_newimpl_19.scala index 0ea8ae6992..ba2d39cfdb 100644 --- a/test/files/run/reify_newimpl_19.scala +++ b/test/files/run/reify_newimpl_19.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { class C { diff --git a/test/files/run/reify_newimpl_20.scala b/test/files/run/reify_newimpl_20.scala index 16895a449e..f8ddb53a22 100644 --- a/test/files/run/reify_newimpl_20.scala +++ b/test/files/run/reify_newimpl_20.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { class C { diff --git a/test/files/run/reify_newimpl_21.scala b/test/files/run/reify_newimpl_21.scala index 99f9ac9089..97261b21ed 100644 --- a/test/files/run/reify_newimpl_21.scala +++ b/test/files/run/reify_newimpl_21.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { trait C { diff --git a/test/files/run/reify_newimpl_22.check b/test/files/run/reify_newimpl_22.check index 51699cbc29..ebcf42f52f 100644 --- a/test/files/run/reify_newimpl_22.check +++ b/test/files/run/reify_newimpl_22.check @@ -3,8 +3,14 @@ Type :help for more information. scala>
-scala> import scala.reflect.mirror._
-import scala.reflect.mirror._
+scala> import scala.reflect.runtime.universe._
+import scala.reflect.runtime.universe._
+
+scala> import scala.tools.reflect.ToolBox
+import scala.tools.reflect.ToolBox
+
+scala> import scala.tools.reflect.Eval
+import scala.tools.reflect.Eval
scala> {
val x = 2
@@ -13,7 +19,7 @@ scala> { }
println(code.eval)
}
-<console>:13: free term: Ident(newTermName("x")) defined by res0 in <console>:12:21
+<console>:15: free term: Ident(newTermName("x")) defined by res0 in <console>:14:21
val code = reify {
^
2
diff --git a/test/files/run/reify_newimpl_22.scala b/test/files/run/reify_newimpl_22.scala index a211ad360c..8512620a16 100644 --- a/test/files/run/reify_newimpl_22.scala +++ b/test/files/run/reify_newimpl_22.scala @@ -3,7 +3,9 @@ import scala.tools.partest.ReplTest object Test extends ReplTest { override def extraSettings = "-Xlog-free-terms" def code = """ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval { val x = 2 val code = reify { @@ -12,4 +14,4 @@ import scala.reflect.mirror._ println(code.eval) } """ -} +}
\ No newline at end of file diff --git a/test/files/run/reify_newimpl_23.check b/test/files/run/reify_newimpl_23.check index 33d15190fb..c8ed424c86 100644 --- a/test/files/run/reify_newimpl_23.check +++ b/test/files/run/reify_newimpl_23.check @@ -3,8 +3,14 @@ Type :help for more information. scala>
-scala> import scala.reflect.mirror._
-import scala.reflect.mirror._
+scala> import scala.reflect.runtime.universe._
+import scala.reflect.runtime.universe._
+
+scala> import scala.tools.reflect.ToolBox
+import scala.tools.reflect.ToolBox
+
+scala> import scala.tools.reflect.Eval
+import scala.tools.reflect.Eval
scala> def foo[T]{
val code = reify {
@@ -12,7 +18,7 @@ scala> def foo[T]{ }
println(code.eval)
}
-<console>:11: free type: Ident(newTypeName("T")) defined by foo in <console>:10:16
+<console>:13: free type: Ident(newTypeName("T")) defined by foo in <console>:12:16
val code = reify {
^
foo: [T]=> Unit
diff --git a/test/files/run/reify_newimpl_23.scala b/test/files/run/reify_newimpl_23.scala index 15da4e497e..d4c2a68ce6 100644 --- a/test/files/run/reify_newimpl_23.scala +++ b/test/files/run/reify_newimpl_23.scala @@ -3,7 +3,9 @@ import scala.tools.partest.ReplTest object Test extends ReplTest { override def extraSettings = "-Xlog-free-types" def code = """ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval def foo[T]{ val code = reify { List[T]() @@ -11,4 +13,4 @@ def foo[T]{ println(code.eval) } """ -} +}
\ No newline at end of file diff --git a/test/files/run/reify_newimpl_24.check b/test/files/run/reify_newimpl_24.check deleted file mode 100644 index 66b18c790e..0000000000 --- a/test/files/run/reify_newimpl_24.check +++ /dev/null @@ -1,24 +0,0 @@ -Type in expressions to have them evaluated.
-Type :help for more information.
-
-scala>
-
-scala> import scala.reflect.mirror._
-import scala.reflect.mirror._
-
-scala> {
- val x = 2
- val code = reify {
- val y = reify { x }
- y.eval
- }
- println(code.eval)
-}
-<console>:15: this splice cannot be resolved statically
- y.eval
- ^
-2
-
-scala>
-
-scala>
diff --git a/test/files/run/reify_newimpl_24.scala b/test/files/run/reify_newimpl_24.scala deleted file mode 100644 index 7b21eeeb10..0000000000 --- a/test/files/run/reify_newimpl_24.scala +++ /dev/null @@ -1,16 +0,0 @@ -import scala.tools.partest.ReplTest - -object Test extends ReplTest { - override def extraSettings = "-Xlog-runtime-splices" - def code = """ -import scala.reflect.mirror._ -{ - val x = 2 - val code = reify { - val y = reify { x } - y.eval - } - println(code.eval) -} - """ -} diff --git a/test/files/run/reify_newimpl_25.check b/test/files/run/reify_newimpl_25.check index 37ff83c9ee..1ba001fb59 100644 --- a/test/files/run/reify_newimpl_25.check +++ b/test/files/run/reify_newimpl_25.check @@ -3,15 +3,13 @@ Type :help for more information. scala>
-scala> import scala.reflect.mirror._
-import scala.reflect.mirror._
-
scala> {
+ import scala.reflect.runtime.universe._
val x = "2"
val tt = implicitly[TypeTag[x.type]]
println(tt)
}
-<console>:13: free term: Ident(newTermName("x")) defined by res0 in <console>:12:21
+<console>:11: free term: Ident(newTermName("x")) defined by res0 in <console>:10:21
val tt = implicitly[TypeTag[x.type]]
^
ConcreteTypeTag[x.type]
diff --git a/test/files/run/reify_newimpl_25.scala b/test/files/run/reify_newimpl_25.scala index 1f66f5e681..01cc04b59f 100644 --- a/test/files/run/reify_newimpl_25.scala +++ b/test/files/run/reify_newimpl_25.scala @@ -3,11 +3,11 @@ import scala.tools.partest.ReplTest object Test extends ReplTest { override def extraSettings = "-Xlog-free-terms" def code = """ -import scala.reflect.mirror._ { + import scala.reflect.runtime.universe._ val x = "2" val tt = implicitly[TypeTag[x.type]] println(tt) } """ -} +}
\ 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 d92b3bd817..1cedc43f74 100644 --- a/test/files/run/reify_newimpl_26.check +++ b/test/files/run/reify_newimpl_26.check @@ -3,14 +3,12 @@ Type :help for more information. scala>
-scala> import scala.reflect.mirror._
-import scala.reflect.mirror._
-
scala> def foo[T]{
+ import scala.reflect.runtime.universe._
val tt = implicitly[TypeTag[List[T]]]
println(tt)
}
-<console>:11: free type: Ident(newTypeName("T")) defined by foo in <console>:10:16
+<console>:9: free type: Ident(newTypeName("T")) defined by foo in <console>:7:16
val tt = implicitly[TypeTag[List[T]]]
^
foo: [T]=> Unit
diff --git a/test/files/run/reify_newimpl_26.scala b/test/files/run/reify_newimpl_26.scala index f2dd1bfc4e..bb36c91d0e 100644 --- a/test/files/run/reify_newimpl_26.scala +++ b/test/files/run/reify_newimpl_26.scala @@ -3,11 +3,11 @@ import scala.tools.partest.ReplTest object Test extends ReplTest { override def extraSettings = "-Xlog-free-types" def code = """ -import scala.reflect.mirror._ def foo[T]{ + import scala.reflect.runtime.universe._ val tt = implicitly[TypeTag[List[T]]] println(tt) } foo[Int] """ -} +}
\ No newline at end of file diff --git a/test/files/run/reify_newimpl_27.scala b/test/files/run/reify_newimpl_27.scala index b3d6d5c865..db9ada36e4 100644 --- a/test/files/run/reify_newimpl_27.scala +++ b/test/files/run/reify_newimpl_27.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { object C { diff --git a/test/files/run/reify_newimpl_28.scala b/test/files/run/reify_newimpl_28.scala index f7874b8548..524a110704 100644 --- a/test/files/run/reify_newimpl_28.scala +++ b/test/files/run/reify_newimpl_28.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_29.scala b/test/files/run/reify_newimpl_29.scala index e32762f335..033c360b8c 100644 --- a/test/files/run/reify_newimpl_29.scala +++ b/test/files/run/reify_newimpl_29.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { class C { diff --git a/test/files/run/reify_newimpl_30.scala b/test/files/run/reify_newimpl_30.scala index e4ba3221e1..573d05a630 100644 --- a/test/files/run/reify_newimpl_30.scala +++ b/test/files/run/reify_newimpl_30.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_31.scala b/test/files/run/reify_newimpl_31.scala index 20a851e32e..2e20aa0f62 100644 --- a/test/files/run/reify_newimpl_31.scala +++ b/test/files/run/reify_newimpl_31.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { object C { diff --git a/test/files/run/reify_newimpl_32.scala b/test/files/run/reify_newimpl_32.scala index 788486ec00..095e59d919 100644 --- a/test/files/run/reify_newimpl_32.scala +++ b/test/files/run/reify_newimpl_32.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_33.scala b/test/files/run/reify_newimpl_33.scala index 84a8258256..98bb2e5102 100644 --- a/test/files/run/reify_newimpl_33.scala +++ b/test/files/run/reify_newimpl_33.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { object C { diff --git a/test/files/run/reify_newimpl_34.scala b/test/files/run/reify_newimpl_34.scala index 5935ab385c..a0a575ed7d 100644 --- a/test/files/run/reify_newimpl_34.scala +++ b/test/files/run/reify_newimpl_34.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_35.check b/test/files/run/reify_newimpl_35.check new file mode 100644 index 0000000000..f8306003b5 --- /dev/null +++ b/test/files/run/reify_newimpl_35.check @@ -0,0 +1,17 @@ +Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala>
+
+scala> import scala.reflect.runtime.universe._
+import scala.reflect.runtime.universe._
+
+scala> def foo[T: TypeTag] = reify{List[T]()}
+foo: [T](implicit evidence$1: reflect.runtime.universe.TypeTag[T])reflect.runtime.universe.Expr[List[T]]
+
+scala> println(foo)
+Expr[List[Nothing]](immutable.this.Nil)
+
+scala>
+
+scala>
diff --git a/test/files/run/reify_newimpl_35.scala b/test/files/run/reify_newimpl_35.scala new file mode 100644 index 0000000000..f2ebf5181b --- /dev/null +++ b/test/files/run/reify_newimpl_35.scala @@ -0,0 +1,10 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + override def extraSettings = "-Xlog-free-types" + def code = """ +import scala.reflect.runtime.universe._ +def foo[T: TypeTag] = reify{List[T]()} +println(foo) + """ +} diff --git a/test/files/run/reify_newimpl_36.scala b/test/files/run/reify_newimpl_36.scala index c76efce27a..490e645cf7 100644 --- a/test/files/run/reify_newimpl_36.scala +++ b/test/files/run/reify_newimpl_36.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_37.scala b/test/files/run/reify_newimpl_37.scala index e83d35dbe1..7c4d4af3dd 100644 --- a/test/files/run/reify_newimpl_37.scala +++ b/test/files/run/reify_newimpl_37.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_38.scala b/test/files/run/reify_newimpl_38.scala index 70ef49ecf7..fd898b9ab2 100644 --- a/test/files/run/reify_newimpl_38.scala +++ b/test/files/run/reify_newimpl_38.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_39.scala b/test/files/run/reify_newimpl_39.scala index faa45d917d..885c738275 100644 --- a/test/files/run/reify_newimpl_39.scala +++ b/test/files/run/reify_newimpl_39.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_40.scala b/test/files/run/reify_newimpl_40.scala index a983a92324..018bf720f3 100644 --- a/test/files/run/reify_newimpl_40.scala +++ b/test/files/run/reify_newimpl_40.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_41.scala b/test/files/run/reify_newimpl_41.scala index 9aedccc98a..9bb79fb2b9 100644 --- a/test/files/run/reify_newimpl_41.scala +++ b/test/files/run/reify_newimpl_41.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_42.scala b/test/files/run/reify_newimpl_42.scala index 1e21bd59bc..bd7deadea6 100644 --- a/test/files/run/reify_newimpl_42.scala +++ b/test/files/run/reify_newimpl_42.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_43.scala b/test/files/run/reify_newimpl_43.scala index 962461db8b..88ea224322 100644 --- a/test/files/run/reify_newimpl_43.scala +++ b/test/files/run/reify_newimpl_43.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_44.scala b/test/files/run/reify_newimpl_44.scala index 962461db8b..88ea224322 100644 --- a/test/files/run/reify_newimpl_44.scala +++ b/test/files/run/reify_newimpl_44.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_45.scala b/test/files/run/reify_newimpl_45.scala index b2b52eaf5b..d2254d6dde 100644 --- a/test/files/run/reify_newimpl_45.scala +++ b/test/files/run/reify_newimpl_45.scala @@ -1,11 +1,14 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox 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(freeTypes(code.tree)) - val T = freeTypes(code.tree)(0) - mkToolBox().runExpr(code.tree, Map(T -> definitions.StringClass.asType)) + println(code.tree.freeTypes) + val T = code.tree.freeTypes(0) + cm.mkToolBox().runExpr(code.tree, Map(T -> definitions.StringClass.asType)) } new C[String] diff --git a/test/files/run/reify_newimpl_47.scala b/test/files/run/reify_newimpl_47.scala index bd1bd1fe65..8740132f6a 100644 --- a/test/files/run/reify_newimpl_47.scala +++ b/test/files/run/reify_newimpl_47.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { val outer = { @@ -8,8 +10,8 @@ object Test extends App { val code = reify{ val x = 42 - outer.eval + outer.splice } println(code.eval) -} +}
\ No newline at end of file diff --git a/test/files/run/reify_newimpl_48.scala b/test/files/run/reify_newimpl_48.scala index 1522509907..9899bc09a0 100644 --- a/test/files/run/reify_newimpl_48.scala +++ b/test/files/run/reify_newimpl_48.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { val outer1 = { @@ -13,8 +15,8 @@ object Test extends App { val code = reify{ val x = 4 - x + outer1.eval + outer2.eval + x + outer1.splice + outer2.splice } println(code.eval) -} +}
\ No newline at end of file diff --git a/test/files/run/reify_newimpl_49.scala b/test/files/run/reify_newimpl_49.scala index 68d968e28b..2222bd69d5 100644 --- a/test/files/run/reify_newimpl_49.scala +++ b/test/files/run/reify_newimpl_49.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_50.scala b/test/files/run/reify_newimpl_50.scala index b81d72a4eb..279cb161a0 100644 --- a/test/files/run/reify_newimpl_50.scala +++ b/test/files/run/reify_newimpl_50.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_51.scala b/test/files/run/reify_newimpl_51.scala index ccbae2e160..f823bf4033 100644 --- a/test/files/run/reify_newimpl_51.scala +++ b/test/files/run/reify_newimpl_51.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_52.scala b/test/files/run/reify_newimpl_52.scala index 60b16d3618..f01199e830 100644 --- a/test/files/run/reify_newimpl_52.scala +++ b/test/files/run/reify_newimpl_52.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_printf.scala b/test/files/run/reify_printf.scala index dc092c1a85..1b1c6fdbb8 100644 --- a/test/files/run/reify_printf.scala +++ b/test/files/run/reify_printf.scala @@ -1,20 +1,20 @@ import java.io.{ ByteArrayOutputStream, PrintStream } -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox import scala.reflect.api._ import scala.reflect.api.Trees import scala.reflect.internal.Types import scala.util.matching.Regex object Test extends App { - val tree = tree_printf(reify("hello %s").tree, reify("world").tree) - - import scala.reflect.mirror._ - val toolbox = mkToolBox() - val output = new ByteArrayOutputStream() Console.setOut(new PrintStream(output)) - val evaluated = toolbox.runExpr(tree) + val toolbox = cm.mkToolBox() + val tree = tree_printf(reify("hello %s").tree, reify("world").tree) + val evaluated = toolbox.runExpr(tree) assert(output.toString() == "hello world", output.toString() +" == hello world") /* @@ -30,9 +30,9 @@ object Test extends App { ( Some( ValDef( - Modifiers() + NoMods , local - , TypeTree().setType(tpe) + , TypeTree(tpe) , value ) ) @@ -44,8 +44,8 @@ object Test extends App { val Literal(Constant(s_format: String)) = format val paramsStack = scala.collection.mutable.Stack(params: _*) val parsed = s_format.split("(?<=%[\\w%])|(?=%[\\w%])") map { - case "%d" => createTempValDef( paramsStack.pop, classToType(classOf[Int]) ) - case "%s" => createTempValDef( paramsStack.pop, classToType(classOf[String]) ) + case "%d" => createTempValDef( paramsStack.pop, IntTpe ) + case "%s" => createTempValDef( paramsStack.pop, StringTpe ) case "%%" => { (None:Option[Tree], Literal(Constant("%"))) } @@ -68,4 +68,4 @@ object Test extends App { ): Tree Block((evals ++ prints).toList, Literal(Constant(()))) } -} +}
\ No newline at end of file diff --git a/test/files/run/reify_properties.scala b/test/files/run/reify_properties.scala index 5cacc262ac..01a9b12a92 100644 --- a/test/files/run/reify_properties.scala +++ b/test/files/run/reify_properties.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { diff --git a/test/files/run/reify_sort.scala b/test/files/run/reify_sort.scala index 0b373b358f..17e3976c09 100644 --- a/test/files/run/reify_sort.scala +++ b/test/files/run/reify_sort.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -47,4 +48,4 @@ object Test extends App { sort(ar) println(ar) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/reify_sort1.scala b/test/files/run/reify_sort1.scala index 56125619e9..6fb3cc5895 100644 --- a/test/files/run/reify_sort1.scala +++ b/test/files/run/reify_sort1.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -17,4 +18,4 @@ object Test extends App { println(xs) println(sort(xs)) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/reify_this.scala b/test/files/run/reify_this.scala index 280d735ab6..ecbf394bba 100644 --- a/test/files/run/reify_this.scala +++ b/test/files/run/reify_this.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval trait Eval { def eval(tree: Expr[_]) = tree.eval @@ -16,4 +17,4 @@ object Test extends App with Eval { // select a value from module val x = 2 eval(reify{println(x)}) -} +}
\ No newline at end of file diff --git a/test/files/run/reify_timeofday.scala b/test/files/run/reify_timeofday.scala index 481ab04df5..efeb81debf 100644 --- a/test/files/run/reify_timeofday.scala +++ b/test/files/run/reify_timeofday.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -38,4 +39,4 @@ object Test extends App { case e: Exception => println("Exception") } }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/reify_typerefs_1a.scala b/test/files/run/reify_typerefs_1a.scala index 15d8d17835..53033e210c 100644 --- a/test/files/run/reify_typerefs_1a.scala +++ b/test/files/run/reify_typerefs_1a.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox class Expression { override def toString = "Expression" @@ -9,7 +12,7 @@ object Test extends App { List(new Expression, new Expression) }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +}
\ No newline at end of file diff --git a/test/files/run/reify_typerefs_1b.scala b/test/files/run/reify_typerefs_1b.scala index 06ce1e35ac..12604454ed 100644 --- a/test/files/run/reify_typerefs_1b.scala +++ b/test/files/run/reify_typerefs_1b.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox object Expression { override def toString = "Expression" @@ -9,7 +12,7 @@ object Test extends App { List(Expression, Expression) }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +}
\ No newline at end of file diff --git a/test/files/run/reify_typerefs_2a.scala b/test/files/run/reify_typerefs_2a.scala index d03efea222..ffc3dfc942 100644 --- a/test/files/run/reify_typerefs_2a.scala +++ b/test/files/run/reify_typerefs_2a.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox package foo { class Expression { @@ -11,7 +14,7 @@ object Test extends App { List(new foo.Expression, new foo.Expression) }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +}
\ No newline at end of file diff --git a/test/files/run/reify_typerefs_2b.scala b/test/files/run/reify_typerefs_2b.scala index 3d9f7d61b8..f5d1633d79 100644 --- a/test/files/run/reify_typerefs_2b.scala +++ b/test/files/run/reify_typerefs_2b.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox package foo { object Expression { @@ -11,7 +14,7 @@ object Test extends App { List(foo.Expression, foo.Expression) }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +}
\ No newline at end of file diff --git a/test/files/run/reify_typerefs_3a.scala b/test/files/run/reify_typerefs_3a.scala index 4128073f60..67b2c2d8aa 100644 --- a/test/files/run/reify_typerefs_3a.scala +++ b/test/files/run/reify_typerefs_3a.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox object foo { class Expression { @@ -11,7 +14,7 @@ object Test extends App { List(new foo.Expression, new foo.Expression) }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +}
\ No newline at end of file diff --git a/test/files/run/reify_typerefs_3b.scala b/test/files/run/reify_typerefs_3b.scala index a7ede00c9c..41a0a667e2 100644 --- a/test/files/run/reify_typerefs_3b.scala +++ b/test/files/run/reify_typerefs_3b.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox object foo { object Expression { @@ -11,7 +14,7 @@ object Test extends App { List(foo.Expression, foo.Expression) }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +}
\ No newline at end of file diff --git a/test/files/run/reify_varargs.scala b/test/files/run/reify_varargs.scala index fe8f03b702..1cbc7c9473 100644 --- a/test/files/run/reify_varargs.scala +++ b/test/files/run/reify_varargs.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -7,4 +8,4 @@ object Test extends App { "Hoth", "the fifth of August", "a disturbance in the Force") println("Message="+msg) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/t5273_2a.check b/test/files/run/runtimeEval1.check index d8263ee986..d8263ee986 100644 --- a/test/files/run/t5273_2a.check +++ b/test/files/run/runtimeEval1.check diff --git a/test/files/run/runtimeEval1.scala b/test/files/run/runtimeEval1.scala new file mode 100644 index 0000000000..9497b52918 --- /dev/null +++ b/test/files/run/runtimeEval1.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends App { + reify { + val x = 2 + println(x) + }.eval +}
\ No newline at end of file diff --git a/test/files/run/runtimeEval2.check b/test/files/run/runtimeEval2.check new file mode 100644 index 0000000000..78c6baefdd --- /dev/null +++ b/test/files/run/runtimeEval2.check @@ -0,0 +1 @@ +2
diff --git a/test/files/run/runtimeEval2.scala b/test/files/run/runtimeEval2.scala new file mode 100644 index 0000000000..513b820129 --- /dev/null +++ b/test/files/run/runtimeEval2.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends App { + val x = 2 + val outer = reify{reify{x}} + println(outer.eval.eval) +}
\ No newline at end of file diff --git a/test/files/run/t0421-new.scala b/test/files/run/t0421-new.scala index 7de6b7f2c4..63c4ab5c73 100644 --- a/test/files/run/t0421-new.scala +++ b/test/files/run/t0421-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ArrayTag, arrayTag} + // ticket #421 object Test extends App { @@ -27,4 +29,4 @@ object Test extends App { println(matmul(Array(Array(2, 3)), Array(Array(5), Array(7))).deep.mkString("[", ",", "]")) println(matmul(Array(Array(4)), Array(Array(6, 8))).deep.mkString("[", ",", "]")) -} +}
\ No newline at end of file diff --git a/test/files/run/t0677-new.scala b/test/files/run/t0677-new.scala index bf7a3971dc..85332401b7 100644 --- a/test/files/run/t0677-new.scala +++ b/test/files/run/t0677-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ArrayTag, arrayTag} + object Test extends App { class X[T: ArrayTag] { val a = Array.ofDim[T](3, 4) @@ -5,4 +7,4 @@ object Test extends App { val x = new X[String] x.a(1)(2) = "hello" assert(x.a(1)(2) == "hello") -} +}
\ No newline at end of file diff --git a/test/files/run/t1195-new.check b/test/files/run/t1195-new.check index 554e3fd03d..4dd1661d1b 100644 --- a/test/files/run/t1195-new.check +++ b/test/files/run/t1195-new.check @@ -1,6 +1,6 @@ -ConcreteTypeTag[Bar.type], underlying = <: scala.runtime.AbstractFunction1[Int,Bar] with Serializable{case def unapply(x$0: Bar): Option[Int]} with Singleton
-ConcreteTypeTag[Bar], underlying = <: Product with Serializable{val x: Int; def copy(x: Int): Bar; def copy$default$1: Int; def _1: Int}
-ConcreteTypeTag[Product with Serializable], underlying = Product with Serializable
-ConcreteTypeTag[Bar.type], underlying = <: scala.runtime.AbstractFunction1[Int,Bar] with Serializable{case def unapply(x$0: Bar): Option[Int]} with Singleton
-ConcreteTypeTag[Bar], underlying = <: Product with Serializable{val x: Int; def copy(x: Int): Bar; def copy$default$1: Int; def _1: Int}
-ConcreteTypeTag[Product with Serializable], underlying = Product with Serializable
+Bar.type, underlying = <: scala.runtime.AbstractFunction1[Int,Bar] with Serializable{case def unapply(x$0: Bar): Option[Int]} with Singleton
+Bar, underlying = <: Product with Serializable{val x: Int; def copy(x: Int): Bar; def copy$default$1: Int; def _1: Int}
+Product with Serializable, underlying = Product with Serializable
+Bar.type, underlying = <: scala.runtime.AbstractFunction1[Int,Bar] with Serializable{case def unapply(x$0: Bar): Option[Int]} with Singleton
+Bar, underlying = <: Product with Serializable{val x: Int; def copy(x: Int): Bar; def copy$default$1: Int; def _1: Int}
+Product with Serializable, underlying = Product with Serializable
diff --git a/test/files/run/t1195-new.scala b/test/files/run/t1195-new.scala index 6f28a4a167..4edfb5073f 100644 --- a/test/files/run/t1195-new.scala +++ b/test/files/run/t1195-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + object Test { def f() = { case class Bar(x: Int); Bar } def g() = { case class Bar(x: Int); Bar(5) } @@ -7,7 +9,7 @@ object Test { val g1 = g() val h1 = h() - def m[T: TypeTag](x: T) = println(typeTag[T] + ", underlying = " + typeTag[T].sym.typeSignature) + def m[T: TypeTag](x: T) = println(typeOf[T] + ", underlying = " + typeOf[T].typeSymbol.typeSignature) def main(args: Array[String]): Unit = { m(f) @@ -23,4 +25,4 @@ class A1[T] { class B1[U] { def f = { case class D(x: Int) extends A1[String] ; new D(5) } } -} +}
\ No newline at end of file diff --git a/test/files/run/t2236-new.scala b/test/files/run/t2236-new.scala index bbabe8e7d9..26d6945628 100644 --- a/test/files/run/t2236-new.scala +++ b/test/files/run/t2236-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + class T[A](implicit val m:TypeTag[A]) class Foo class Bar extends T[Foo] @@ -14,4 +16,4 @@ object EvidenceTest { implicit val e: E[T] = null new B[T]{} } -} +}
\ No newline at end of file diff --git a/test/files/run/t2886.scala b/test/files/run/t2886.scala index e0835a0a44..b919f13770 100644 --- a/test/files/run/t2886.scala +++ b/test/files/run/t2886.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test { def test(name: String, address: String) = null @@ -6,4 +6,4 @@ object Test { val tree = reify((x:String) => test(address=x,name=x)).tree println(tree) } -} +}
\ No newline at end of file diff --git a/test/files/run/t3507-new.check b/test/files/run/t3507-new.check index 6e4fa4170e..b02c40fc26 100644 --- a/test/files/run/t3507-new.check +++ b/test/files/run/t3507-new.check @@ -1 +1 @@ -ConcreteTypeTag[_1.b.c.type]
+_1.b.c.type
diff --git a/test/files/run/t3507-new.scala b/test/files/run/t3507-new.scala index c7a529e8b8..f045755b8f 100644 --- a/test/files/run/t3507-new.scala +++ b/test/files/run/t3507-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + class A { object b { object c @@ -9,7 +11,7 @@ object Test extends App { var a: A = new A // mutable val c /*: object _1.b.c forSome { val _1: A } */ = a.m // widening using existential - def mani[T: TypeTag](x: T) = println(typeTag[T]) + def mani[T: TypeTag](x: T) = println(typeOf[T]) mani/*[object _1.b.c]*/(c) // kaboom in manifestOfType / TreeGen.mkAttributedQualifier // --> _1 is not in scope here }
\ No newline at end of file diff --git a/test/files/run/t4110-new.check b/test/files/run/t4110-new.check index 28f220e1fe..5cbfb27f3e 100644 --- a/test/files/run/t4110-new.check +++ b/test/files/run/t4110-new.check @@ -1,2 +1,2 @@ -ConcreteTypeTag[Test.A with Test.B]
-ConcreteTypeTag[Test.A with Test.B]
+Test.A with Test.B
+Test.A with Test.B
diff --git a/test/files/run/t4110-new.scala b/test/files/run/t4110-new.scala index 3285b82c61..24ecd66cce 100644 --- a/test/files/run/t4110-new.scala +++ b/test/files/run/t4110-new.scala @@ -1,5 +1,7 @@ +import scala.reflect.runtime.universe._ + object Test extends App { - def inferredType[T : TypeTag](v : T) = println(typeTag[T]) + def inferredType[T : TypeTag](v : T) = println(typeOf[T]) trait A trait B diff --git a/test/files/run/t4216.check b/test/files/run/t4216.check index ac19a98315..0ba987f634 100644 --- a/test/files/run/t4216.check +++ b/test/files/run/t4216.check @@ -1,34 +1,37 @@ -Type in expressions to have them evaluated. -Type :help for more information. - -scala> def f[A: ArrayTag](a: A) = java.util.Arrays.asList(Array(a): _*) -f: [A](a: A)(implicit evidence$1: ArrayTag[A])java.util.List[A] - -scala> f(".") -res0: java.util.List[String] = [.] - -scala> f(0) -res1: java.util.List[Int] = [0] - -scala> def i(a: Int) = java.util.Arrays.asList(Array(a): _*) -i: (a: Int)java.util.List[Int] - -scala> i(0) -res2: java.util.List[Int] = [0] - -scala> def o(a: Any) = java.util.Arrays.asList(Array(a): _*) -o: (a: Any)java.util.List[Any] - -scala> o(".") -res3: java.util.List[Any] = [.] - -scala> class V(val a: Int) extends AnyVal -defined class V - -scala> f(new V(0)) -res4: java.util.List[V] = [V@0] - -scala> o(new V(0)) -res5: java.util.List[Any] = [V@0] - -scala> +Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala> import scala.reflect.ArrayTag
+import scala.reflect.ArrayTag
+
+scala> def f[A: ArrayTag](a: A) = java.util.Arrays.asList(Array(a): _*)
+f: [A](a: A)(implicit evidence$1: scala.reflect.ArrayTag[A])java.util.List[A]
+
+scala> f(".")
+res0: java.util.List[String] = [.]
+
+scala> f(0)
+res1: java.util.List[Int] = [0]
+
+scala> def i(a: Int) = java.util.Arrays.asList(Array(a): _*)
+i: (a: Int)java.util.List[Int]
+
+scala> i(0)
+res2: java.util.List[Int] = [0]
+
+scala> def o(a: Any) = java.util.Arrays.asList(Array(a): _*)
+o: (a: Any)java.util.List[Any]
+
+scala> o(".")
+res3: java.util.List[Any] = [.]
+
+scala> class V(val a: Int) extends AnyVal
+defined class V
+
+scala> f(new V(0))
+res4: java.util.List[V] = [V@0]
+
+scala> o(new V(0))
+res5: java.util.List[Any] = [V@0]
+
+scala>
diff --git a/test/files/run/t4216.scala b/test/files/run/t4216.scala index 4ada8f48aa..d9395cf538 100644 --- a/test/files/run/t4216.scala +++ b/test/files/run/t4216.scala @@ -4,6 +4,7 @@ import scala.tools.partest.ReplTest object Test extends ReplTest { def code = """ + |import scala.reflect.ArrayTag |def f[A: ArrayTag](a: A) = java.util.Arrays.asList(Array(a): _*) |f(".") |f(0) diff --git a/test/files/run/t5224.scala b/test/files/run/t5224.scala index cf65f16457..600a4200bd 100644 --- a/test/files/run/t5224.scala +++ b/test/files/run/t5224.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ class Foo(bar: String) extends annotation.ClassfileAnnotation diff --git a/test/files/run/t5225_1.scala b/test/files/run/t5225_1.scala index 5e1d3b1f17..917a239bdf 100644 --- a/test/files/run/t5225_1.scala +++ b/test/files/run/t5225_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { val tree = reify{@transient @volatile var x = 2}.tree diff --git a/test/files/run/t5225_2.scala b/test/files/run/t5225_2.scala index 4cab640fe8..d1b607499c 100644 --- a/test/files/run/t5225_2.scala +++ b/test/files/run/t5225_2.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { val tree = reify{def foo(@cloneable x: Int) = ""}.tree diff --git a/test/files/run/t5229_1.scala b/test/files/run/t5229_1.scala index 273079a89d..7e05b08348 100644 --- a/test/files/run/t5229_1.scala +++ b/test/files/run/t5229_1.scala @@ -1,7 +1,8 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { object C }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/t5229_2.scala b/test/files/run/t5229_2.scala index 85bf78ba31..75d7204911 100644 --- a/test/files/run/t5229_2.scala +++ b/test/files/run/t5229_2.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox object Test extends App { val code = reify { @@ -9,7 +12,7 @@ object Test extends App { println(C.x) }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +}
\ No newline at end of file diff --git a/test/files/run/t5230.scala b/test/files/run/t5230.scala index e0632f591c..5cd67766b4 100644 --- a/test/files/run/t5230.scala +++ b/test/files/run/t5230.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox object Test extends App { val code = reify { @@ -9,7 +12,7 @@ object Test extends App { println(new C().x) }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +}
\ No newline at end of file diff --git a/test/files/run/t5256a.check b/test/files/run/t5256a.check index 304f4ddd79..518663b3da 100644 --- a/test/files/run/t5256a.check +++ b/test/files/run/t5256a.check @@ -1,2 +1,6 @@ -A -true +class A
+A
+Object { + def <init>: <?> + def foo: <?> +}
diff --git a/test/files/run/t5256a.scala b/test/files/run/t5256a.scala index 05a935c770..e3d22f8a93 100644 --- a/test/files/run/t5256a.scala +++ b/test/files/run/t5256a.scala @@ -1,9 +1,11 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} -class A +class A { def foo = ??? } object Test extends App { - val c = classToType(classOf[A]) + val c = cm.reflectClass(classOf[A]).symbol println(c) - println(c.typeSymbol == classToSymbol(classOf[A])) -} + println(c.fullName) + println(c.typeSignature) +}
\ No newline at end of file diff --git a/test/files/run/t5256b.check b/test/files/run/t5256b.check index 64f4c01166..d6015f2743 100644 --- a/test/files/run/t5256b.check +++ b/test/files/run/t5256b.check @@ -1,2 +1,6 @@ +class A
Test.A
-true
\ No newline at end of file +Object { + def <init>: <?> + def foo: <?> +}
diff --git a/test/files/run/t5256b.scala b/test/files/run/t5256b.scala index 5575211641..fedec6323d 100644 --- a/test/files/run/t5256b.scala +++ b/test/files/run/t5256b.scala @@ -1,8 +1,10 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} object Test extends App { - class A - val c = classToType(classOf[A]) + class A { def foo = ??? } + val c = cm.reflectClass(classOf[A]).symbol println(c) - println(c.typeSymbol == classToSymbol(classOf[A])) -} + println(c.fullName) + println(c.typeSignature) +}
\ No newline at end of file diff --git a/test/files/run/t5256c.check b/test/files/run/t5256c.check new file mode 100644 index 0000000000..16bfc6c9d0 --- /dev/null +++ b/test/files/run/t5256c.check @@ -0,0 +1,6 @@ +class A$1
+Test.A$1
+java.lang.Object { + def foo(): Nothing + def <init>(): A$1 +}
diff --git a/test/files/run/t5256c.scala b/test/files/run/t5256c.scala new file mode 100644 index 0000000000..a8a3323443 --- /dev/null +++ b/test/files/run/t5256c.scala @@ -0,0 +1,12 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} + +object Test extends App { + { + class A { def foo = ??? } + val c = cm.reflectClass(classOf[A]).symbol + println(c) + println(c.fullName) + println(c.typeSignature) + } +}
\ No newline at end of file diff --git a/test/files/run/t5256d.check b/test/files/run/t5256d.check index 7924c15c5c..e466e1e2e8 100644 --- a/test/files/run/t5256d.check +++ b/test/files/run/t5256d.check @@ -3,17 +3,29 @@ Type :help for more information. scala>
-scala> import scala.reflect.mirror._
-import scala.reflect.mirror._
+scala> import scala.reflect.runtime.universe._
+import scala.reflect.runtime.universe._
-scala> class A
+scala> import scala.reflect.runtime.{currentMirror => cm}
+import scala.reflect.runtime.{currentMirror=>cm}
+
+scala> class A { def foo = ??? }
defined class A
-scala> val c = classToType(classOf[A])
-c: reflect.mirror.Type = A
+scala> val c = cm.reflectClass(classOf[A]).symbol
+c: reflect.runtime.universe.ClassSymbol = class A
+
+scala> println(c)
+class A
+
+scala> println(c.fullName)
+$line8.$read.$iw.$iw.$iw.$iw.A
-scala> println(c.typeSymbol == classToSymbol(classOf[A]))
-true
+scala> println(c.typeSignature)
+java.lang.Object {
+ def <init>: <?>
+ def foo: <?>
+}
scala>
diff --git a/test/files/run/t5256d.scala b/test/files/run/t5256d.scala index 86404a9b63..574013f444 100644 --- a/test/files/run/t5256d.scala +++ b/test/files/run/t5256d.scala @@ -2,9 +2,12 @@ import scala.tools.partest.ReplTest object Test extends ReplTest { def code = """ -import scala.reflect.mirror._ -class A -val c = classToType(classOf[A]) -println(c.typeSymbol == classToSymbol(classOf[A])) +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +class A { def foo = ??? } +val c = cm.reflectClass(classOf[A]).symbol +println(c) +println(c.fullName) +println(c.typeSignature) """ -} +}
\ No newline at end of file diff --git a/test/files/run/t5256e.check b/test/files/run/t5256e.check index e50f917e14..20ea35c74d 100644 --- a/test/files/run/t5256e.check +++ b/test/files/run/t5256e.check @@ -1,2 +1,6 @@ -C.this.A -true
\ No newline at end of file +class A
+Test.C.A
+Object { + def <init>: <?> + def foo: <?> +}
diff --git a/test/files/run/t5256e.scala b/test/files/run/t5256e.scala index 9ed422ca44..32031f919a 100644 --- a/test/files/run/t5256e.scala +++ b/test/files/run/t5256e.scala @@ -1,9 +1,10 @@ -import scala.reflect.mirror._ - -class C { class A } +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} object Test extends App { - val c = classToType(classOf[C#A]) + class C { class A { def foo = ??? } } + val c = cm.reflectClass(classOf[C#A]).symbol println(c) - println(c.typeSymbol == classToSymbol(classOf[C#A])) -} + println(c.fullName) + println(c.typeSignature) +}
\ No newline at end of file diff --git a/test/files/run/t5256f.check b/test/files/run/t5256f.check index ad2f375d9a..7a58aa003d 100644 --- a/test/files/run/t5256f.check +++ b/test/files/run/t5256f.check @@ -1,4 +1,12 @@ -Test.A1 -true -Test.this.A2 -true +class A1
+Test.A1
+Object { + def <init>: <?> + def foo: <?> +}
+class A2
+Test.A2
+Object { + def <init>: <?> + def foo: <?> +}
diff --git a/test/files/run/t5256f.scala b/test/files/run/t5256f.scala index 45c80cbd63..072f927abc 100644 --- a/test/files/run/t5256f.scala +++ b/test/files/run/t5256f.scala @@ -1,19 +1,22 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} object Test extends App { - class A1 + class A1 { def foo = ??? } - val c1 = classToType(classOf[A1]) + val c1 = cm.reflectClass(classOf[A1]).symbol println(c1) - println(c1.typeSymbol == classToSymbol(classOf[A1])) + println(c1.fullName) + println(c1.typeSignature) new Test } class Test { - class A2 + class A2 { def foo = ??? } - val c2 = classToType(classOf[A2]) + val c2 = cm.reflectClass(classOf[A2]).symbol println(c2) - println(c2.typeSymbol == classToSymbol(classOf[A2])) + println(c2.fullName) + println(c2.typeSignature) } diff --git a/test/files/run/t5256g.check b/test/files/run/t5256g.check new file mode 100644 index 0000000000..5aac899694 --- /dev/null +++ b/test/files/run/t5256g.check @@ -0,0 +1,3 @@ +anonymous class $anon$1
+Test.$anon$1
+A with B{def <init>(): A with B}
diff --git a/test/files/run/t5256g.scala b/test/files/run/t5256g.scala new file mode 100644 index 0000000000..a4d81a28dc --- /dev/null +++ b/test/files/run/t5256g.scala @@ -0,0 +1,13 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} + +class A +trait B + +object Test extends App { + val mutant = new A with B + val c = cm.reflectClass(mutant.getClass).symbol + println(c) + println(c.fullName) + println(c.typeSignature) +} diff --git a/test/files/run/t5256h.check b/test/files/run/t5256h.check new file mode 100644 index 0000000000..2a6b292486 --- /dev/null +++ b/test/files/run/t5256h.check @@ -0,0 +1,7 @@ +anonymous class $anon$1
+Test.$anon$1
+java.lang.Object { + final private val x: Int + def x(): Int + def <init>(): java.lang.Object{def x(): Int} +}
diff --git a/test/files/run/t5256h.scala b/test/files/run/t5256h.scala new file mode 100644 index 0000000000..723d606a1e --- /dev/null +++ b/test/files/run/t5256h.scala @@ -0,0 +1,10 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} + +object Test extends App { + val mutant = new { val x = 2 } + val c = cm.reflectClass(mutant.getClass).symbol + println(c) + println(c.fullName) + println(c.typeSignature) +} diff --git a/test/files/run/t5258a.scala b/test/files/run/t5258a.scala index 127829c724..1b98b5920a 100644 --- a/test/files/run/t5258a.scala +++ b/test/files/run/t5258a.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { diff --git a/test/files/run/t5266_1.scala b/test/files/run/t5266_1.scala index ebb432be71..ee7ea6d335 100644 --- a/test/files/run/t5266_1.scala +++ b/test/files/run/t5266_1.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox object Test extends App { val code = reify { @@ -6,7 +9,7 @@ object Test extends App { println(x) }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) }
\ No newline at end of file diff --git a/test/files/run/t5266_2.scala b/test/files/run/t5266_2.scala index 27c91c35a8..ca16f656ee 100644 --- a/test/files/run/t5266_2.scala +++ b/test/files/run/t5266_2.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox object Test extends App { val code = reify { @@ -7,7 +10,7 @@ object Test extends App { println(y) }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +}
\ No newline at end of file diff --git a/test/files/run/t5269.scala b/test/files/run/t5269.scala index 9026090b29..dfdabdd6cc 100644 --- a/test/files/run/t5269.scala +++ b/test/files/run/t5269.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -12,4 +13,4 @@ object Test extends App { new X().println() }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/t5270.scala b/test/files/run/t5270.scala index 476b610148..afd45a0875 100644 --- a/test/files/run/t5270.scala +++ b/test/files/run/t5270.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -16,4 +17,4 @@ object Test extends App { new X().println() }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/t5271_1.scala b/test/files/run/t5271_1.scala index 20cafa6a08..9e2c7602b5 100644 --- a/test/files/run/t5271_1.scala +++ b/test/files/run/t5271_1.scala @@ -1,11 +1,15 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { val code = reify { case class C(foo: Int, bar: Int) }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() println(code.tree) println(code.eval) -} +}
\ No newline at end of file diff --git a/test/files/run/t5271_2.scala b/test/files/run/t5271_2.scala index af6491407c..430738f4fb 100644 --- a/test/files/run/t5271_2.scala +++ b/test/files/run/t5271_2.scala @@ -1,4 +1,8 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { val code = reify { @@ -7,7 +11,7 @@ object Test extends App { println(c.foo * c.bar) }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() println(code.tree) println(code.eval) -} +}
\ No newline at end of file diff --git a/test/files/run/t5271_3.scala b/test/files/run/t5271_3.scala index 646b10a8e5..f2ca2d496d 100644 --- a/test/files/run/t5271_3.scala +++ b/test/files/run/t5271_3.scala @@ -1,4 +1,8 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { val code = reify { @@ -8,7 +12,7 @@ object Test extends App { println(c.foo * c.bar == C.qwe) }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() println(code.tree) println(code.eval) -} +}
\ No newline at end of file diff --git a/test/files/run/t5271_4.scala b/test/files/run/t5271_4.scala index e13a331d9c..f63e82bdbe 100644 --- a/test/files/run/t5271_4.scala +++ b/test/files/run/t5271_4.scala @@ -1,7 +1,8 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { case object C }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/t5272_1.check b/test/files/run/t5272_1_newpatmat.check index 9f8d6f24e7..9f8d6f24e7 100644 --- a/test/files/run/t5272_1.check +++ b/test/files/run/t5272_1_newpatmat.check diff --git a/test/files/run/t5272_1.scala b/test/files/run/t5272_1_newpatmat.scala index 46472babf3..e8bb013248 100644 --- a/test/files/run/t5272_1.scala +++ b/test/files/run/t5272_1_newpatmat.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -7,4 +8,4 @@ object Test extends App { case _ => println("not okay") } }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/t5272_1_oldpatmat.check b/test/files/run/t5272_1_oldpatmat.check new file mode 100644 index 0000000000..9f8d6f24e7 --- /dev/null +++ b/test/files/run/t5272_1_oldpatmat.check @@ -0,0 +1 @@ +okay
\ No newline at end of file diff --git a/test/files/run/t5272_1.flags b/test/files/run/t5272_1_oldpatmat.flags index e69de29bb2..e69de29bb2 100644 --- a/test/files/run/t5272_1.flags +++ b/test/files/run/t5272_1_oldpatmat.flags diff --git a/test/files/run/t5272_1_oldpatmat.scala b/test/files/run/t5272_1_oldpatmat.scala new file mode 100644 index 0000000000..e8bb013248 --- /dev/null +++ b/test/files/run/t5272_1_oldpatmat.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends App { + reify { + 2 match { + case 2 => println("okay") + case _ => println("not okay") + } + }.eval +}
\ No newline at end of file diff --git a/test/files/run/t5272_2.check b/test/files/run/t5272_2_newpatmat.check index 549f3f3af8..549f3f3af8 100644 --- a/test/files/run/t5272_2.check +++ b/test/files/run/t5272_2_newpatmat.check diff --git a/test/files/run/t5272_2.scala b/test/files/run/t5272_2_newpatmat.scala index f5bab44205..be79cde18f 100644 --- a/test/files/run/t5272_2.scala +++ b/test/files/run/t5272_2_newpatmat.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -6,4 +7,4 @@ object Test extends App { case x => println("okay" + x) } }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/t5272_2_oldpatmat.check b/test/files/run/t5272_2_oldpatmat.check new file mode 100644 index 0000000000..549f3f3af8 --- /dev/null +++ b/test/files/run/t5272_2_oldpatmat.check @@ -0,0 +1 @@ +okay2
\ No newline at end of file diff --git a/test/files/run/t5272_2.flags b/test/files/run/t5272_2_oldpatmat.flags index e69de29bb2..e69de29bb2 100644 --- a/test/files/run/t5272_2.flags +++ b/test/files/run/t5272_2_oldpatmat.flags diff --git a/test/files/run/t5272_2_oldpatmat.scala b/test/files/run/t5272_2_oldpatmat.scala new file mode 100644 index 0000000000..be79cde18f --- /dev/null +++ b/test/files/run/t5272_2_oldpatmat.scala @@ -0,0 +1,10 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends App { + reify { + 2 match { + case x => println("okay" + x) + } + }.eval +}
\ No newline at end of file diff --git a/test/files/run/t5273_1.check b/test/files/run/t5273_1_newpatmat.check index 0cfbf08886..0cfbf08886 100644 --- a/test/files/run/t5273_1.check +++ b/test/files/run/t5273_1_newpatmat.check diff --git a/test/files/run/t5273_1.scala b/test/files/run/t5273_1_newpatmat.scala index 1b491923b2..756f52e10b 100644 --- a/test/files/run/t5273_1.scala +++ b/test/files/run/t5273_1_newpatmat.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -7,4 +8,4 @@ object Test extends App { case _ => println("this is getting out of hand!") } }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/t5273_1_oldpatmat.check b/test/files/run/t5273_1_oldpatmat.check new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/files/run/t5273_1_oldpatmat.check @@ -0,0 +1 @@ +2 diff --git a/test/files/run/t5273_1.flags b/test/files/run/t5273_1_oldpatmat.flags index e69de29bb2..e69de29bb2 100644 --- a/test/files/run/t5273_1.flags +++ b/test/files/run/t5273_1_oldpatmat.flags diff --git a/test/files/run/t5273_1_oldpatmat.scala b/test/files/run/t5273_1_oldpatmat.scala new file mode 100644 index 0000000000..756f52e10b --- /dev/null +++ b/test/files/run/t5273_1_oldpatmat.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends App { + reify { + List(1, 2, 3) match { + case foo :: bar :: _ => println(foo * bar) + case _ => println("this is getting out of hand!") + } + }.eval +}
\ No newline at end of file diff --git a/test/files/run/t5273_2a_newpatmat.check b/test/files/run/t5273_2a_newpatmat.check new file mode 100644 index 0000000000..d8263ee986 --- /dev/null +++ b/test/files/run/t5273_2a_newpatmat.check @@ -0,0 +1 @@ +2
\ No newline at end of file diff --git a/test/files/run/t5273_2a.scala b/test/files/run/t5273_2a_newpatmat.scala index 062ff79d11..c0d15496aa 100644 --- a/test/files/run/t5273_2a.scala +++ b/test/files/run/t5273_2a_newpatmat.scala @@ -1,8 +1,9 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { val foo :: bar :: _ = List(1, 2, 3) println(foo * bar) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/t5273_2a_oldpatmat.check b/test/files/run/t5273_2a_oldpatmat.check new file mode 100644 index 0000000000..d8263ee986 --- /dev/null +++ b/test/files/run/t5273_2a_oldpatmat.check @@ -0,0 +1 @@ +2
\ No newline at end of file diff --git a/test/files/run/t5273_2a.flags b/test/files/run/t5273_2a_oldpatmat.flags index e69de29bb2..e69de29bb2 100644 --- a/test/files/run/t5273_2a.flags +++ b/test/files/run/t5273_2a_oldpatmat.flags diff --git a/test/files/run/t5273_2a_oldpatmat.scala b/test/files/run/t5273_2a_oldpatmat.scala new file mode 100644 index 0000000000..c0d15496aa --- /dev/null +++ b/test/files/run/t5273_2a_oldpatmat.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends App { + reify { + val foo :: bar :: _ = List(1, 2, 3) + println(foo * bar) + }.eval +}
\ No newline at end of file diff --git a/test/files/run/t5273_2b.check b/test/files/run/t5273_2b_newpatmat.check index c551774ca5..c551774ca5 100644 --- a/test/files/run/t5273_2b.check +++ b/test/files/run/t5273_2b_newpatmat.check diff --git a/test/files/run/t5273_2b.scala b/test/files/run/t5273_2b_newpatmat.scala index 82f1de89f7..31afd7e2ba 100644 --- a/test/files/run/t5273_2b.scala +++ b/test/files/run/t5273_2b_newpatmat.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -6,4 +7,4 @@ object Test extends App { val RegexParser(name, shortname, value) = "American Dollar 1USD | 2,8567 | sometext" println("name = %s, shortname = %s, value = %s".format(name, shortname, value)) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/t5273_2b_oldpatmat.check b/test/files/run/t5273_2b_oldpatmat.check new file mode 100644 index 0000000000..c551774ca5 --- /dev/null +++ b/test/files/run/t5273_2b_oldpatmat.check @@ -0,0 +1 @@ +name = American Dollar, shortname = USD, value = 2,8567 diff --git a/test/files/run/t5273_2b.flags b/test/files/run/t5273_2b_oldpatmat.flags index e69de29bb2..e69de29bb2 100644 --- a/test/files/run/t5273_2b.flags +++ b/test/files/run/t5273_2b_oldpatmat.flags diff --git a/test/files/run/t5273_2b_oldpatmat.scala b/test/files/run/t5273_2b_oldpatmat.scala new file mode 100644 index 0000000000..31afd7e2ba --- /dev/null +++ b/test/files/run/t5273_2b_oldpatmat.scala @@ -0,0 +1,10 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends App { + reify { + val RegexParser = """(.*) \d+([A-Z]+) \| (.*) \|.*""".r + val RegexParser(name, shortname, value) = "American Dollar 1USD | 2,8567 | sometext" + println("name = %s, shortname = %s, value = %s".format(name, shortname, value)) + }.eval +}
\ No newline at end of file diff --git a/test/files/run/t5274_1.scala b/test/files/run/t5274_1.scala index 7ef332aa05..c1b842fd7f 100644 --- a/test/files/run/t5274_1.scala +++ b/test/files/run/t5274_1.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -10,4 +11,4 @@ object Test extends App { println("49! = " + f49) println("50!/49! = " + (f50 / f49)) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/t5274_2.scala b/test/files/run/t5274_2.scala index 0b373b358f..17e3976c09 100644 --- a/test/files/run/t5274_2.scala +++ b/test/files/run/t5274_2.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -47,4 +48,4 @@ object Test extends App { sort(ar) println(ar) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/t5275.scala b/test/files/run/t5275.scala index 534672be3c..5c84df499f 100644 --- a/test/files/run/t5275.scala +++ b/test/files/run/t5275.scala @@ -1,8 +1,9 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { class C(val foo: Int) println(new C(2).foo) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/t5276_1a.scala b/test/files/run/t5276_1a.scala index a6e327c0e7..7f4b6ecb8d 100644 --- a/test/files/run/t5276_1a.scala +++ b/test/files/run/t5276_1a.scala @@ -1,8 +1,9 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { lazy val x = 2 println(x) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/t5276_1b.scala b/test/files/run/t5276_1b.scala index 1bc3e246c9..56e7dc1bf0 100644 --- a/test/files/run/t5276_1b.scala +++ b/test/files/run/t5276_1b.scala @@ -1,8 +1,9 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { implicit lazy val x = 2 println(implicitly[Int]) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/t5276_2a.scala b/test/files/run/t5276_2a.scala index cdd87ddc9e..af9272c693 100644 --- a/test/files/run/t5276_2a.scala +++ b/test/files/run/t5276_2a.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -8,4 +9,4 @@ object Test extends App { println(new C().x) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/t5276_2b.scala b/test/files/run/t5276_2b.scala index 2fac951731..b211901abe 100644 --- a/test/files/run/t5276_2b.scala +++ b/test/files/run/t5276_2b.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -9,4 +10,4 @@ object Test extends App { println(new C().y) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/t5277_1.scala b/test/files/run/t5277_1.scala index f95e9ab6ec..a2d546579d 100644 --- a/test/files/run/t5277_1.scala +++ b/test/files/run/t5277_1.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -11,4 +12,4 @@ object Test extends App { println("10! = " + (10!)) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/t5277_2.scala b/test/files/run/t5277_2.scala index 5f1737f503..dd72452a7c 100644 --- a/test/files/run/t5277_2.scala +++ b/test/files/run/t5277_2.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -8,4 +9,4 @@ object Test extends App { println(p) println(p(1)) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/t5279.scala b/test/files/run/t5279.scala index aab5588877..815c883732 100644 --- a/test/files/run/t5279.scala +++ b/test/files/run/t5279.scala @@ -1,7 +1,8 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { println(new Integer(10)) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/t5334_1.scala b/test/files/run/t5334_1.scala index 49dbea6b68..2b6418990a 100644 --- a/test/files/run/t5334_1.scala +++ b/test/files/run/t5334_1.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox object Test extends App { val code = reify { @@ -7,6 +10,6 @@ object Test extends App { ret.asInstanceOf[Object] }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() println(toolbox.runExpr(code.tree)) -} +}
\ No newline at end of file diff --git a/test/files/run/t5334_2.scala b/test/files/run/t5334_2.scala index c6a77158dd..815f78f951 100644 --- a/test/files/run/t5334_2.scala +++ b/test/files/run/t5334_2.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox object Test extends App { val code = reify { @@ -7,6 +10,6 @@ object Test extends App { ret.asInstanceOf[List[Any]] }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() println(toolbox.runExpr(code.tree)) -} +}
\ No newline at end of file diff --git a/test/files/run/t5335.scala b/test/files/run/t5335.scala index a0fe6c5822..714846de21 100644 --- a/test/files/run/t5335.scala +++ b/test/files/run/t5335.scala @@ -1,7 +1,8 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { println(new {def x = 2}.x) }.eval -} +}
\ No newline at end of file diff --git a/test/files/run/t5415.scala b/test/files/run/t5415.scala index c6552f69b3..c12e209bb7 100644 --- a/test/files/run/t5415.scala +++ b/test/files/run/t5415.scala @@ -2,9 +2,11 @@ object Test extends App{ case class Queryable2[T]() { def filter(predicate: T => Boolean) = ??? } trait CoffeesTable{ def sales : Int } val q = Queryable2[CoffeesTable]() - import scala.reflect.mirror._ + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{universe => ru} val code = reify{q.filter(_.sales > 5)} - - val toolbox = mkToolBox() + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox + val toolbox = cm.mkToolBox() val ttree = toolbox.typeCheck(code.tree) } diff --git a/test/files/run/t5419.scala b/test/files/run/t5419.scala index 5f11f5056c..686a79bafd 100644 --- a/test/files/run/t5419.scala +++ b/test/files/run/t5419.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ class Foo extends annotation.StaticAnnotation diff --git a/test/files/run/t5423.scala b/test/files/run/t5423.scala index ed1faf0429..9c73ed0bef 100644 --- a/test/files/run/t5423.scala +++ b/test/files/run/t5423.scala @@ -1,9 +1,11 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} final class table extends annotation.StaticAnnotation @table class A object Test extends App { - val s = classToSymbol(classOf[A]) - println(s.annotations) -} + val s = cm.reflectClass(classOf[A]).symbol + println(s.getAnnotations) +}
\ No newline at end of file diff --git a/test/files/run/t5704.check b/test/files/run/t5704.check index 7b56bf2bfd..74c4610988 100644 --- a/test/files/run/t5704.check +++ b/test/files/run/t5704.check @@ -1 +1 @@ -String
\ No newline at end of file +java.lang.String
diff --git a/test/files/run/t5704.scala b/test/files/run/t5704.scala index 8fd721d4e7..ddcbcc27b3 100644 --- a/test/files/run/t5704.scala +++ b/test/files/run/t5704.scala @@ -1,10 +1,13 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox object Test extends App { class MyQuerycollection{ def findUserByName( name:String ) = { val tree = reify{ "test" == name }.tree - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() toolbox.typeCheck(tree) match{ case Apply(Select(lhs,op),rhs::Nil) => println(rhs.tpe) @@ -13,4 +16,4 @@ object Test extends App { } val qc = new MyQuerycollection qc.findUserByName("some value") -} +}
\ No newline at end of file diff --git a/test/files/run/t5713/Impls_Macros_1.scala b/test/files/run/t5713/Impls_Macros_1.scala index b499bc7e4e..d16299a0c8 100644 --- a/test/files/run/t5713/Impls_Macros_1.scala +++ b/test/files/run/t5713/Impls_Macros_1.scala @@ -19,9 +19,10 @@ private object LoggerMacros { log(c)(c.reify(Level.Error), message) private def log(c: LoggerContext)(level: c.Expr[Level.Value], message: c.Expr[String]): c.Expr[Unit] = - if (level.eval.id < 4) // TODO Remove hack! +// was: if (level.splice.id < 4) // TODO Remove hack! + if (c.eval(level).id < 4) // TODO Remove hack! c.reify(()) else { - c.reify(println(message.eval)) + c.reify(println(message.splice)) } }
\ No newline at end of file diff --git a/test/files/run/toolbox_console_reporter.scala b/test/files/run/toolbox_console_reporter.scala index 1da9a6bc16..c5b788550e 100644 --- a/test/files/run/toolbox_console_reporter.scala +++ b/test/files/run/toolbox_console_reporter.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { // todo. cannot test this unfortunately, because ConsoleFrontEnd grabs Console.out too early @@ -13,4 +13,4 @@ object Test extends App { // // Utils.foo //}) -} +}
\ No newline at end of file diff --git a/test/files/run/toolbox_default_reporter_is_silent.scala b/test/files/run/toolbox_default_reporter_is_silent.scala index 6908c001a3..5f3269b6fa 100644 --- a/test/files/run/toolbox_default_reporter_is_silent.scala +++ b/test/files/run/toolbox_default_reporter_is_silent.scala @@ -1,7 +1,10 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox object Test extends App { - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() toolbox.runExpr(reify{ object Utils { @deprecated("test", "2.10.0") @@ -10,4 +13,4 @@ object Test extends App { Utils.foo }.tree) -} +}
\ No newline at end of file diff --git a/test/files/run/toolbox_silent_reporter.scala b/test/files/run/toolbox_silent_reporter.scala index 6f5687ba4f..915734e6ad 100644 --- a/test/files/run/toolbox_silent_reporter.scala +++ b/test/files/run/toolbox_silent_reporter.scala @@ -1,7 +1,10 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox object Test extends App { - val toolbox = mkToolBox(options = "-deprecation") + val toolbox = cm.mkToolBox(options = "-deprecation") toolbox.runExpr(reify{ object Utils { @deprecated("test", "2.10.0") diff --git a/test/files/run/toolbox_typecheck_implicitsdisabled.check b/test/files/run/toolbox_typecheck_implicitsdisabled.check index 4bc64530ab..e2f2dbe4b9 100644 --- a/test/files/run/toolbox_typecheck_implicitsdisabled.check +++ b/test/files/run/toolbox_typecheck_implicitsdisabled.check @@ -2,4 +2,4 @@ import scala.Predef._;
scala.Predef.any2ArrowAssoc[Int](1).->[Int](2)
}
-scala.reflect.runtime.ToolBoxes$ToolBox$ToolBoxError: reflective typecheck has failed: value -> is not a member of Int
+scala.tools.reflect.ToolBoxError: reflective typecheck has failed: value -> is not a member of Int
diff --git a/test/files/run/toolbox_typecheck_implicitsdisabled.scala b/test/files/run/toolbox_typecheck_implicitsdisabled.scala index 9d52e91f73..f11f0192f3 100644 --- a/test/files/run/toolbox_typecheck_implicitsdisabled.scala +++ b/test/files/run/toolbox_typecheck_implicitsdisabled.scala @@ -1,7 +1,10 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox object Test extends App { - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val tree1 = Block( Import(Select(Ident(newTermName("scala")), newTermName("Predef")), List(ImportSelector(nme.WILDCARD, -1, null, -1))), diff --git a/test/files/run/toolbox_typecheck_macrosdisabled.check b/test/files/run/toolbox_typecheck_macrosdisabled.check index c4af175812..f4a67e3054 100644 --- a/test/files/run/toolbox_typecheck_macrosdisabled.check +++ b/test/files/run/toolbox_typecheck_macrosdisabled.check @@ -1,5 +1,37 @@ {
- val $mr: mr.type = mr;
- $mr.Expr.apply[Int(2)]($mr.Literal.apply($mr.Constant.apply(2)))($mr.ConcreteTypeTag.apply[Int(2)]($mr.ConstantType.apply($mr.Constant.apply(2)), classOf[scala.Int]))
+ val $u: ru.type = ru;
+ val $m: $u.Mirror = ru.rootMirror;
+ $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: scala.reflect.api.Universe = $m$untyped.universe.asInstanceOf[scala.reflect.api.Universe];
+ val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
+ $treecreator1.this.applyImpl[$u.type]($m).asInstanceOf[U#Tree]
+ };
+ private def applyImpl[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): scala.reflect.base.Universe#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()
+ }))
}
-mr.reify[Int](2)
+ru.reify[Int](2)
diff --git a/test/files/run/toolbox_typecheck_macrosdisabled.scala b/test/files/run/toolbox_typecheck_macrosdisabled.scala index afbbce1736..bcbd637e02 100644 --- a/test/files/run/toolbox_typecheck_macrosdisabled.scala +++ b/test/files/run/toolbox_typecheck_macrosdisabled.scala @@ -1,17 +1,20 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox object Test extends App { - val toolbox = mkToolBox() - val mrPkg = staticModule("scala.reflect.package") - val mrSym = selectTerm(mrPkg, "mirror") - val NullaryMethodType(mrTpe) = mrSym.typeSignature - val mr = newFreeTerm("mr", mrTpe, scala.reflect.mirror) + val toolbox = cm.mkToolBox() + 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 tree1 = Apply(Select(Ident(mr), newTermName("reify")), List(Literal(Constant(2)))) + val tree1 = Apply(Select(Ident(ru), newTermName("reify")), List(Literal(Constant(2)))) val ttree1 = toolbox.typeCheck(tree1, withMacrosDisabled = false) println(ttree1) - val tree2 = Apply(Select(Ident(mr), newTermName("reify")), List(Literal(Constant(2)))) + val tree2 = Apply(Select(Ident(ru), newTermName("reify")), List(Literal(Constant(2)))) val ttree2 = toolbox.typeCheck(tree2, withMacrosDisabled = true) println(ttree2) -} +}
\ No newline at end of file diff --git a/test/files/run/toolbox_typecheck_macrosdisabled2.check b/test/files/run/toolbox_typecheck_macrosdisabled2.check index 271139b031..2e1e2696ab 100644 --- a/test/files/run/toolbox_typecheck_macrosdisabled2.check +++ b/test/files/run/toolbox_typecheck_macrosdisabled2.check @@ -1,5 +1,37 @@ {
- val $mr: mr.type = mr;
- $mr.Expr.apply[Array[Int]]($mr.Apply.apply($mr.Select.apply($mr.Select.apply($mr.Ident($mr.staticModule("scala")), $mr.newTermName("Array")), $mr.newTermName("apply")), scala.collection.immutable.List.apply[$mr.Literal]($mr.Literal.apply($mr.Constant.apply(2)))))($mr.ConcreteTypeTag.apply[Array[Int]]($mr.TypeRef.apply($mr.thisModuleType("scala"), $mr.staticClass("scala.Array"), scala.collection.immutable.List.apply[$mr.Type]($mr.staticClass("scala.Int").asTypeConstructor)), ScalaRunTime.this.arrayClass(classOf[scala.Int])))
+ val $u: ru.type = ru;
+ val $m: $u.Mirror = ru.rootMirror;
+ $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: scala.reflect.api.Universe = $m$untyped.universe.asInstanceOf[scala.reflect.api.Universe];
+ val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
+ $treecreator1.this.applyImpl[$u.type]($m).asInstanceOf[U#Tree]
+ };
+ private def applyImpl[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): scala.reflect.base.Universe#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.staticModule("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.staticModule("scala").asModuleSymbol.moduleClass), $m.staticClass("scala.Array"), scala.collection.immutable.List.apply[$u.Type]($m.staticClass("scala.Int").asTypeSymbol.asTypeConstructor))
+ }
+ };
+ new $typecreator2()
+ }))
}
-mr.reify[Array[Int]](scala.Array.apply(2))
+ru.reify[Array[Int]](scala.Array.apply(2))
diff --git a/test/files/run/toolbox_typecheck_macrosdisabled2.scala b/test/files/run/toolbox_typecheck_macrosdisabled2.scala index b4c76d0600..51493ffc1c 100644 --- a/test/files/run/toolbox_typecheck_macrosdisabled2.scala +++ b/test/files/run/toolbox_typecheck_macrosdisabled2.scala @@ -1,17 +1,20 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox object Test extends App { - val toolbox = mkToolBox() - val mrPkg = staticModule("scala.reflect.package") - val mrSym = selectTerm(mrPkg, "mirror") - val NullaryMethodType(mrTpe) = mrSym.typeSignature - val mr = newFreeTerm("mr", mrTpe, scala.reflect.mirror) + val toolbox = cm.mkToolBox() + 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 tree1 = Apply(Select(Ident(mr), newTermName("reify")), List(Apply(Select(Ident(newTermName("scala")), newTermName("Array")), List(Literal(Constant(2)))))) + 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) println(ttree1) - val tree2 = Apply(Select(Ident(mr), newTermName("reify")), List(Apply(Select(Ident(newTermName("scala")), newTermName("Array")), List(Literal(Constant(2)))))) + val tree2 = Apply(Select(Ident(ru), newTermName("reify")), List(Apply(Select(Ident(newTermName("scala")), newTermName("Array")), List(Literal(Constant(2)))))) val ttree2 = toolbox.typeCheck(tree2, withMacrosDisabled = true) println(ttree2) } diff --git a/test/files/run/typetags_core.check b/test/files/run/typetags_core.check index f124aa6a35..e5308bf9c7 100644 --- a/test/files/run/typetags_core.check +++ b/test/files/run/typetags_core.check @@ -1,32 +1,28 @@ -true -ConcreteTypeTag[Byte] -true -ConcreteTypeTag[Short] -true -ConcreteTypeTag[Char] -true -ConcreteTypeTag[Int] -true -ConcreteTypeTag[Long] -true -ConcreteTypeTag[Float] -true -ConcreteTypeTag[Double] -true -ConcreteTypeTag[Boolean] -true -ConcreteTypeTag[Unit] -true -ConcreteTypeTag[Any] -true -ConcreteTypeTag[Object] -true -ConcreteTypeTag[AnyVal] -true -ConcreteTypeTag[AnyRef] -true -ConcreteTypeTag[Null] -true -ConcreteTypeTag[Nothing] -true -ConcreteTypeTag[String] +true
+ConcreteTypeTag[Byte]
+true
+ConcreteTypeTag[Short]
+true
+ConcreteTypeTag[Char]
+true
+ConcreteTypeTag[Int]
+true
+ConcreteTypeTag[Long]
+true
+ConcreteTypeTag[Float]
+true
+ConcreteTypeTag[Double]
+true
+ConcreteTypeTag[Boolean]
+true
+ConcreteTypeTag[Unit]
+true
+ConcreteTypeTag[Any]
+true
+ConcreteTypeTag[java.lang.Object]
+true
+ConcreteTypeTag[Null]
+true
+ConcreteTypeTag[Nothing]
+true
+ConcreteTypeTag[java.lang.String]
diff --git a/test/files/run/typetags_core.scala b/test/files/run/typetags_core.scala index 7d6be16379..a870f77c5f 100644 --- a/test/files/run/typetags_core.scala +++ b/test/files/run/typetags_core.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + object Test extends App { println(implicitly[TypeTag[Byte]] eq TypeTag.Byte) println(implicitly[TypeTag[Byte]]) @@ -21,10 +23,6 @@ object Test extends App { println(implicitly[TypeTag[Any]]) println(implicitly[TypeTag[Object]] eq TypeTag.Object) println(implicitly[TypeTag[Object]]) - println(implicitly[TypeTag[AnyVal]] eq TypeTag.AnyVal) - println(implicitly[TypeTag[AnyVal]]) - println(implicitly[TypeTag[AnyRef]] eq TypeTag.AnyRef) - println(implicitly[TypeTag[AnyRef]]) println(implicitly[TypeTag[Null]] eq TypeTag.Null) println(implicitly[TypeTag[Null]]) println(implicitly[TypeTag[Nothing]] eq TypeTag.Nothing) diff --git a/test/files/run/typetags_multi.check b/test/files/run/typetags_multi.check index 613106985c..f3ac592f5a 100644 --- a/test/files/run/typetags_multi.check +++ b/test/files/run/typetags_multi.check @@ -1,5 +1,5 @@ -ConcreteTypeTag[Int]
-ConcreteTypeTag[Array[Int]]
-ConcreteTypeTag[Array[Array[Int]]]
-ConcreteTypeTag[Array[Array[Array[Int]]]]
-ConcreteTypeTag[Array[Array[Array[Array[Int]]]]]
+Int
+Array[Int]
+Array[Array[Int]]
+Array[Array[Array[Int]]]
+Array[Array[Array[Array[Int]]]]
diff --git a/test/files/run/typetags_multi.scala b/test/files/run/typetags_multi.scala index 868edc2b2a..a989662160 100644 --- a/test/files/run/typetags_multi.scala +++ b/test/files/run/typetags_multi.scala @@ -1,7 +1,9 @@ +import scala.reflect.runtime.universe._ + object Test extends App { - println(typeTag[Int]) - println(typeTag[Array[Int]]) - println(typeTag[Array[Array[Int]]]) - println(typeTag[Array[Array[Array[Int]]]]) - println(typeTag[Array[Array[Array[Array[Int]]]]]) + println(typeOf[Int]) + println(typeOf[Array[Int]]) + println(typeOf[Array[Array[Int]]]) + println(typeOf[Array[Array[Array[Int]]]]) + println(typeOf[Array[Array[Array[Array[Int]]]]]) }
\ No newline at end of file |