diff options
Diffstat (limited to 'test/files')
601 files changed, 3366 insertions, 2229 deletions
diff --git a/test/files/codelib/code.jar.desired.sha1 b/test/files/codelib/code.jar.desired.sha1 index 21c4dccb30..d2b8d9add9 100644 --- a/test/files/codelib/code.jar.desired.sha1 +++ b/test/files/codelib/code.jar.desired.sha1 @@ -1 +1 @@ -3ddb9fded6e19ca591a78b8a294284c9e945da30 ?code.jar +e737b123d31eede5594ceda07caafed1673ec472 ?code.jar diff --git a/test/files/jvm/manifests-new.check b/test/files/jvm/manifests-new.check index 896a5c1cef..9ff49ef8b4 100644 --- a/test/files/jvm/manifests-new.check +++ b/test/files/jvm/manifests-new.check @@ -1,38 +1,38 @@ -x=(), t=ConcreteTypeTag[Unit], k=TypeRef, s=class Unit -x=true, t=ConcreteTypeTag[Boolean], k=TypeRef, s=class Boolean -x=a, t=ConcreteTypeTag[Char], k=TypeRef, s=class Char -x=1, t=ConcreteTypeTag[Int], k=TypeRef, s=class Int -x=abc, t=ConcreteTypeTag[String], k=TypeRef, s=class String -x='abc, t=ConcreteTypeTag[Symbol], k=TypeRef, s=class Symbol - -x=List(()), t=ConcreteTypeTag[List[Unit]], k=TypeRef, s=class List -x=List(true), t=ConcreteTypeTag[List[Boolean]], k=TypeRef, s=class List -x=List(1), t=ConcreteTypeTag[List[Int]], k=TypeRef, s=class List -x=List(abc), t=ConcreteTypeTag[List[String]], k=TypeRef, s=class List -x=List('abc), t=ConcreteTypeTag[List[Symbol]], k=TypeRef, s=class List - -x=[Z, t=ConcreteTypeTag[Array[Boolean]], k=TypeRef, s=class Array -x=[C, t=ConcreteTypeTag[Array[Char]], k=TypeRef, s=class Array -x=[I, t=ConcreteTypeTag[Array[Int]], k=TypeRef, s=class Array -x=[Ljava.lang.String;, t=ConcreteTypeTag[Array[String]], k=TypeRef, s=class Array -x=[Lscala.Symbol;, t=ConcreteTypeTag[Array[Symbol]], k=TypeRef, s=class Array - -x=((),()), t=ConcreteTypeTag[(Unit, Unit)], k=TypeRef, s=class Tuple2 -x=(true,false), t=ConcreteTypeTag[(Boolean, Boolean)], k=TypeRef, s=class Tuple2 -x=(1,2), t=ConcreteTypeTag[(Int, Int)], k=TypeRef, s=class Tuple2 -x=(abc,xyz), t=ConcreteTypeTag[(String, String)], k=TypeRef, s=class Tuple2 -x=('abc,'xyz), t=ConcreteTypeTag[(Symbol, Symbol)], k=TypeRef, s=class Tuple2 - -x=Test$, t=ConcreteTypeTag[Test.type], k=SingleType, s=object Test -x=scala.collection.immutable.List$, t=ConcreteTypeTag[scala.collection.immutable.List.type], k=SingleType, s=object List - -x=Foo, t=ConcreteTypeTag[Foo[Int]], k=TypeRef, s=class Foo -x=Foo, t=ConcreteTypeTag[Foo[List[Int]]], k=TypeRef, s=class Foo -x=Foo, t=ConcreteTypeTag[Foo[Foo[Int]]], k=TypeRef, s=class Foo -x=Foo, t=ConcreteTypeTag[Foo[List[Foo[Int]]]], k=TypeRef, s=class Foo - -x=Test1$$anon$1, t=ConcreteTypeTag[Bar[String]], k=RefinedType, s=<local Test1> -x=Test1$$anon$2, t=ConcreteTypeTag[Bar[String]], k=RefinedType, s=<local Test1> +x=(), t=TypeTag[Unit], k=TypeRef, s=class Unit +x=true, t=TypeTag[Boolean], k=TypeRef, s=class Boolean +x=a, t=TypeTag[Char], k=TypeRef, s=class Char +x=1, t=TypeTag[Int], k=TypeRef, s=class Int +x=abc, t=TypeTag[java.lang.String], k=TypeRef, s=class String +x='abc, t=TypeTag[Symbol], k=TypeRef, s=class Symbol + +x=List(()), t=TypeTag[List[Unit]], k=TypeRef, s=class List +x=List(true), t=TypeTag[List[Boolean]], k=TypeRef, s=class List +x=List(1), t=TypeTag[List[Int]], k=TypeRef, s=class List +x=List(abc), t=TypeTag[List[java.lang.String]], k=TypeRef, s=class List +x=List('abc), t=TypeTag[List[Symbol]], k=TypeRef, s=class List + +x=[Z, t=TypeTag[Array[Boolean]], k=TypeRef, s=class Array +x=[C, t=TypeTag[Array[Char]], k=TypeRef, s=class Array +x=[I, t=TypeTag[Array[Int]], k=TypeRef, s=class Array +x=[Ljava.lang.String;, t=TypeTag[Array[java.lang.String]], k=TypeRef, s=class Array +x=[Lscala.Symbol;, t=TypeTag[Array[Symbol]], k=TypeRef, s=class Array + +x=((),()), t=TypeTag[(Unit, Unit)], k=TypeRef, s=class Tuple2 +x=(true,false), t=TypeTag[(Boolean, Boolean)], k=TypeRef, s=class Tuple2 +x=(1,2), t=TypeTag[(Int, Int)], k=TypeRef, s=class Tuple2 +x=(abc,xyz), t=TypeTag[(java.lang.String, java.lang.String)], k=TypeRef, s=class Tuple2 +x=('abc,'xyz), t=TypeTag[(Symbol, Symbol)], k=TypeRef, s=class Tuple2 + +x=Test$, t=TypeTag[Test.type], k=SingleType, s=object Test +x=scala.collection.immutable.List$, t=TypeTag[scala.collection.immutable.List.type], k=SingleType, s=object List + +x=Foo, t=TypeTag[Foo[Int]], k=TypeRef, s=class Foo +x=Foo, t=TypeTag[Foo[List[Int]]], k=TypeRef, s=class Foo +x=Foo, t=TypeTag[Foo[Foo[Int]]], k=TypeRef, s=class Foo +x=Foo, t=TypeTag[Foo[List[Foo[Int]]]], k=TypeRef, s=class Foo + +x=Test1$$anon$1, t=TypeTag[Bar[java.lang.String]], k=RefinedType, s=<local Test1> +x=Test1$$anon$2, t=TypeTag[Bar[java.lang.String]], k=RefinedType, s=<local Test1> ()=() true=true diff --git a/test/files/jvm/manifests-new.scala b/test/files/jvm/manifests-new.scala index d02f6ee608..8706881640 100644 --- a/test/files/jvm/manifests-new.scala +++ b/test/files/jvm/manifests-new.scala @@ -1,3 +1,6 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.{ClassTag, classTag} + object Test extends App { Test1 Test2 @@ -58,12 +61,12 @@ object Test2 { println("true="+load[Boolean](dump(true))) println("a="+load[Char](dump('a'))) println("1="+load[Int](dump(1))) - println("'abc="+load[Symbol](dump('abc))) + println("'abc="+load[scala.Symbol](dump('abc))) println() println("List(())="+load[List[Unit]](dump(List(())))) println("List(true)="+load[List[Boolean]](dump(List(true)))) - println("List('abc)="+load[List[Symbol]](dump(List('abc)))) + println("List('abc)="+load[List[scala.Symbol]](dump(List('abc)))) println() def loadArray[T](x: Array[Byte])(implicit t: reflect.ClassTag[Array[T]]) = @@ -98,12 +101,11 @@ trait TestUtil { val in = new ObjectInputStream(new ByteArrayInputStream(buffer)) in.readObject().asInstanceOf[A] } - import scala.reflect._ - def print[T](x: T)(implicit t: ConcreteTypeTag[T]) { + def print[T](x: T)(implicit t: TypeTag[T]) { // todo. type tags are not yet serializable -// val t1: ConcreteTypeTag[T] = read(write(t)) - val t1: ConcreteTypeTag[T] = t +// val t1: TypeTag[T] = read(write(t)) + val t1: TypeTag[T] = t val x1 = x.toString.replaceAll("@[0-9a-z]+$", "") - println("x="+x1+", t="+t1+", k="+t1.tpe.kind+", s="+t1.sym.toString) + println("x="+x1+", t="+t1+", k="+t1.tpe.kind+", s="+t1.tpe.typeSymbol.toString) } -} +}
\ No newline at end of file diff --git a/test/files/jvm/serialization-new.scala b/test/files/jvm/serialization-new.scala index bb971fdf36..91eb52928f 100644 --- a/test/files/jvm/serialization-new.scala +++ b/test/files/jvm/serialization-new.scala @@ -282,7 +282,7 @@ object Test2_immutable { // Test classes in package "scala.collection.mutable" object Test3_mutable { - import scala.reflect.ArrayTag + import scala.reflect.ClassTag import scala.collection.mutable.{ ArrayBuffer, ArrayBuilder, ArraySeq, ArrayStack, BitSet, DoubleLinkedList, HashMap, HashSet, History, LinkedList, ListBuffer, Publisher, Queue, @@ -299,11 +299,11 @@ object Test3_mutable { // ArrayBuilder val abu1 = ArrayBuilder.make[Long] - val _abu1: ArrayBuilder[ArrayTag[Long]] = read(write(abu1)) + val _abu1: ArrayBuilder[ClassTag[Long]] = read(write(abu1)) check(abu1, _abu1) val abu2 = ArrayBuilder.make[Float] - val _abu2: ArrayBuilder[ArrayTag[Float]] = read(write(abu2)) + val _abu2: ArrayBuilder[ClassTag[Float]] = read(write(abu2)) check(abu2, _abu2) // ArraySeq @@ -648,4 +648,4 @@ object Test9_parallel { println("Error in Test5_parallel: " + e) throw e } -} +}
\ No newline at end of file diff --git a/test/files/neg/classtags_contextbound_a.check b/test/files/neg/classtags_contextbound_a.check index a4fd37506d..f4b6ff5af1 100644 --- a/test/files/neg/classtags_contextbound_a.check +++ b/test/files/neg/classtags_contextbound_a.check @@ -1,4 +1,4 @@ -classtags_contextbound_a.scala:2: error: No ArrayTag available for T
+classtags_contextbound_a.scala:2: error: No ClassTag available for T
def foo[T] = Array[T]()
^
one error found
diff --git a/test/files/neg/classtags_contextbound_b.check b/test/files/neg/classtags_contextbound_b.check index f1f48bed72..e08ab504bc 100644 --- a/test/files/neg/classtags_contextbound_b.check +++ b/test/files/neg/classtags_contextbound_b.check @@ -1,4 +1,4 @@ -classtags_contextbound_b.scala:3: error: No ClassTag available for T
+classtags_contextbound_b.scala:5: error: No ClassTag available for T
def foo[T] = mkArray[T]
^
one error found
diff --git a/test/files/neg/classtags_contextbound_b.scala b/test/files/neg/classtags_contextbound_b.scala index 3247a8ff29..a189f9aa65 100644 --- a/test/files/neg/classtags_contextbound_b.scala +++ b/test/files/neg/classtags_contextbound_b.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ClassTag, classTag} + object Test extends App { def mkArray[T: ClassTag] = Array[T]() def foo[T] = mkArray[T] diff --git a/test/files/neg/classtags_contextbound_c.check b/test/files/neg/classtags_contextbound_c.check index a1c5eddfe1..f8768eea2b 100644 --- a/test/files/neg/classtags_contextbound_c.check +++ b/test/files/neg/classtags_contextbound_c.check @@ -1,4 +1,4 @@ -classtags_contextbound_c.scala:2: error: No ArrayTag available for T
+classtags_contextbound_c.scala:4: error: No ClassTag available for T
def mkArray[T] = Array[T]()
^
one error found
diff --git a/test/files/neg/classtags_contextbound_c.scala b/test/files/neg/classtags_contextbound_c.scala index 0b63f8407e..54c616ce7e 100644 --- a/test/files/neg/classtags_contextbound_c.scala +++ b/test/files/neg/classtags_contextbound_c.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ClassTag, classTag} + object Test extends App { def mkArray[T] = Array[T]() def foo[T: ClassTag] = mkArray[T] diff --git a/test/files/neg/classtags_dont_use_typetags.check b/test/files/neg/classtags_dont_use_typetags.check index c7d2fba35b..24585e7c3f 100644 --- a/test/files/neg/classtags_dont_use_typetags.check +++ b/test/files/neg/classtags_dont_use_typetags.check @@ -1,4 +1,4 @@ -classtags_dont_use_typetags.scala:2: error: No ArrayTag available for T
+classtags_dont_use_typetags.scala:4: error: No ClassTag available for T
def foo[T: TypeTag] = Array[T]()
^
one error found
diff --git a/test/files/neg/classtags_dont_use_typetags.scala b/test/files/neg/classtags_dont_use_typetags.scala index 0f675f71aa..2eb842b860 100644 --- a/test/files/neg/classtags_dont_use_typetags.scala +++ b/test/files/neg/classtags_dont_use_typetags.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + object Test extends App { def foo[T: TypeTag] = Array[T]() }
\ No newline at end of file diff --git a/test/files/neg/interop_erasuretags_arenot_classmanifests.check b/test/files/neg/interop_abstypetags_arenot_classmanifests.check index 4bb81108d1..3134aadb58 100644 --- a/test/files/neg/interop_erasuretags_arenot_classmanifests.check +++ b/test/files/neg/interop_abstypetags_arenot_classmanifests.check @@ -1,4 +1,4 @@ -interop_erasuretags_arenot_classmanifests.scala:3: error: could not find implicit value for parameter m: ClassManifest[T]
+interop_abstypetags_arenot_classmanifests.scala:5: error: could not find implicit value for parameter m: ClassManifest[T]
println(classManifest[T])
^
one error found
diff --git a/test/files/neg/interop_abstypetags_arenot_classmanifests.scala b/test/files/neg/interop_abstypetags_arenot_classmanifests.scala new file mode 100644 index 0000000000..c8567be5d4 --- /dev/null +++ b/test/files/neg/interop_abstypetags_arenot_classmanifests.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + def absTypeTagIsnotClassManifest[T: AbsTypeTag] = { + println(classManifest[T]) + } + + absTypeTagIsnotClassManifest[Int] + absTypeTagIsnotClassManifest[String] + absTypeTagIsnotClassManifest[Array[Int]] +}
\ No newline at end of file diff --git a/test/files/neg/interop_abstypetags_arenot_classtags.check b/test/files/neg/interop_abstypetags_arenot_classtags.check new file mode 100644 index 0000000000..637db83e57 --- /dev/null +++ b/test/files/neg/interop_abstypetags_arenot_classtags.check @@ -0,0 +1,4 @@ +interop_abstypetags_arenot_classtags.scala:6: error: No ClassTag available for T
+ println(classTag[T])
+ ^
+one error found
diff --git a/test/files/neg/interop_abstypetags_arenot_classtags.scala b/test/files/neg/interop_abstypetags_arenot_classtags.scala new file mode 100644 index 0000000000..e3911c1588 --- /dev/null +++ b/test/files/neg/interop_abstypetags_arenot_classtags.scala @@ -0,0 +1,12 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.{ClassTag, classTag} + +object Test extends App { + def absTypeTagIsnotClassTag[T: AbsTypeTag] = { + println(classTag[T]) + } + + absTypeTagIsnotClassTag[Int] + absTypeTagIsnotClassTag[String] + absTypeTagIsnotClassTag[Array[Int]] +}
\ No newline at end of file diff --git a/test/files/neg/interop_erasuretags_arenot_manifests.check b/test/files/neg/interop_abstypetags_arenot_manifests.check index da3c03d371..c80635543f 100644 --- a/test/files/neg/interop_erasuretags_arenot_manifests.check +++ b/test/files/neg/interop_abstypetags_arenot_manifests.check @@ -1,4 +1,4 @@ -interop_erasuretags_arenot_manifests.scala:3: error: No Manifest available for T.
+interop_abstypetags_arenot_manifests.scala:5: error: No Manifest available for T.
println(manifest[T])
^
one error found
diff --git a/test/files/neg/interop_abstypetags_arenot_manifests.scala b/test/files/neg/interop_abstypetags_arenot_manifests.scala new file mode 100644 index 0000000000..77a95048fd --- /dev/null +++ b/test/files/neg/interop_abstypetags_arenot_manifests.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + def absTypeTagIsnotManifest[T: AbsTypeTag] = { + println(manifest[T]) + } + + absTypeTagIsnotManifest[Int] + absTypeTagIsnotManifest[String] + absTypeTagIsnotManifest[Array[Int]] +}
\ No newline at end of file diff --git a/test/files/neg/interop_classmanifests_arenot_concretetypetags.check b/test/files/neg/interop_classmanifests_arenot_concretetypetags.check deleted file mode 100644 index d6fa564df4..0000000000 --- a/test/files/neg/interop_classmanifests_arenot_concretetypetags.check +++ /dev/null @@ -1,4 +0,0 @@ -interop_classmanifests_arenot_concretetypetags.scala:3: error: No ConcreteTypeTag available for T
- println(concreteTypeTag[T])
- ^
-one error found
diff --git a/test/files/neg/interop_classmanifests_arenot_concretetypetags.scala b/test/files/neg/interop_classmanifests_arenot_concretetypetags.scala deleted file mode 100644 index 5b1ed55e47..0000000000 --- a/test/files/neg/interop_classmanifests_arenot_concretetypetags.scala +++ /dev/null @@ -1,9 +0,0 @@ -object Test extends App { - def classManifestIsnotConcreteTypeTag[T: ClassManifest] = { - println(concreteTypeTag[T]) - } - - classManifestIsnotConcreteTypeTag[Int] - classManifestIsnotConcreteTypeTag[String] - classManifestIsnotConcreteTypeTag[Array[Int]] -}
\ No newline at end of file diff --git a/test/files/neg/interop_classmanifests_arenot_typetags.check b/test/files/neg/interop_classmanifests_arenot_typetags.check new file mode 100644 index 0000000000..6675fd9eae --- /dev/null +++ b/test/files/neg/interop_classmanifests_arenot_typetags.check @@ -0,0 +1,4 @@ +interop_classmanifests_arenot_typetags.scala:5: error: No TypeTag available for T
+ println(implicitly[TypeTag[T]])
+ ^
+one error found
diff --git a/test/files/neg/interop_classmanifests_arenot_typetags.scala b/test/files/neg/interop_classmanifests_arenot_typetags.scala new file mode 100644 index 0000000000..29d03a8ec8 --- /dev/null +++ b/test/files/neg/interop_classmanifests_arenot_typetags.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + def classManifestIsnotTypeTag[T: ClassManifest] = { + println(implicitly[TypeTag[T]]) + } + + classManifestIsnotTypeTag[Int] + classManifestIsnotTypeTag[String] + classManifestIsnotTypeTag[Array[Int]] +}
\ No newline at end of file diff --git a/test/files/neg/interop_classtags_arenot_manifests.check b/test/files/neg/interop_classtags_arenot_manifests.check index 95f6a94d4b..6982f0b805 100644 --- a/test/files/neg/interop_classtags_arenot_manifests.check +++ b/test/files/neg/interop_classtags_arenot_manifests.check @@ -1,7 +1,4 @@ -interop_classtags_arenot_manifests.scala:3: error: No Manifest available for T.
+interop_classtags_arenot_manifests.scala:5: error: No Manifest available for T.
println(manifest[T])
^
-interop_classtags_arenot_manifests.scala:11: error: No Manifest available for T.
- println(manifest[T])
- ^
-two errors found
+one error found
diff --git a/test/files/neg/interop_classtags_arenot_manifests.scala b/test/files/neg/interop_classtags_arenot_manifests.scala index 7351f7e305..391143c6e8 100644 --- a/test/files/neg/interop_classtags_arenot_manifests.scala +++ b/test/files/neg/interop_classtags_arenot_manifests.scala @@ -1,12 +1,6 @@ -object Test extends App { - def arrayTagIsnotManifest[T: ArrayTag] = { - println(manifest[T]) - } - - arrayTagIsnotManifest[Int] - arrayTagIsnotManifest[String] - arrayTagIsnotManifest[Array[Int]] +import scala.reflect.{ClassTag, classTag} +object Test extends App { def classTagIsnotManifest[T: ClassTag] = { println(manifest[T]) } diff --git a/test/files/neg/interop_erasuretags_arenot_classmanifests.scala b/test/files/neg/interop_erasuretags_arenot_classmanifests.scala deleted file mode 100644 index cf7d1ac257..0000000000 --- a/test/files/neg/interop_erasuretags_arenot_classmanifests.scala +++ /dev/null @@ -1,9 +0,0 @@ -object Test extends App { - def erasureTagIsnotClassManifest[T: ErasureTag] = { - println(classManifest[T]) - } - - erasureTagIsnotClassManifest[Int] - erasureTagIsnotClassManifest[String] - erasureTagIsnotClassManifest[Array[Int]] -}
\ No newline at end of file diff --git a/test/files/neg/interop_erasuretags_arenot_manifests.scala b/test/files/neg/interop_erasuretags_arenot_manifests.scala deleted file mode 100644 index 5c326549d8..0000000000 --- a/test/files/neg/interop_erasuretags_arenot_manifests.scala +++ /dev/null @@ -1,9 +0,0 @@ -object Test extends App { - def erasureTagIsnotManifest[T: ErasureTag] = { - println(manifest[T]) - } - - erasureTagIsnotManifest[Int] - erasureTagIsnotManifest[String] - erasureTagIsnotManifest[Array[Int]] -}
\ No newline at end of file diff --git a/test/files/neg/interop_typetags_arenot_classmanifests.check b/test/files/neg/interop_typetags_arenot_classmanifests.check index 9ed4fd43d4..403625b4da 100644 --- a/test/files/neg/interop_typetags_arenot_classmanifests.check +++ b/test/files/neg/interop_typetags_arenot_classmanifests.check @@ -1,4 +1,4 @@ -interop_typetags_arenot_classmanifests.scala:3: error: could not find implicit value for parameter m: ClassManifest[T]
+interop_typetags_arenot_classmanifests.scala:5: error: could not find implicit value for parameter m: ClassManifest[T]
println(classManifest[T])
^
one error found
diff --git a/test/files/neg/interop_typetags_arenot_classmanifests.scala b/test/files/neg/interop_typetags_arenot_classmanifests.scala index b1fbb7b5a6..d07f4726f5 100644 --- a/test/files/neg/interop_typetags_arenot_classmanifests.scala +++ b/test/files/neg/interop_typetags_arenot_classmanifests.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + object Test extends App { def typeTagIsnotClassManifest[T: TypeTag] = { println(classManifest[T]) diff --git a/test/files/neg/interop_typetags_arenot_classtags.check b/test/files/neg/interop_typetags_arenot_classtags.check new file mode 100644 index 0000000000..673ad2f941 --- /dev/null +++ b/test/files/neg/interop_typetags_arenot_classtags.check @@ -0,0 +1,4 @@ +interop_typetags_arenot_classtags.scala:6: error: No ClassTag available for T
+ println(classTag[T])
+ ^
+one error found
diff --git a/test/files/neg/interop_typetags_arenot_classtags.scala b/test/files/neg/interop_typetags_arenot_classtags.scala new file mode 100644 index 0000000000..072c12adb0 --- /dev/null +++ b/test/files/neg/interop_typetags_arenot_classtags.scala @@ -0,0 +1,12 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.{ClassTag, classTag} + +object Test extends App { + def typeTagIsnotClassTag[T: TypeTag] = { + println(classTag[T]) + } + + typeTagIsnotClassTag[Int] + typeTagIsnotClassTag[String] + typeTagIsnotClassTag[Array[Int]] +}
\ No newline at end of file diff --git a/test/files/neg/interop_typetags_arenot_manifests.check b/test/files/neg/interop_typetags_arenot_manifests.check deleted file mode 100644 index 7761a747ff..0000000000 --- a/test/files/neg/interop_typetags_arenot_manifests.check +++ /dev/null @@ -1,4 +0,0 @@ -interop_typetags_arenot_manifests.scala:3: error: No Manifest available for T.
- println(manifest[T])
- ^
-one error found
diff --git a/test/files/neg/interop_typetags_arenot_manifests.scala b/test/files/neg/interop_typetags_arenot_manifests.scala deleted file mode 100644 index 4e2a04489b..0000000000 --- a/test/files/neg/interop_typetags_arenot_manifests.scala +++ /dev/null @@ -1,9 +0,0 @@ -object Test extends App { - def typeTagIsnotManifest[T: TypeTag] = { - println(manifest[T]) - } - - typeTagIsnotManifest[Int] - typeTagIsnotManifest[String] - typeTagIsnotManifest[Array[Int]] -}
\ No newline at end of file diff --git a/test/files/neg/interop_typetags_without_classtags_arenot_manifests.check b/test/files/neg/interop_typetags_without_classtags_arenot_manifests.check new file mode 100644 index 0000000000..a95f1ad308 --- /dev/null +++ b/test/files/neg/interop_typetags_without_classtags_arenot_manifests.check @@ -0,0 +1,6 @@ +interop_typetags_without_classtags_arenot_manifests.scala:6: error: to create a manifest here, it is necessary to interoperate with the type tag `evidence$1` in scope.
+however typetag -> manifest conversion requires a class tag for the corresponding type to be present.
+to proceed add a class tag to the type `T` (e.g. by introducing a context bound) and recompile.
+ println(manifest[T])
+ ^
+one error found
diff --git a/test/files/neg/interop_typetags_without_classtags_arenot_manifests.scala b/test/files/neg/interop_typetags_without_classtags_arenot_manifests.scala new file mode 100644 index 0000000000..0d48ae5cd0 --- /dev/null +++ b/test/files/neg/interop_typetags_without_classtags_arenot_manifests.scala @@ -0,0 +1,12 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.ClassTag + +object Test extends App { + def typeTagWithoutClassTagIsnotManifest[T: TypeTag] = { + println(manifest[T]) + } + + typeTagWithoutClassTagIsnotManifest[Int] + typeTagWithoutClassTagIsnotManifest[String] + typeTagWithoutClassTagIsnotManifest[Array[Int]] +}
\ No newline at end of file diff --git a/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala b/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala index e9876e32e9..8abde907bb 100644 --- a/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala +++ b/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_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/neg/macro-invalidimpl-f/Impls_1.scala b/test/files/neg/macro-invalidimpl-f/Impls_1.scala index 06c6efbb1f..3b8f15b90c 100644 --- a/test/files/neg/macro-invalidimpl-f/Impls_1.scala +++ b/test/files/neg/macro-invalidimpl-f/Impls_1.scala @@ -2,10 +2,10 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def fooNullary(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 fooEmpty(c: Ctx)() = fooNullary(c) -} +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidimpl-g/Impls_1.scala b/test/files/neg/macro-invalidimpl-g/Impls_1.scala index 06c6efbb1f..3b8f15b90c 100644 --- a/test/files/neg/macro-invalidimpl-g/Impls_1.scala +++ b/test/files/neg/macro-invalidimpl-g/Impls_1.scala @@ -2,10 +2,10 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def fooNullary(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 fooEmpty(c: Ctx)() = fooNullary(c) -} +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-context-bounds.check b/test/files/neg/macro-invalidsig-context-bounds.check index 0401993335..b2ce4b1caa 100644 --- a/test/files/neg/macro-invalidsig-context-bounds.check +++ b/test/files/neg/macro-invalidsig-context-bounds.check @@ -1,4 +1,4 @@ -Impls_1.scala:4: error: macro implementations cannot have implicit parameters other than TypeTag evidences - def foo[U: c.TypeTag: Numeric](c: Ctx) = { - ^ -one error found +Impls_1.scala:5: error: macro implementations cannot have implicit parameters other than TypeTag evidences
+ def foo[U: c.TypeTag: Numeric](c: Ctx) = {
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala b/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala index 2eb2ab3947..2eef7aac8b 100644 --- a/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala @@ -1,8 +1,9 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.{Context => Ctx} object Impls { def foo[U: c.TypeTag: Numeric](c: Ctx) = { - import c.mirror._ + import c.universe._ Literal(Constant(42)) } -} +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-ctx-badargc/Impls_1.scala b/test/files/neg/macro-invalidsig-ctx-badargc/Impls_1.scala index da28944d27..4d5d29158f 100644 --- a/test/files/neg/macro-invalidsig-ctx-badargc/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-ctx-badargc/Impls_1.scala @@ -1,5 +1,3 @@ -import scala.reflect.api.{Mirror => Ctx} - object Impls { def foo = ??? } diff --git a/test/files/neg/macro-invalidsig-ctx-badtype.check b/test/files/neg/macro-invalidsig-ctx-badtype.check index 3913a8e3cb..b1702bbca6 100644 --- a/test/files/neg/macro-invalidsig-ctx-badtype.check +++ b/test/files/neg/macro-invalidsig-ctx-badtype.check @@ -1,7 +1,7 @@ -Macros_Test_2.scala:2: error: macro implementation has wrong shape: - required: (c: scala.reflect.makro.Context): c.Expr[Any] - found : (c: scala.reflect.api.Mirror): Nothing -type mismatch for parameter c: scala.reflect.makro.Context does not conform to scala.reflect.api.Mirror - def foo = macro Impls.foo - ^ -one error found +Macros_Test_2.scala:2: error: macro implementation has wrong shape:
+ required: (c: scala.reflect.makro.Context): c.Expr[Any]
+ found : (c: scala.reflect.api.Universe): Nothing
+type mismatch for parameter c: scala.reflect.makro.Context does not conform to scala.reflect.api.Universe
+ def foo = macro Impls.foo
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidsig-ctx-badtype/Impls_1.scala b/test/files/neg/macro-invalidsig-ctx-badtype/Impls_1.scala index 747a2e9ca8..cf1a4cf85c 100644 --- a/test/files/neg/macro-invalidsig-ctx-badtype/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-ctx-badtype/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.api.{Mirror => Ctx} +import scala.reflect.api.{Universe => Ctx} object Impls { def foo(c: Ctx) = ??? diff --git a/test/files/neg/macro-invalidsig-implicit-params.check b/test/files/neg/macro-invalidsig-implicit-params.check index 0dd1c27b50..6416ed0a09 100644 --- a/test/files/neg/macro-invalidsig-implicit-params.check +++ b/test/files/neg/macro-invalidsig-implicit-params.check @@ -1,4 +1,4 @@ -Impls_Macros_1.scala:4: error: macro implementations cannot have implicit parameters other than TypeTag evidences
+Impls_Macros_1.scala:5: error: macro implementations cannot have implicit parameters other than TypeTag evidences
def foo_targs[T, U: c.TypeTag](c: Ctx)(implicit x: c.Expr[Int]) = {
^
one error found
diff --git a/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala b/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala index 662ad2ab52..5bfe73ec59 100644 --- a/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala +++ b/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala @@ -1,18 +1,19 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.{Context => Ctx} object Impls { def foo_targs[T, U: c.TypeTag](c: Ctx)(implicit x: c.Expr[Int]) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val body = Block( Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("invoking foo_targs...")))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("type of prefix is: " + prefix.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("U is: " + implicitly[c.TypeTag[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/neg/macro-invalidsig-params-badtype.check b/test/files/neg/macro-invalidsig-params-badtype.check index 71a65aec84..e4f67e650a 100644 --- a/test/files/neg/macro-invalidsig-params-badtype.check +++ b/test/files/neg/macro-invalidsig-params-badtype.check @@ -1,7 +1,7 @@ -Impls_Macros_1.scala:8: error: macro implementation has wrong shape: - required: (c: scala.reflect.makro.Context)(x: c.Expr[Int]): c.Expr[Any] - found : (c: scala.reflect.makro.Context)(x: c.mirror.Tree): Nothing -type mismatch for parameter x: c.Expr[Int] does not conform to c.mirror.Tree - def foo(x: Int) = macro Impls.foo - ^ -one error found +Impls_Macros_1.scala:8: error: macro implementation has wrong shape:
+ required: (c: scala.reflect.makro.Context)(x: c.Expr[Int]): c.Expr[Any]
+ found : (c: scala.reflect.makro.Context)(x: c.universe.Tree): Nothing
+type mismatch for parameter x: c.Expr[Int] does not conform to c.universe.Tree
+ def foo(x: Int) = macro Impls.foo
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidsig-params-badtype/Impls_Macros_1.scala b/test/files/neg/macro-invalidsig-params-badtype/Impls_Macros_1.scala index 29220c1c82..6393e6d395 100644 --- a/test/files/neg/macro-invalidsig-params-badtype/Impls_Macros_1.scala +++ b/test/files/neg/macro-invalidsig-params-badtype/Impls_Macros_1.scala @@ -1,7 +1,7 @@ import scala.reflect.makro.{Context => Ctx} object Impls { - def foo(c: Ctx)(x: c.mirror.Tree) = ??? + def foo(c: Ctx)(x: c.universe.Tree) = ??? } object Macros { diff --git a/test/files/neg/macro-invalidsig-tparams-badtype.check b/test/files/neg/macro-invalidsig-tparams-badtype.check index bd1acc4a0a..9166db3574 100644 --- a/test/files/neg/macro-invalidsig-tparams-badtype.check +++ b/test/files/neg/macro-invalidsig-tparams-badtype.check @@ -1,6 +1,6 @@ Macros_Test_2.scala:2: error: macro implementation has wrong shape:
required: (c: scala.reflect.makro.Context): c.Expr[Any]
- found : (c: scala.reflect.makro.Context)(U: c.mirror.Type): Nothing
+ found : (c: scala.reflect.makro.Context)(U: c.universe.Type): Nothing
number of parameter sections differ
def foo[U] = macro Impls.foo[U]
^
diff --git a/test/files/neg/macro-invalidsig-tparams-badtype/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-badtype/Impls_1.scala index b43251df33..9886331502 100644 --- a/test/files/neg/macro-invalidsig-tparams-badtype/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-tparams-badtype/Impls_1.scala @@ -1,5 +1,5 @@ import scala.reflect.makro.{Context => Ctx} object Impls { - def foo[U](c: Ctx)(U: c.mirror.Type) = ??? + def foo[U](c: Ctx)(U: c.universe.Type) = ??? } diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala index bbe5b4e519..ea472e6f91 100644 --- a/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala @@ -1,5 +1,6 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.{Context => Ctx} object Impls { def foo[U: c.TypeTag](c: Ctx) = ??? -} +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala index db79ddbcd8..c4eb3d9b4a 100644 --- a/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala @@ -1,3 +1,4 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.{Context => Ctx} object Impls { @@ -7,4 +8,4 @@ object Impls { println(V) c.literalUnit } -} +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala index 43c5a2acd5..41facc881e 100644 --- a/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala @@ -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, V](c: Ctx)(implicit V: c.TypeTag[V]): c.Expr[Unit] = { - import c.mirror._ + import c.universe._ println(implicitly[c.TypeTag[T]]) println(implicitly[c.TypeTag[U]]) println(V) c.literalUnit } -} +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala b/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala index 8e52613b6d..31e758e9a0 100644 --- a/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala +++ b/test/files/neg/macro-invalidusage-methodvaluesyntax/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 = 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/neg/macro-override-method-overrides-macro/Impls_1.scala b/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala index 0b127f5a59..d6493caad9 100644 --- a/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala +++ b/test/files/neg/macro-override-method-overrides-macro/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/neg/macro-reify-groundtypetag-hktypeparams-notags.check b/test/files/neg/macro-reify-groundtypetag-hktypeparams-notags.check deleted file mode 100644 index 39e90f827e..0000000000 --- a/test/files/neg/macro-reify-groundtypetag-hktypeparams-notags.check +++ /dev/null @@ -1,7 +0,0 @@ -Test.scala:5: error: No ConcreteTypeTag available for C[T]
- println(implicitly[ConcreteTypeTag[C[T]]])
- ^
-Test.scala:6: error: No ConcreteTypeTag available for List[C[T]]
- println(implicitly[ConcreteTypeTag[List[C[T]]]])
- ^
-two errors found
diff --git a/test/files/neg/macro-reify-groundtypetag-hktypeparams-notags/Test.scala b/test/files/neg/macro-reify-groundtypetag-hktypeparams-notags/Test.scala deleted file mode 100644 index 1302999da6..0000000000 --- a/test/files/neg/macro-reify-groundtypetag-hktypeparams-notags/Test.scala +++ /dev/null @@ -1,9 +0,0 @@ -import scala.reflect.mirror._ - -object Test extends App { - def fooNoTypeTagHK[C[_], T] = { - println(implicitly[ConcreteTypeTag[C[T]]]) - println(implicitly[ConcreteTypeTag[List[C[T]]]]) - } - fooNoTypeTagHK[List, Int] -}
\ No newline at end of file diff --git a/test/files/neg/macro-reify-groundtypetag-typeparams-notags.check b/test/files/neg/macro-reify-groundtypetag-typeparams-notags.check deleted file mode 100644 index 164ca3543f..0000000000 --- a/test/files/neg/macro-reify-groundtypetag-typeparams-notags.check +++ /dev/null @@ -1,7 +0,0 @@ -Test.scala:5: error: No ConcreteTypeTag available for T
- println(implicitly[ConcreteTypeTag[T]])
- ^
-Test.scala:6: error: No ConcreteTypeTag available for List[T]
- println(implicitly[ConcreteTypeTag[List[T]]])
- ^
-two errors found
diff --git a/test/files/neg/macro-reify-groundtypetag-typeparams-notags/Test.scala b/test/files/neg/macro-reify-groundtypetag-typeparams-notags/Test.scala deleted file mode 100644 index d2276ce333..0000000000 --- a/test/files/neg/macro-reify-groundtypetag-typeparams-notags/Test.scala +++ /dev/null @@ -1,9 +0,0 @@ -import scala.reflect.mirror._ - -object Test extends App { - def fooNoTypeTag[T] = { - println(implicitly[ConcreteTypeTag[T]]) - println(implicitly[ConcreteTypeTag[List[T]]]) - } - fooNoTypeTag[Int] -}
\ No newline at end of file diff --git a/test/files/neg/macro-reify-groundtypetag-usetypetag.check b/test/files/neg/macro-reify-groundtypetag-usetypetag.check deleted file mode 100644 index 164ca3543f..0000000000 --- a/test/files/neg/macro-reify-groundtypetag-usetypetag.check +++ /dev/null @@ -1,7 +0,0 @@ -Test.scala:5: error: No ConcreteTypeTag available for T
- println(implicitly[ConcreteTypeTag[T]])
- ^
-Test.scala:6: error: No ConcreteTypeTag available for List[T]
- println(implicitly[ConcreteTypeTag[List[T]]])
- ^
-two errors found
diff --git a/test/files/neg/macro-reify-groundtypetag-usetypetag/Test.scala b/test/files/neg/macro-reify-groundtypetag-usetypetag/Test.scala deleted file mode 100644 index d82cdc33e9..0000000000 --- a/test/files/neg/macro-reify-groundtypetag-usetypetag/Test.scala +++ /dev/null @@ -1,9 +0,0 @@ -import scala.reflect.mirror._ - -object Test extends App { - def fooTypeTag[T: TypeTag] = { - println(implicitly[ConcreteTypeTag[T]]) - println(implicitly[ConcreteTypeTag[List[T]]]) - } - fooTypeTag[Int] -}
\ No newline at end of file diff --git a/test/files/neg/macro-reify-typetag-hktypeparams-notags.check b/test/files/neg/macro-reify-typetag-hktypeparams-notags.check new file mode 100644 index 0000000000..742d87b0a4 --- /dev/null +++ b/test/files/neg/macro-reify-typetag-hktypeparams-notags.check @@ -0,0 +1,7 @@ +Test.scala:5: error: No TypeTag available for C[T]
+ println(implicitly[TypeTag[C[T]]])
+ ^
+Test.scala:6: error: No TypeTag available for List[C[T]]
+ println(implicitly[TypeTag[List[C[T]]]])
+ ^
+two errors found
diff --git a/test/files/neg/macro-reify-typetag-hktypeparams-notags/Test.scala b/test/files/neg/macro-reify-typetag-hktypeparams-notags/Test.scala new file mode 100644 index 0000000000..c7b1cedcd2 --- /dev/null +++ b/test/files/neg/macro-reify-typetag-hktypeparams-notags/Test.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + def fooNoTypeTagHK[C[_], T] = { + println(implicitly[TypeTag[C[T]]]) + println(implicitly[TypeTag[List[C[T]]]]) + } + fooNoTypeTagHK[List, Int] +}
\ No newline at end of file diff --git a/test/files/neg/macro-reify-typetag-typeparams-notags.check b/test/files/neg/macro-reify-typetag-typeparams-notags.check new file mode 100644 index 0000000000..db88260047 --- /dev/null +++ b/test/files/neg/macro-reify-typetag-typeparams-notags.check @@ -0,0 +1,7 @@ +Test.scala:5: error: No TypeTag available for T
+ println(implicitly[TypeTag[T]])
+ ^
+Test.scala:6: error: No TypeTag available for List[T]
+ println(implicitly[TypeTag[List[T]]])
+ ^
+two errors found
diff --git a/test/files/run/macro-reify-typetag-typeparams-notags/Test.scala b/test/files/neg/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/neg/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/neg/macro-reify-typetag-useabstypetag.check b/test/files/neg/macro-reify-typetag-useabstypetag.check new file mode 100644 index 0000000000..db88260047 --- /dev/null +++ b/test/files/neg/macro-reify-typetag-useabstypetag.check @@ -0,0 +1,7 @@ +Test.scala:5: error: No TypeTag available for T
+ println(implicitly[TypeTag[T]])
+ ^
+Test.scala:6: error: No TypeTag available for List[T]
+ println(implicitly[TypeTag[List[T]]])
+ ^
+two errors found
diff --git a/test/files/run/macro-reify-typetag-usegroundtypetag/Test.scala b/test/files/neg/macro-reify-typetag-useabstypetag/Test.scala index de235f51cc..b66ad6c523 100644 --- a/test/files/run/macro-reify-typetag-usegroundtypetag/Test.scala +++ b/test/files/neg/macro-reify-typetag-useabstypetag/Test.scala @@ -1,7 +1,7 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { - def fooTypeTag[T: ConcreteTypeTag] = { + def fooTypeTag[T: AbsTypeTag] = { println(implicitly[TypeTag[T]]) println(implicitly[TypeTag[List[T]]]) } diff --git a/test/files/neg/macro-without-xmacros-a/Impls_1.scala b/test/files/neg/macro-without-xmacros-a/Impls_1.scala index e6cee46e85..0b6fbe240e 100644 --- a/test/files/neg/macro-without-xmacros-a/Impls_1.scala +++ b/test/files/neg/macro-without-xmacros-a/Impls_1.scala @@ -2,17 +2,17 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo_impl(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_impl(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_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { - import c.mirror._ - Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3))))) + import c.universe._ + c.Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3))))) } -} +}
\ No newline at end of file diff --git a/test/files/neg/macro-without-xmacros-b/Impls_1.scala b/test/files/neg/macro-without-xmacros-b/Impls_1.scala index e6cee46e85..0b6fbe240e 100644 --- a/test/files/neg/macro-without-xmacros-b/Impls_1.scala +++ b/test/files/neg/macro-without-xmacros-b/Impls_1.scala @@ -2,17 +2,17 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo_impl(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_impl(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_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { - import c.mirror._ - Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3))))) + import c.universe._ + c.Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3))))) } -} +}
\ No newline at end of file diff --git a/test/files/neg/reify_ann2b.check b/test/files/neg/reify_ann2b.check index 52bdbe5b7c..1cef405bef 100644 --- a/test/files/neg/reify_ann2b.check +++ b/test/files/neg/reify_ann2b.check @@ -1,4 +1,4 @@ -reify_ann2b.scala:6: error: inner classes cannot be classfile annotations - class ann(bar: String) extends annotation.ClassfileAnnotation - ^ -one error found +reify_ann2b.scala:9: error: inner classes cannot be classfile annotations
+ class ann(bar: String) extends annotation.ClassfileAnnotation
+ ^
+one error found
diff --git a/test/files/neg/reify_ann2b.scala b/test/files/neg/reify_ann2b.scala index 397d00210d..2076af34c8 100644 --- a/test/files/neg/reify_ann2b.scala +++ b/test/files/neg/reify_ann2b.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/neg/reify_metalevel_breach_+0_refers_to_1.check b/test/files/neg/reify_metalevel_breach_+0_refers_to_1.check new file mode 100644 index 0000000000..efdbd7e282 --- /dev/null +++ b/test/files/neg/reify_metalevel_breach_+0_refers_to_1.check @@ -0,0 +1,7 @@ +reify_metalevel_breach_+0_refers_to_1.scala:10: error: the splice cannot be resolved statically, which means there is a cross-stage evaluation involved.
+cross-stage evaluations need to be invoked explicitly, so we're showing you this error.
+if you're sure this is not an oversight, add scala-compiler.jar to the classpath,
+import `scala.tools.reflect.Eval` and call `<your expr>.eval` instead.
+ inner.splice
+ ^
+one error found
diff --git a/test/files/neg/reify_metalevel_breach_+0_refers_to_1.scala b/test/files/neg/reify_metalevel_breach_+0_refers_to_1.scala new file mode 100644 index 0000000000..9499960480 --- /dev/null +++ b/test/files/neg/reify_metalevel_breach_+0_refers_to_1.scala @@ -0,0 +1,16 @@ +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{ + val x = 2 + val inner = reify{x} + inner.splice + }; + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.runExpr(code.tree) + println("evaluated = " + evaluated) +}
\ No newline at end of file diff --git a/test/files/neg/reify_metalevel_breach_-1_refers_to_0_a.check b/test/files/neg/reify_metalevel_breach_-1_refers_to_0_a.check new file mode 100644 index 0000000000..91755c789a --- /dev/null +++ b/test/files/neg/reify_metalevel_breach_-1_refers_to_0_a.check @@ -0,0 +1,7 @@ +reify_metalevel_breach_-1_refers_to_0_a.scala:9: error: the splice cannot be resolved statically, which means there is a cross-stage evaluation involved.
+cross-stage evaluations need to be invoked explicitly, so we're showing you this error.
+if you're sure this is not an oversight, add scala-compiler.jar to the classpath,
+import `scala.tools.reflect.Eval` and call `<your expr>.eval` instead.
+ val code = reify{outer.splice.splice}
+ ^
+one error found
diff --git a/test/files/neg/reify_metalevel_breach_-1_refers_to_0_a.scala b/test/files/neg/reify_metalevel_breach_-1_refers_to_0_a.scala new file mode 100644 index 0000000000..e6aaeb9426 --- /dev/null +++ b/test/files/neg/reify_metalevel_breach_-1_refers_to_0_a.scala @@ -0,0 +1,14 @@ +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}} + val code = reify{outer.splice.splice} + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.runExpr(code.tree) + println("evaluated = " + evaluated) +}
\ No newline at end of file diff --git a/test/files/neg/reify_metalevel_breach_-1_refers_to_0_b.check b/test/files/neg/reify_metalevel_breach_-1_refers_to_0_b.check new file mode 100644 index 0000000000..f703bfb05f --- /dev/null +++ b/test/files/neg/reify_metalevel_breach_-1_refers_to_0_b.check @@ -0,0 +1,7 @@ +reify_metalevel_breach_-1_refers_to_0_b.scala:12: error: the splice cannot be resolved statically, which means there is a cross-stage evaluation involved.
+cross-stage evaluations need to be invoked explicitly, so we're showing you this error.
+if you're sure this is not an oversight, add scala-compiler.jar to the classpath,
+import `scala.tools.reflect.Eval` and call `<your expr>.eval` instead.
+ }.splice
+ ^
+one error found
diff --git a/test/files/neg/reify_metalevel_breach_-1_refers_to_0_b.scala b/test/files/neg/reify_metalevel_breach_-1_refers_to_0_b.scala new file mode 100644 index 0000000000..16dcae8683 --- /dev/null +++ b/test/files/neg/reify_metalevel_breach_-1_refers_to_0_b.scala @@ -0,0 +1,18 @@ +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 code = reify{ + { + val inner = reify{reify{x}} + inner.splice + }.splice + } + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.runExpr(code.tree) + println("evaluated = " + evaluated) +}
\ No newline at end of file diff --git a/test/files/neg/reify_metalevel_breach_-1_refers_to_1.check b/test/files/neg/reify_metalevel_breach_-1_refers_to_1.check new file mode 100644 index 0000000000..068e4accd2 --- /dev/null +++ b/test/files/neg/reify_metalevel_breach_-1_refers_to_1.check @@ -0,0 +1,7 @@ +reify_metalevel_breach_-1_refers_to_1.scala:10: error: the splice cannot be resolved statically, which means there is a cross-stage evaluation involved.
+cross-stage evaluations need to be invoked explicitly, so we're showing you this error.
+if you're sure this is not an oversight, add scala-compiler.jar to the classpath,
+import `scala.tools.reflect.Eval` and call `<your expr>.eval` instead.
+ inner.splice.splice
+ ^
+one error found
diff --git a/test/files/neg/reify_metalevel_breach_-1_refers_to_1.scala b/test/files/neg/reify_metalevel_breach_-1_refers_to_1.scala new file mode 100644 index 0000000000..9600489f35 --- /dev/null +++ b/test/files/neg/reify_metalevel_breach_-1_refers_to_1.scala @@ -0,0 +1,16 @@ +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{ + val x = 2 + val inner = reify{reify{x}} + inner.splice.splice + }; + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.runExpr(code.tree) + println("evaluated = " + evaluated) +}
\ No newline at end of file diff --git a/test/files/neg/reify_nested_inner_refers_to_local.check b/test/files/neg/reify_nested_inner_refers_to_local.check new file mode 100644 index 0000000000..3f897bded9 --- /dev/null +++ b/test/files/neg/reify_nested_inner_refers_to_local.check @@ -0,0 +1,7 @@ +reify_nested_inner_refers_to_local.scala:9: error: the splice cannot be resolved statically, which means there is a cross-stage evaluation involved.
+cross-stage evaluations need to be invoked explicitly, so we're showing you this error.
+if you're sure this is not an oversight, add scala-compiler.jar to the classpath,
+import `scala.tools.reflect.Eval` and call `<your expr>.eval` instead.
+ reify{x}.splice
+ ^
+one error found
diff --git a/test/files/neg/reify_nested_inner_refers_to_local.scala b/test/files/neg/reify_nested_inner_refers_to_local.scala new file mode 100644 index 0000000000..fcbc1f7865 --- /dev/null +++ b/test/files/neg/reify_nested_inner_refers_to_local.scala @@ -0,0 +1,15 @@ +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{ + val x = 2 + reify{x}.splice + }; + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.runExpr(code.tree) + println("evaluated = " + evaluated) +}
\ No newline at end of file diff --git a/test/files/neg/t2775.check b/test/files/neg/t2775.check index a1e950cf73..f357221cd9 100644 --- a/test/files/neg/t2775.check +++ b/test/files/neg/t2775.check @@ -1,4 +1,4 @@ -t2775.scala:1: error: cannot find array tag for element type B.this.T -trait B[S] { type T = S; val c = new Array[T](1) } - ^ -one error found +t2775.scala:1: error: cannot find class tag for element type B.this.T
+trait B[S] { type T = S; val c = new Array[T](1) }
+ ^
+one error found
diff --git a/test/files/neg/t3692-new.check b/test/files/neg/t3692-new.check index e013daca74..349e4fe48a 100644 --- a/test/files/neg/t3692-new.check +++ b/test/files/neg/t3692-new.check @@ -1,4 +1,4 @@ -t3692-new.scala:15: error: unreachable code
+t3692-new.scala:16: error: unreachable code
case m2: Map[T, Int] => new java.util.HashMap[T, Integer]
^
one error found
diff --git a/test/files/neg/t3692-new.scala b/test/files/neg/t3692-new.scala index 46874b02e3..cebdcea393 100644 --- a/test/files/neg/t3692-new.scala +++ b/test/files/neg/t3692-new.scala @@ -1,3 +1,4 @@ +import scala.reflect.{ClassTag, classTag} import java.lang.Integer object Tester { diff --git a/test/files/neg/t3692-old.check b/test/files/neg/t3692-old.check index 9da7033239..a97a7d31ec 100644 --- a/test/files/neg/t3692-old.check +++ b/test/files/neg/t3692-old.check @@ -1,4 +1,4 @@ -t3692-old.scala:6: warning: object Manifest in package reflect is deprecated: Use `@scala.reflect.ConcreteTypeTag` instead
+t3692-old.scala:6: warning: object Manifest in package reflect is deprecated: Use TypeTag instead
new ManifestTester().toJavaMap(map)
^
t3692-old.scala:15: error: unreachable code
diff --git a/test/files/neg/t5334_1.check b/test/files/neg/t5334_1.check index 1d5a7cbc01..eca854964a 100644 --- a/test/files/neg/t5334_1.check +++ b/test/files/neg/t5334_1.check @@ -1,4 +1,4 @@ -t5334_1.scala:4: error: implementation restriction: cannot reify block of type C that involves a type declared inside the block being reified. consider casting the return value to a suitable type
+t5334_1.scala:5: error: implementation restriction: cannot reify block of type C that involves a type declared inside the block being reified. consider casting the return value to a suitable type
reify {
^
one error found
diff --git a/test/files/neg/t5334_1.scala b/test/files/neg/t5334_1.scala index a7de5a0915..b75badb145 100644 --- a/test/files/neg/t5334_1.scala +++ b/test/files/neg/t5334_1.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 { override def toString = "C" } new C }.eval -} +}
\ No newline at end of file diff --git a/test/files/neg/t5334_2.check b/test/files/neg/t5334_2.check index a62bfff7a5..e21f0d5967 100644 --- a/test/files/neg/t5334_2.check +++ b/test/files/neg/t5334_2.check @@ -1,4 +1,4 @@ -t5334_2.scala:4: error: implementation restriction: cannot reify block of type List[(C, C)] that involves a type declared inside the block being reified. consider casting the return value to a suitable type
+t5334_2.scala:5: error: implementation restriction: cannot reify block of type List[(C, C)] that involves a type declared inside the block being reified. consider casting the return value to a suitable type
reify {
^
one error found
diff --git a/test/files/neg/t5334_2.scala b/test/files/neg/t5334_2.scala index fc6dfcd0c1..e082e3b8e3 100644 --- a/test/files/neg/t5334_2.scala +++ b/test/files/neg/t5334_2.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 { override def toString() = "C" } List((new C, new C)) }.eval -} +}
\ No newline at end of file diff --git a/test/files/neg/t5452-new.check b/test/files/neg/t5452-new.check index bbd3734f74..4bbeff3644 100644 --- a/test/files/neg/t5452-new.check +++ b/test/files/neg/t5452-new.check @@ -1,7 +1,7 @@ -t5452-new.scala:28: error: overloaded method value apply with alternatives:
+t5452-new.scala:30: error: overloaded method value apply with alternatives:
()Queryable[CoffeesTable] <and>
- (t: Tree)(implicit evidence$2: ClassTag[CoffeesTable])Nothing <and>
- (implicit evidence$1: ClassTag[CoffeesTable])Nothing
+ (t: Tree)(implicit evidence$2: scala.reflect.ClassTag[CoffeesTable])Nothing <and>
+ (implicit evidence$1: scala.reflect.ClassTag[CoffeesTable])Nothing
cannot be applied to (Queryable[CoffeesTable])
Queryable[CoffeesTable]( q.treeFilter(null) )
^
diff --git a/test/files/neg/t5452-new.scala b/test/files/neg/t5452-new.scala index c829de7d7c..b74b1550bd 100644 --- a/test/files/neg/t5452-new.scala +++ b/test/files/neg/t5452-new.scala @@ -1,7 +1,9 @@ +import scala.reflect.{ClassTag, classTag} + // /scala/trac/5452/a.scala // Mon Feb 13 22:52:36 PST 2012 -// import scala.reflect.mirror._ +// import scala.reflect.runtime.universe._ trait Tree @@ -26,4 +28,4 @@ trait CoffeesTable{ object Test extends App{ val q = new Queryable[CoffeesTable] Queryable[CoffeesTable]( q.treeFilter(null) ) -} +}
\ No newline at end of file diff --git a/test/files/neg/t5452-old.scala b/test/files/neg/t5452-old.scala index 1032db7a4b..4f6dcbbe46 100644 --- a/test/files/neg/t5452-old.scala +++ b/test/files/neg/t5452-old.scala @@ -1,7 +1,7 @@ // /scala/trac/5452/a.scala // Mon Feb 13 22:52:36 PST 2012 -// import scala.reflect.mirror._ +// import scala.reflect.runtime.universe._ trait Tree diff --git a/test/files/neg/t5666.check b/test/files/neg/t5666.check index 4289b00ade..1c714796ba 100644 --- a/test/files/neg/t5666.check +++ b/test/files/neg/t5666.check @@ -4,33 +4,33 @@ t5666.scala:2: error: class Any is abstract; cannot be instantiated t5666.scala:3: error: class AnyVal is abstract; cannot be instantiated new AnyVal ^ -t5666.scala:4: error: Double does not have a constructor +t5666.scala:4: error: class Double is abstract; cannot be instantiated new Double - ^ -t5666.scala:5: error: Float does not have a constructor + ^ +t5666.scala:5: error: class Float is abstract; cannot be instantiated new Float - ^ -t5666.scala:6: error: Long does not have a constructor + ^ +t5666.scala:6: error: class Long is abstract; cannot be instantiated new Long - ^ -t5666.scala:7: error: Int does not have a constructor + ^ +t5666.scala:7: error: class Int is abstract; cannot be instantiated new Int - ^ -t5666.scala:8: error: Char does not have a constructor + ^ +t5666.scala:8: error: class Char is abstract; cannot be instantiated new Char - ^ -t5666.scala:9: error: Short does not have a constructor + ^ +t5666.scala:9: error: class Short is abstract; cannot be instantiated new Short - ^ -t5666.scala:10: error: Byte does not have a constructor + ^ +t5666.scala:10: error: class Byte is abstract; cannot be instantiated new Byte - ^ -t5666.scala:11: error: Boolean does not have a constructor + ^ +t5666.scala:11: error: class Boolean is abstract; cannot be instantiated new Boolean - ^ -t5666.scala:12: error: Unit does not have a constructor + ^ +t5666.scala:12: error: class Unit is abstract; cannot be instantiated new Unit - ^ + ^ t5666.scala:13: error: class Nothing is abstract; cannot be instantiated new Nothing ^ diff --git a/test/files/pos/contextbounds-implicits-new.scala b/test/files/pos/contextbounds-implicits-new.scala index 71b3cca36f..327c4a98dc 100644 --- a/test/files/pos/contextbounds-implicits-new.scala +++ b/test/files/pos/contextbounds-implicits-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + /* Tests implicit parameters in the presence of context bounds. * See Section 7.4 of the Scala Language Specification. */ @@ -5,4 +7,4 @@ class C { def f[T: TypeTag, S: TypeTag](x: T, y: S)(implicit p: C) { } -} +}
\ No newline at end of file diff --git a/test/files/pos/implicits-new.scala b/test/files/pos/implicits-new.scala index 7eb7e100c3..ffc387132a 100644 --- a/test/files/pos/implicits-new.scala +++ b/test/files/pos/implicits-new.scala @@ -1,3 +1,6 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.{ClassTag, classTag} + // #1435 object t1435 { implicit def a(s:String):String = error("") @@ -57,7 +60,7 @@ object Test1625 { } object Test2188 { - implicit def toJavaList[A: ArrayTag](t:collection.Seq[A]):java.util.List[A] = java.util.Arrays.asList(t.toArray:_*) + implicit def toJavaList[A: ClassTag](t:collection.Seq[A]):java.util.List[A] = java.util.Arrays.asList(t.toArray:_*) val x: java.util.List[String] = List("foo") } @@ -85,5 +88,5 @@ package foo2709 { // Problem with specs object specsProblem { - println(implicitly[ConcreteTypeTag[Class[_]]]) -} + println(implicitly[TypeTag[Class[_]]]) +}
\ No newline at end of file diff --git a/test/files/pos/liftcode_polymorphic.scala b/test/files/pos/liftcode_polymorphic.scala index 9c59b34bee..8f537d278a 100644 --- a/test/files/pos/liftcode_polymorphic.scala +++ b/test/files/pos/liftcode_polymorphic.scala @@ -1,13 +1,12 @@ -import scala.reflect.mirror._
-
-object Append extends Application {
-
- def append[A](l1: List[A], l2: List[A]):List[A] =
- l1 match {
- case Nil => l2
- case x::xs => x :: append(xs, l2)
- }
-
- println(reify(append _).tree)
-}
-
+import scala.reflect.runtime.universe._ + +object Append extends Application { + + def append[A](l1: List[A], l2: List[A]):List[A] = + l1 match { + case Nil => l2 + case x::xs => x :: append(xs, l2) + } + + println(reify(append _).tree) +} diff --git a/test/files/pos/manifest1-new.scala b/test/files/pos/manifest1-new.scala index 645bd42665..3907d7854b 100644 --- a/test/files/pos/manifest1-new.scala +++ b/test/files/pos/manifest1-new.scala @@ -1,4 +1,4 @@ -import scala.reflect.TypeTag +import scala.reflect.runtime.universe._ object Test { def foo[T](x: T)(implicit m: TypeTag[T]) { @@ -18,4 +18,4 @@ object Test { val d: D = new D { type T = String; val m = stringm; val x = "x" } import d.m foo(d.x) -} +}
\ No newline at end of file diff --git a/test/files/pos/nothing_manifest_disambig-new.scala b/test/files/pos/nothing_manifest_disambig-new.scala index a60b0fdbf8..ed3a9e8fb1 100644 --- a/test/files/pos/nothing_manifest_disambig-new.scala +++ b/test/files/pos/nothing_manifest_disambig-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + object Test { def mani[T: TypeTag](xs: T) = xs mani(List()) diff --git a/test/files/pos/spec-constr-new.scala b/test/files/pos/spec-constr-new.scala index 7cd02b0680..7beff91d8d 100644 --- a/test/files/pos/spec-constr-new.scala +++ b/test/files/pos/spec-constr-new.scala @@ -1,7 +1,9 @@ -class SparseArray2[@specialized(Int) T:ArrayTag](val maxSize: Int, initialLength:Int = 3) { +import scala.reflect.{ClassTag, classTag} + +class SparseArray2[@specialized(Int) T:ClassTag](val maxSize: Int, initialLength:Int = 3) { private var data = new Array[T](initialLength); private var index = new Array[Int](initialLength); // comment out to compile correctly data.length + 3; -} +}
\ No newline at end of file diff --git a/test/files/pos/spec-doubledef-new.scala b/test/files/pos/spec-doubledef-new.scala index 33f1e82b6e..ad9c6399a5 100644 --- a/test/files/pos/spec-doubledef-new.scala +++ b/test/files/pos/spec-doubledef-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + object Test { def fn[@specialized T, @specialized U](t : T => Int, u : U => Int) : T = null.asInstanceOf[T] @@ -25,4 +27,4 @@ abstract class B[T, @specialized(scala.Int) U : TypeTag, @specialized(scala.Int) Pair(u, v2) } } -} +}
\ No newline at end of file diff --git a/test/files/pos/spec-fields-new.scala b/test/files/pos/spec-fields-new.scala index ddd8bd6624..de75b4b748 100644 --- a/test/files/pos/spec-fields-new.scala +++ b/test/files/pos/spec-fields-new.scala @@ -1,4 +1,6 @@ -abstract class Foo[@specialized T: ArrayTag, U <: Ordered[U]](x: T, size: Int) { +import scala.reflect.{ClassTag, classTag} + +abstract class Foo[@specialized T: ClassTag, U <: Ordered[U]](x: T, size: Int) { var y: T var z: T = x @@ -7,4 +9,4 @@ abstract class Foo[@specialized T: ArrayTag, U <: Ordered[U]](x: T, size: Int) { def getZ = z def setZ(zz: T) = z = zz -} +}
\ No newline at end of file diff --git a/test/files/pos/spec-params-new.scala b/test/files/pos/spec-params-new.scala index 5fe0c82d40..661e686f0e 100644 --- a/test/files/pos/spec-params-new.scala +++ b/test/files/pos/spec-params-new.scala @@ -1,4 +1,6 @@ -class Foo[@specialized A: ArrayTag] { +import scala.reflect.{ClassTag, classTag} + +class Foo[@specialized A: ClassTag] { // conflicting in bounds, expect a normalized member calling m // and bridge + implementation in specialized subclasses @@ -29,4 +31,4 @@ class Foo[@specialized A: ArrayTag] { val xs = new Array[A](1) xs(0) = x } -} +}
\ No newline at end of file diff --git a/test/files/pos/spec-sparsearray-new.scala b/test/files/pos/spec-sparsearray-new.scala index 0659bf7926..7b3934c476 100644 --- a/test/files/pos/spec-sparsearray-new.scala +++ b/test/files/pos/spec-sparsearray-new.scala @@ -1,6 +1,7 @@ +import scala.reflect.{ClassTag, classTag} import scala.collection.mutable.MapLike -class SparseArray[@specialized(Int) T:ArrayTag] extends collection.mutable.Map[Int,T] with collection.mutable.MapLike[Int,T,SparseArray[T]] { +class SparseArray[@specialized(Int) T:ClassTag] extends collection.mutable.Map[Int,T] with collection.mutable.MapLike[Int,T,SparseArray[T]] { override def get(x: Int) = { val ind = findOffset(x) if(ind < 0) None else Some(error("ignore")) @@ -21,4 +22,4 @@ class SparseArray[@specialized(Int) T:ArrayTag] extends collection.mutable.Map[I def -=(ind: Int) = error("ignore") def +=(kv: (Int,T)) = error("ignore") override final def iterator = error("ignore") -} +}
\ No newline at end of file diff --git a/test/files/pos/t1381-new.scala b/test/files/pos/t1381-new.scala index 8781ef4fdb..57e0f31fba 100644 --- a/test/files/pos/t1381-new.scala +++ b/test/files/pos/t1381-new.scala @@ -1,4 +1,4 @@ -import scala.reflect.TypeTag +import scala.reflect.runtime.universe._ class D[V <: Variable] @@ -28,4 +28,4 @@ abstract class EV[T](initval:T) extends PV[T](initval) with IV { override def d : ID[VT] = null // Comment this out to eliminate crash protected var indx = d.index(initval) -} +}
\ No newline at end of file diff --git a/test/files/pos/t2795-new.scala b/test/files/pos/t2795-new.scala index af9c4e8b1c..a6a5fdb127 100644 --- a/test/files/pos/t2795-new.scala +++ b/test/files/pos/t2795-new.scala @@ -1,11 +1,13 @@ package t1 +import scala.reflect.{ClassTag, classTag} + trait Element[T] { } trait Config { type T <: Element[T] - implicit val m: ArrayTag[T] + implicit val m: ClassTag[T] // XXX Following works fine: // type T <: Element[_] } @@ -14,4 +16,4 @@ trait Transform { self: Config => def processBlock(block: Array[T]): Unit = { var X = new Array[T](1) } -} +}
\ No newline at end of file diff --git a/test/files/pos/t3363-new.scala b/test/files/pos/t3363-new.scala index 270462745c..e609f4d55f 100644 --- a/test/files/pos/t3363-new.scala +++ b/test/files/pos/t3363-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + object TestCase { //now matter if you put (abstract) class or trait it will fail in all cases @@ -15,4 +17,4 @@ object TestCase { println(Map(1 -> "2") is List(2)) } - } + }
\ No newline at end of file diff --git a/test/files/pos/t3498-new.scala b/test/files/pos/t3498-new.scala index 653c50042a..eaf00cc351 100644 --- a/test/files/pos/t3498-new.scala +++ b/test/files/pos/t3498-new.scala @@ -1,4 +1,6 @@ -abstract class A[T, @specialized(scala.Int) U : ArrayTag] { +import scala.reflect.{ClassTag, classTag} + +abstract class A[T, @specialized(scala.Int) U : ClassTag] { def f(state: T): Array[U] } diff --git a/test/files/pos/t5223.scala b/test/files/pos/t5223.scala index 398630dc61..0b2528e367 100644 --- a/test/files/pos/t5223.scala +++ b/test/files/pos/t5223.scala @@ -1,6 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Foo extends App { reify{def printf(format: String, args: Any*): String = null } reify{def printf(format: String, args: Any*): String = ("abc": @cloneable)} -} +}
\ No newline at end of file diff --git a/test/files/pos/t5305.scala b/test/files/pos/t5305.scala index 4c32cd7c6d..c0237ca3bd 100644 --- a/test/files/pos/t5305.scala +++ b/test/files/pos/t5305.scala @@ -7,7 +7,7 @@ object t5305 { } in { - import O.{F, v} + import O.{F, v} type x = {type l = (F, v.type)} // not found: type F } } diff --git a/test/files/pos/t531.scala b/test/files/pos/t531.scala index 5176912ef0..d53539f34f 100644 --- a/test/files/pos/t531.scala +++ b/test/files/pos/t531.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { def titi = { @@ -8,4 +8,4 @@ object Test extends App { }} () } -} +}
\ No newline at end of file diff --git a/test/files/pos/t532.scala b/test/files/pos/t532.scala index a319fdfa27..7c33637b5d 100644 --- a/test/files/pos/t532.scala +++ b/test/files/pos/t532.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { def titi: Unit = { @@ -8,4 +8,4 @@ object Test extends App { }} () } -} +}
\ No newline at end of file diff --git a/test/files/pos/t5769.scala b/test/files/pos/t5769.scala index 723d37bfee..fdc46b65e9 100644 --- a/test/files/pos/t5769.scala +++ b/test/files/pos/t5769.scala @@ -1,8 +1,9 @@ // a.scala +import scala.reflect.{ClassTag, classTag} class A { type AI = Array[Int] - def f1 = arrayTag[Array[Int]] - def f2 = arrayTag[AI] + def f1 = classTag[Array[Int]] + def f2 = classTag[AI] }
\ No newline at end of file diff --git a/test/files/pos/t5809.scala b/test/files/pos/t5809.scala index 8f6ce708d2..133e13c4ed 100644 --- a/test/files/pos/t5809.scala +++ b/test/files/pos/t5809.scala @@ -1,10 +1,5 @@ -package scala.reflect - -package object api { - implicit class PimpedExpr[T](expr: Universe # Expr[T]) { - def runtimeEval: T = { - println("hello, dear") - expr.eval - } +package object foo { + implicit class PimpedInt(foo: Int) { + def bar = ??? } }
\ No newline at end of file diff --git a/test/files/pos/t5862.scala b/test/files/pos/t5862.scala new file mode 100644 index 0000000000..e3006ddc3f --- /dev/null +++ b/test/files/pos/t5862.scala @@ -0,0 +1,38 @@ +package test + +import java.io.DataOutput +import java.io.DataInput + +/** Interface for writing outputs from a DoFn. */ +trait Emitter[A] { + def emit(value: A): Unit +} + +/** A wrapper for a 'map' function tagged for a specific output channel. */ +abstract class TaggedMapper[A, K, V] + (val tags: Set[Int]) + (implicit val mA: Manifest[A], val wtA: WireFormat[A], + val mK: Manifest[K], val wtK: WireFormat[K], val ordK: Ordering[K], + val mV: Manifest[V], val wtV: WireFormat[V]) + extends Serializable { +} + +/** Type-class for sending types across the Hadoop wire. */ +trait WireFormat[A] + +class MapReduceJob { + trait DataSource + + import scala.collection.mutable.{ Set => MSet, Map => MMap } + private val mappers: MMap[DataSource, MSet[TaggedMapper[_, _, _]]] = MMap.empty + + def addTaggedMapper[A, K, V](input: DataSource, m: TaggedMapper[A, K, V]): Unit = { + if (!mappers.contains(input)) + mappers += (input -> MSet(m)) + else + mappers(input) += m // : Unit + + m.tags.foreach { tag => + } + } +} diff --git a/test/files/pos/typetags.scala b/test/files/pos/typetags.scala new file mode 100644 index 0000000000..33390d7b89 --- /dev/null +++ b/test/files/pos/typetags.scala @@ -0,0 +1,12 @@ +import scala.reflect.{basis => rb} +import scala.reflect.runtime.{universe => ru} + +object Test { + def main(args: Array[String]) { + def foo(implicit t: rb.TypeTag[List[Int]]) { + println(t) + val t2: ru.TypeTag[_] = t in ru.rootMirror + println(t2) + } + } +} diff --git a/test/files/presentation/ide-bug-1000531.check b/test/files/presentation/ide-bug-1000531.check index dcbd440801..e813ce119b 100644 --- a/test/files/presentation/ide-bug-1000531.check +++ b/test/files/presentation/ide-bug-1000531.check @@ -97,7 +97,7 @@ retrieved 124 members [accessible: true] `method synchronized[T0](x$1: T0)T0` [accessible: true] `method take(n: Int)Iterator[B]` [accessible: true] `method takeWhile(p: B => Boolean)Iterator[B]` -[accessible: true] `method toArray[B >: B](implicit evidence$1: ArrayTag[B])Array[B]` +[accessible: true] `method toArray[B >: B](implicit evidence$1: scala.reflect.ClassTag[B])Array[B]` [accessible: true] `method toBuffer[B >: B]=> scala.collection.mutable.Buffer[B]` [accessible: true] `method toIndexedSeq=> scala.collection.immutable.IndexedSeq[B]` [accessible: true] `method toIterable=> Iterable[B]` diff --git a/test/files/presentation/memory-leaks/MemoryLeaksTest.scala b/test/files/presentation/memory-leaks/MemoryLeaksTest.scala index 45b38da85b..857beac7df 100644 --- a/test/files/presentation/memory-leaks/MemoryLeaksTest.scala +++ b/test/files/presentation/memory-leaks/MemoryLeaksTest.scala @@ -7,16 +7,16 @@ import scala.tools.nsc.util._ import scala.tools.nsc.io._ /** This test runs the presentation compiler on the Scala compiler project itself and records memory consumption. - * + * * The test scenario is to open Typers, Trees and Types, then repeatedly add and remove one character * in Typers.scala. Each step causes the parser, namer, and type checker to run. - * - * At each step we record the memory usage after the GC has run. At the end of the test, + * + * At each step we record the memory usage after the GC has run. At the end of the test, * simple linear regression is used to compute the straight line that best fits the * curve, and if the slope is higher than 1 (meaning a leak of 1MB/run), we fail the test. - * + * * The Scala compiler sources are assumed to be under 'basedir/src/compiler'. - * + * * The individual data points are saved under 'usedMem-<date>.txt', under the test project * directory. Use the cool graph-it.R (https://github.com/scala-ide/scala-ide/blob/master/org.scala-ide.sdt.core.tests/graph-it.R) * script to see the memory curve for the given test run. @@ -37,10 +37,10 @@ object Test extends InteractiveTest { val filename = "usedmem-%tF.txt".format(Calendar.getInstance.getTime) val typerUnit = AbstractFile.getFile(baseDir.parent.parent.parent.parent / "src/compiler/scala/tools/nsc/typechecker/Typers.scala") - val typesUnit = AbstractFile.getFile(baseDir.parent.parent.parent.parent / "src/compiler/scala/reflect/internal/Types.scala") - val treesUnit = AbstractFile.getFile(baseDir.parent.parent.parent.parent / "src/compiler/scala/reflect/internal/Trees.scala") + val typesUnit = AbstractFile.getFile(baseDir.parent.parent.parent.parent / "src/reflect/scala/reflect/internal/Types.scala") + val treesUnit = AbstractFile.getFile(baseDir.parent.parent.parent.parent / "src/reflect/scala/reflect/internal/Trees.scala") - askReload(Seq(new BatchSourceFile(typerUnit), new BatchSourceFile(typesUnit), new BatchSourceFile(treesUnit))) + askReload(Seq(new BatchSourceFile(typerUnit), new BatchSourceFile(typesUnit), new BatchSourceFile(treesUnit))) typeCheckWith(treesUnit, new String(treesUnit.toCharArray)) typeCheckWith(typesUnit, new String(typesUnit.toCharArray)) @@ -58,12 +58,12 @@ object Test extends InteractiveTest { usedMem / mega // report size in MB } - + //dumpDataToFile(filename, usedMem) // drop the first two measurements, since the compiler needs some memory when initializing val (a, b) = linearModel((3L to N).toSeq, usedMem.drop(2)) //println("LinearModel: constant: %.4f\tslope:%.4f".format(a, b)) - + if (b > 1.0) println("Rate of memory consumption is alarming! %.4f MB/run".format(b)) else @@ -84,33 +84,33 @@ object Test extends InteractiveTest { } outputFile.close() } - - - /** Return the linear model of these values, (a, b). First value is the constant factor, + + + /** Return the linear model of these values, (a, b). First value is the constant factor, * second value is the slope, i.e. `y = a + bx` - * - * The linear model of a set of points is a straight line that minimizes the square distance + * + * The linear model of a set of points is a straight line that minimizes the square distance * between the each point and the line. - * + * * See: http://en.wikipedia.org/wiki/Simple_linear_regression */ def linearModel(xs: Seq[Long], ys: Seq[Long]): (Double, Double) = { require(xs.length == ys.length) - + def mean(v: Seq[Long]): Double = v.sum.toDouble / v.length - + val meanXs = mean(xs) val meanYs = mean(ys) - + val beta = (mean((xs, ys).zipped.map(_ * _)) - meanXs * meanYs) / (mean(xs.map(x => x * x)) - meanXs * meanXs) val alfa = meanYs - beta * meanXs - + (alfa, beta) } /** Run the given closure and return the amount of used memory at the end of its execution. - * - * Runs the GC before and after the execution of `f'. + * + * Runs the GC before and after the execution of `f'. */ def withGC(f: => Unit): Long = { val r = Runtime.getRuntime diff --git a/test/files/run/abstypetags_core.check b/test/files/run/abstypetags_core.check new file mode 100644 index 0000000000..55c8cb7e89 --- /dev/null +++ b/test/files/run/abstypetags_core.check @@ -0,0 +1,28 @@ +true +TypeTag[Byte] +true +TypeTag[Short] +true +TypeTag[Char] +true +TypeTag[Int] +true +TypeTag[Long] +true +TypeTag[Float] +true +TypeTag[Double] +true +TypeTag[Boolean] +true +TypeTag[Unit] +true +TypeTag[Any] +true +TypeTag[java.lang.Object] +true +TypeTag[Null] +true +TypeTag[Nothing] +true +TypeTag[java.lang.String] diff --git a/test/files/run/abstypetags_core.scala b/test/files/run/abstypetags_core.scala new file mode 100644 index 0000000000..a49817f4d4 --- /dev/null +++ b/test/files/run/abstypetags_core.scala @@ -0,0 +1,32 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + println(implicitly[AbsTypeTag[Byte]] eq AbsTypeTag.Byte) + println(implicitly[AbsTypeTag[Byte]]) + println(implicitly[AbsTypeTag[Short]] eq AbsTypeTag.Short) + println(implicitly[AbsTypeTag[Short]]) + println(implicitly[AbsTypeTag[Char]] eq AbsTypeTag.Char) + println(implicitly[AbsTypeTag[Char]]) + println(implicitly[AbsTypeTag[Int]] eq AbsTypeTag.Int) + println(implicitly[AbsTypeTag[Int]]) + println(implicitly[AbsTypeTag[Long]] eq AbsTypeTag.Long) + println(implicitly[AbsTypeTag[Long]]) + println(implicitly[AbsTypeTag[Float]] eq AbsTypeTag.Float) + println(implicitly[AbsTypeTag[Float]]) + println(implicitly[AbsTypeTag[Double]] eq AbsTypeTag.Double) + println(implicitly[AbsTypeTag[Double]]) + println(implicitly[AbsTypeTag[Boolean]] eq AbsTypeTag.Boolean) + println(implicitly[AbsTypeTag[Boolean]]) + println(implicitly[AbsTypeTag[Unit]] eq AbsTypeTag.Unit) + println(implicitly[AbsTypeTag[Unit]]) + println(implicitly[AbsTypeTag[Any]] eq AbsTypeTag.Any) + println(implicitly[AbsTypeTag[Any]]) + println(implicitly[AbsTypeTag[Object]] eq AbsTypeTag.Object) + println(implicitly[AbsTypeTag[Object]]) + println(implicitly[AbsTypeTag[Null]] eq AbsTypeTag.Null) + println(implicitly[AbsTypeTag[Null]]) + println(implicitly[AbsTypeTag[Nothing]] eq AbsTypeTag.Nothing) + println(implicitly[AbsTypeTag[Nothing]]) + println(implicitly[AbsTypeTag[String]] eq AbsTypeTag.String) + println(implicitly[AbsTypeTag[String]]) +}
\ No newline at end of file diff --git a/test/files/run/arrayclone-new.scala b/test/files/run/arrayclone-new.scala index a4ba021409..506e4f527c 100644 --- a/test/files/run/arrayclone-new.scala +++ b/test/files/run/arrayclone-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ClassTag, classTag} + object Test extends App{ BooleanArrayClone; ByteArrayClone; @@ -93,7 +95,7 @@ object PolymorphicArrayClone{ testIt(Array("one", "two"), "one", "two"); - class Mangler[T: ArrayTag](ts : T*){ + class Mangler[T: ClassTag](ts : T*){ // this will always be a BoxedAnyArray even after we've unboxed its contents. val it = ts.toArray[T]; } @@ -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.check b/test/files/run/arraytags_basic.check deleted file mode 100644 index 92816b91bd..0000000000 --- a/test/files/run/arraytags_basic.check +++ /dev/null @@ -1,36 +0,0 @@ -class [I
-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.List;
-class [[[Lscala.collection.immutable.List;
-class [Lscala.collection.immutable.Map;
-class [[Lscala.collection.immutable.Map;
-class [[[Lscala.collection.immutable.Map;
-class [[I
-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.List;
-class [[[[Lscala.collection.immutable.List;
-class [[Lscala.collection.immutable.Map;
-class [[[Lscala.collection.immutable.Map;
-class [[[[Lscala.collection.immutable.Map;
-class [[[I
-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.List;
-class [[[[[Lscala.collection.immutable.List;
-class [[[Lscala.collection.immutable.Map;
-class [[[[Lscala.collection.immutable.Map;
-class [[[[[Lscala.collection.immutable.Map;
diff --git a/test/files/run/arraytags_basic.scala b/test/files/run/arraytags_basic.scala deleted file mode 100644 index edc20e9bc1..0000000000 --- a/test/files/run/arraytags_basic.scala +++ /dev/null @@ -1,22 +0,0 @@ -object Test extends App { - def test[T: ArrayTag] = { - println(implicitly[ArrayTag[T]].newArray(10).getClass) - println(implicitly[ArrayTag[T]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[Array[T]]].wrap.newArray(10).getClass) - } - - 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/arraytags_core.check b/test/files/run/arraytags_core.check deleted file mode 100644 index 82ed84ad78..0000000000 --- a/test/files/run/arraytags_core.check +++ /dev/null @@ -1,48 +0,0 @@ -class [B
-class [[B
-class [[[B
-class [S
-class [[S
-class [[[S
-class [C
-class [[C
-class [[[C
-class [I
-class [[I
-class [[[I
-class [J
-class [[J
-class [[[J
-class [F
-class [[F
-class [[[F
-class [D
-class [[D
-class [[[D
-class [Z
-class [[Z
-class [[[Z
-class [Lscala.runtime.BoxedUnit;
-class [[Lscala.runtime.BoxedUnit;
-class [[[Lscala.runtime.BoxedUnit;
-class [Ljava.lang.Object;
-class [[Ljava.lang.Object;
-class [[[Ljava.lang.Object;
-class [Ljava.lang.Object;
-class [[Ljava.lang.Object;
-class [[[Ljava.lang.Object;
-class [Ljava.lang.Object;
-class [[Ljava.lang.Object;
-class [[[Ljava.lang.Object;
-class [Ljava.lang.Object;
-class [[Ljava.lang.Object;
-class [[[Ljava.lang.Object;
-class [Lscala.runtime.Null$;
-class [[Lscala.runtime.Null$;
-class [[[Lscala.runtime.Null$;
-class [Lscala.runtime.Nothing$;
-class [[Lscala.runtime.Nothing$;
-class [[[Lscala.runtime.Nothing$;
-class [Ljava.lang.String;
-class [[Ljava.lang.String;
-class [[[Ljava.lang.String;
diff --git a/test/files/run/arraytags_core.scala b/test/files/run/arraytags_core.scala deleted file mode 100644 index a59ae24f30..0000000000 --- a/test/files/run/arraytags_core.scala +++ /dev/null @@ -1,50 +0,0 @@ -object Test extends App { - println(implicitly[ArrayTag[Byte]].newArray(10).getClass) - println(implicitly[ArrayTag[Byte]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[Array[Byte]]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[Short]].newArray(10).getClass) - println(implicitly[ArrayTag[Short]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[Array[Short]]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[Char]].newArray(10).getClass) - println(implicitly[ArrayTag[Char]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[Array[Char]]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[Int]].newArray(10).getClass) - println(implicitly[ArrayTag[Int]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[Array[Int]]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[Long]].newArray(10).getClass) - println(implicitly[ArrayTag[Long]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[Array[Long]]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[Float]].newArray(10).getClass) - println(implicitly[ArrayTag[Float]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[Array[Float]]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[Double]].newArray(10).getClass) - println(implicitly[ArrayTag[Double]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[Array[Double]]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[Boolean]].newArray(10).getClass) - println(implicitly[ArrayTag[Boolean]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[Array[Boolean]]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[Unit]].newArray(10).getClass) - println(implicitly[ArrayTag[Unit]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[Array[Unit]]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[Any]].newArray(10).getClass) - println(implicitly[ArrayTag[Any]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[Array[Any]]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[Object]].newArray(10).getClass) - println(implicitly[ArrayTag[Object]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[Array[Object]]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[AnyVal]].newArray(10).getClass) - println(implicitly[ArrayTag[AnyVal]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[Array[AnyVal]]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[AnyRef]].newArray(10).getClass) - println(implicitly[ArrayTag[AnyRef]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[Array[AnyRef]]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[Null]].newArray(10).getClass) - println(implicitly[ArrayTag[Null]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[Array[Null]]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[Nothing]].newArray(10).getClass) - println(implicitly[ArrayTag[Nothing]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[Array[Nothing]]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[String]].newArray(10).getClass) - println(implicitly[ArrayTag[String]].wrap.newArray(10).getClass) - println(implicitly[ArrayTag[Array[String]]].wrap.newArray(10).getClass) -}
\ No newline at end of file diff --git a/test/files/run/arraytags_usage.check b/test/files/run/arraytags_usage.check deleted file mode 100644 index b1d02b7bfe..0000000000 --- a/test/files/run/arraytags_usage.check +++ /dev/null @@ -1,3 +0,0 @@ -class [I
-class [I
-class [I
diff --git a/test/files/run/arraytags_usage.scala b/test/files/run/arraytags_usage.scala deleted file mode 100644 index 60b0a8f218..0000000000 --- a/test/files/run/arraytags_usage.scala +++ /dev/null @@ -1,15 +0,0 @@ -object Test extends App { - def foo[T] = { - class MyArrayTag extends ArrayTag[T] { - def wrap: ArrayTag[Array[T]] = ??? - def newArray(len: Int): Array[T] = new Array[Int](len).asInstanceOf[Array[T]] - } - - implicit val tag = new MyArrayTag() - println(Array[T]().getClass) - } - - foo[Int] - foo[String] - foo[Array[String]] -}
\ No newline at end of file diff --git a/test/files/run/caseClassHash.scala b/test/files/run/caseClassHash.scala index 7adfddedf8..c5cb09c355 100644 --- a/test/files/run/caseClassHash.scala +++ b/test/files/run/caseClassHash.scala @@ -11,8 +11,8 @@ object Test { println("## method 1: " + foo1.##) println("## method 2: " + foo2.##) - println(" Murmur 1: " + scala.util.MurmurHash3.productHash(foo1)) - println(" Murmur 2: " + scala.util.MurmurHash3.productHash(foo2)) + println(" Murmur 1: " + scala.util.hashing.MurmurHash3.productHash(foo1)) + println(" Murmur 2: " + scala.util.hashing.MurmurHash3.productHash(foo2)) } } 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..d042e0900d 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
+TypeTag[Byte]
+true
+TypeTag[Short]
+true
+TypeTag[Char]
+true
+TypeTag[Int]
+true
+TypeTag[Long]
+true
+TypeTag[Float]
+true
+TypeTag[Double]
+true
+TypeTag[Boolean]
+true
+TypeTag[Unit]
+true
+TypeTag[Any]
+true
+TypeTag[java.lang.Object]
+true
+TypeTag[Null]
+true
+TypeTag[Nothing]
+true
+TypeTag[java.lang.String]
diff --git a/test/files/run/concretetypetags_core.scala b/test/files/run/concretetypetags_core.scala index b6cfea3895..a870f77c5f 100644 --- a/test/files/run/concretetypetags_core.scala +++ b/test/files/run/concretetypetags_core.scala @@ -1,34 +1,32 @@ +import scala.reflect.runtime.universe._ + object Test extends App { - println(implicitly[ConcreteTypeTag[Byte]] eq ConcreteTypeTag.Byte) - println(implicitly[ConcreteTypeTag[Byte]]) - println(implicitly[ConcreteTypeTag[Short]] eq ConcreteTypeTag.Short) - println(implicitly[ConcreteTypeTag[Short]]) - println(implicitly[ConcreteTypeTag[Char]] eq ConcreteTypeTag.Char) - println(implicitly[ConcreteTypeTag[Char]]) - println(implicitly[ConcreteTypeTag[Int]] eq ConcreteTypeTag.Int) - println(implicitly[ConcreteTypeTag[Int]]) - println(implicitly[ConcreteTypeTag[Long]] eq ConcreteTypeTag.Long) - println(implicitly[ConcreteTypeTag[Long]]) - println(implicitly[ConcreteTypeTag[Float]] eq ConcreteTypeTag.Float) - println(implicitly[ConcreteTypeTag[Float]]) - println(implicitly[ConcreteTypeTag[Double]] eq ConcreteTypeTag.Double) - println(implicitly[ConcreteTypeTag[Double]]) - println(implicitly[ConcreteTypeTag[Boolean]] eq ConcreteTypeTag.Boolean) - println(implicitly[ConcreteTypeTag[Boolean]]) - println(implicitly[ConcreteTypeTag[Unit]] eq ConcreteTypeTag.Unit) - println(implicitly[ConcreteTypeTag[Unit]]) - println(implicitly[ConcreteTypeTag[Any]] eq ConcreteTypeTag.Any) - 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) - println(implicitly[ConcreteTypeTag[Nothing]]) - println(implicitly[ConcreteTypeTag[String]] eq ConcreteTypeTag.String) - println(implicitly[ConcreteTypeTag[String]]) + println(implicitly[TypeTag[Byte]] eq TypeTag.Byte) + println(implicitly[TypeTag[Byte]]) + println(implicitly[TypeTag[Short]] eq TypeTag.Short) + println(implicitly[TypeTag[Short]]) + println(implicitly[TypeTag[Char]] eq TypeTag.Char) + println(implicitly[TypeTag[Char]]) + println(implicitly[TypeTag[Int]] eq TypeTag.Int) + println(implicitly[TypeTag[Int]]) + println(implicitly[TypeTag[Long]] eq TypeTag.Long) + println(implicitly[TypeTag[Long]]) + println(implicitly[TypeTag[Float]] eq TypeTag.Float) + println(implicitly[TypeTag[Float]]) + println(implicitly[TypeTag[Double]] eq TypeTag.Double) + println(implicitly[TypeTag[Double]]) + println(implicitly[TypeTag[Boolean]] eq TypeTag.Boolean) + println(implicitly[TypeTag[Boolean]]) + println(implicitly[TypeTag[Unit]] eq TypeTag.Unit) + println(implicitly[TypeTag[Unit]]) + println(implicitly[TypeTag[Any]] eq TypeTag.Any) + println(implicitly[TypeTag[Any]]) + println(implicitly[TypeTag[Object]] eq TypeTag.Object) + println(implicitly[TypeTag[Object]]) + println(implicitly[TypeTag[Null]] eq TypeTag.Null) + println(implicitly[TypeTag[Null]]) + println(implicitly[TypeTag[Nothing]] eq TypeTag.Nothing) + println(implicitly[TypeTag[Nothing]]) + println(implicitly[TypeTag[String]] eq TypeTag.String) + println(implicitly[TypeTag[String]]) }
\ No newline at end of file diff --git a/test/files/run/concretetypetags_multi.check b/test/files/run/concretetypetags_multi.check index 613106985c..6110252c36 100644 --- a/test/files/run/concretetypetags_multi.check +++ b/test/files/run/concretetypetags_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]]]]]
+TypeTag[Int] +TypeTag[Array[Int]] +TypeTag[Array[Array[Int]]] +TypeTag[Array[Array[Array[Int]]]] +TypeTag[Array[Array[Array[Array[Int]]]]] diff --git a/test/files/run/concretetypetags_multi.scala b/test/files/run/concretetypetags_multi.scala index 7e19d7db34..b30aac80a6 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[TypeTag[Int]]) + println(implicitly[TypeTag[Array[Int]]]) + println(implicitly[TypeTag[Array[Array[Int]]]]) + println(implicitly[TypeTag[Array[Array[Array[Int]]]]]) + println(implicitly[TypeTag[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/dynamic-proxy.check b/test/files/run/dynamic-proxy.check deleted file mode 100644 index d1b85daff4..0000000000 --- a/test/files/run/dynamic-proxy.check +++ /dev/null @@ -1,20 +0,0 @@ -noargs -noargs -nullary -value -symbolic -symbolic with args -non-existent method -before mutation -mutation 1 -after mutation 1 -mutation 2 -after mutation 2 -overloaded with object -overloaded with primitive -overloaded with object in var -overloaded with object in var 2 -typeArgs: I am a car -default: 4 -default: 3 -named: 6 diff --git a/test/files/run/dynamic-proxy.flags b/test/files/run/dynamic-proxy.flags deleted file mode 100644 index 48fd867160..0000000000 --- a/test/files/run/dynamic-proxy.flags +++ /dev/null @@ -1 +0,0 @@ --Xexperimental diff --git a/test/files/run/dynamic-proxy.scala b/test/files/run/dynamic-proxy.scala deleted file mode 100644 index ab5a8b1d66..0000000000 --- a/test/files/run/dynamic-proxy.scala +++ /dev/null @@ -1,72 +0,0 @@ -import scala.reflect._ - -class Car{ override def toString = "I am a car" } -object x{ - def nullary = "nullary" - def noargs() = "noargs" - def - = "symbolic" - def $(s:String) = "symbolic with args" - val value = "value" - def overloaded(i:Int) = "overloaded with primitive" - def overloaded(s:String) = s - def default( a:Int, b:Int = 2 ) = "default: "+(a+b) - def named( a:Int, b:Int, c:Int ) = "named: "+(a+b+c) - def typeArgs[T]( v:T ) = "typeArgs: "+v - var mutable = "before mutation" - def multiArgLists( a:String )( b:String ) = "multiArgList " + a + b - def bar( s:String )(implicit car:Car) = s + car.toString -} - -object Test extends App{ - val d = new DynamicProxy{ val dynamicProxyTarget = x } - - println( d.noargs ) - println( d.noargs() ) - println( d.nullary ) - println( d.value ) - println( d.- ) - println( d.$("x") ) - - try{ - println( d.test ) - } catch { - case _ => println("non-existent method") - } - - println( d.mutable ) - - println("mutation 1") - d.mutable_=("after mutation 1") - println( d.mutable ) - - println("mutation 2") - d.mutable = "after mutation 2" - println( d.mutable ) - - println( d.overloaded("overloaded with object") ) - println( d.overloaded(1) ) - - // test some non-constant arguments - def s = "overloaded with object in var" - println( d.overloaded(s) ) - println( d.overloaded(s + " 2") ) - - val car = new Car - println( d.typeArgs(car) ) // inferred - // println( d.typeArgs[Car](car) ) // explicit not working (yet) - - println( d.default( 1,3 ) ) - println( d.default( 1 ) ) - - println( d.named(1,c=3,b=2) ) // applyDynamicNamed seems to be broken - - // println( d.multiArgLists("a")("b") ) // not working yet - - /* - // may never work - // testing implicit parameters (first test works when moving x into TestDynamicReflect) - implicit val car2 = new Car - println( d.bar( "Yeah, ") ); // FAILS: could not find implicit value for parameter car - {println( d.bar( "Yeah, ") )} // FAILS: could not find implicit value for parameter car - */ -} 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..649fac8327 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: TypeTag](x: T) = printTpe(typeOf[T]) + def m2[T: AbsTypeTag](x: T) = printTpe(implicitly[AbsTypeTag[T]].tpe) // 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_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.check b/test/files/run/interop_classtags_are_classmanifests.check index 02393dff23..c59e92d4eb 100644 --- a/test/files/run/interop_classtags_are_classmanifests.check +++ b/test/files/run/interop_classtags_are_classmanifests.check @@ -1,6 +1,3 @@ Int
java.lang.String
Array[Int]
-Int
-java.lang.String
-Array[Int]
diff --git a/test/files/run/interop_classtags_are_classmanifests.scala b/test/files/run/interop_classtags_are_classmanifests.scala index 309c99a3f5..91b9d89c6e 100644 --- a/test/files/run/interop_classtags_are_classmanifests.scala +++ b/test/files/run/interop_classtags_are_classmanifests.scala @@ -1,12 +1,6 @@ -object Test extends App { - def arrayTagIsClassManifest[T: ArrayTag] = { - println(classManifest[T]) - } - - arrayTagIsClassManifest[Int] - arrayTagIsClassManifest[String] - arrayTagIsClassManifest[Array[Int]] +import scala.reflect.{ClassTag, classTag} +object Test extends App { def classTagIsClassManifest[T: ClassTag] = { println(classManifest[T]) } 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.scala b/test/files/run/interop_concretetypetags_are_manifests.scala deleted file mode 100644 index 731410bc10..0000000000 --- a/test/files/run/interop_concretetypetags_are_manifests.scala +++ /dev/null @@ -1,9 +0,0 @@ -object Test extends App { - def concreteTypeTagIsManifest[T: ConcreteTypeTag] = { - println(manifest[T]) - } - - concreteTypeTagIsManifest[Int] - concreteTypeTagIsManifest[String] - concreteTypeTagIsManifest[Array[Int]] -}
\ No newline at end of file diff --git a/test/files/run/interop_concretetypetags_are_classmanifests.check b/test/files/run/interop_manifests_are_abstypetags.check index c59e92d4eb..c59e92d4eb 100644 --- a/test/files/run/interop_concretetypetags_are_classmanifests.check +++ b/test/files/run/interop_manifests_are_abstypetags.check diff --git a/test/files/run/interop_manifests_are_abstypetags.scala b/test/files/run/interop_manifests_are_abstypetags.scala new file mode 100644 index 0000000000..1cba2fdb4b --- /dev/null +++ b/test/files/run/interop_manifests_are_abstypetags.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + def manifestIsAbsTypeTag[T: Manifest] = { + println(implicitly[AbsTypeTag[T]].tpe) + } + + manifestIsAbsTypeTag[Int] + manifestIsAbsTypeTag[String] + manifestIsAbsTypeTag[Array[Int]] +}
\ No newline at end of file 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..03479e527a 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.{ClassTag, classTag} + object Test extends App { def classManifestIsClassTag[T: ClassManifest] = { - println(arrayTag[T]) - println(erasureTag[T]) + println(classTag[T]) println(Array[T]().toList) println(new Array[T](5).toList) } @@ -11,8 +12,7 @@ object Test extends App { classManifestIsClassTag[Array[Int]] def manifestIsClassTag[T: Manifest] = { - println(arrayTag[T]) - println(erasureTag[T]) + println(classTag[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 deleted file mode 100644 index edab85ecf1..0000000000 --- a/test/files/run/interop_manifests_are_concretetypetags.check +++ /dev/null @@ -1,6 +0,0 @@ -Int -int -String -class java.lang.String -Array[Int] -class [I diff --git a/test/files/run/interop_manifests_are_concretetypetags.scala b/test/files/run/interop_manifests_are_concretetypetags.scala deleted file mode 100644 index 0b82a56d0a..0000000000 --- a/test/files/run/interop_manifests_are_concretetypetags.scala +++ /dev/null @@ -1,10 +0,0 @@ -object Test extends App { - def manifestIsConcreteTypeTag[T: Manifest] = { - println(concreteTypeTag[T].tpe) - println(concreteTypeTag[T].erasure) - } - - manifestIsConcreteTypeTag[Int] - manifestIsConcreteTypeTag[String] - manifestIsConcreteTypeTag[Array[Int]] -}
\ No newline at end of file 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/interop_concretetypetags_are_manifests.check b/test/files/run/interop_typetags_are_manifests.check index c59e92d4eb..871167e3ab 100644 --- a/test/files/run/interop_concretetypetags_are_manifests.check +++ b/test/files/run/interop_typetags_are_manifests.check @@ -1,3 +1,3 @@ -Int
+int
java.lang.String
Array[Int]
diff --git a/test/files/run/interop_typetags_are_manifests.scala b/test/files/run/interop_typetags_are_manifests.scala new file mode 100644 index 0000000000..1aca7f52cc --- /dev/null +++ b/test/files/run/interop_typetags_are_manifests.scala @@ -0,0 +1,12 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.ClassTag + +object Test extends App { + def typeTagIsManifest[T: TypeTag : ClassTag] = { + println(manifest[T]) + } + + typeTagIsManifest[Int] + typeTagIsManifest[String] + typeTagIsManifest[Array[Int]] +}
\ No newline at end of file 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.check b/test/files/run/macro-expand-nullary-generic.check index 6dfe04af12..0895c30c3f 100644 --- a/test/files/run/macro-expand-nullary-generic.check +++ b/test/files/run/macro-expand-nullary-generic.check @@ -1,6 +1,6 @@ -it works ConcreteTypeTag[Int]
-it works ConcreteTypeTag[Int]
-it works ConcreteTypeTag[Int]
-it works ConcreteTypeTag[Int]
-it works ConcreteTypeTag[Int]
+it works TypeTag[Int]
+it works TypeTag[Int]
+it works TypeTag[Int]
+it works TypeTag[Int]
+it works TypeTag[Int]
kkthxbai
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.check b/test/files/run/macro-expand-tparams-explicit.check index 5670e27c4e..19e6d39bc8 100644 --- a/test/files/run/macro-expand-tparams-explicit.check +++ b/test/files/run/macro-expand-tparams-explicit.check @@ -1 +1 @@ -ConcreteTypeTag[Int]
+TypeTag[Int]
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.check b/test/files/run/macro-expand-tparams-implicit.check index e57fc1217b..80c6b826ba 100644 --- a/test/files/run/macro-expand-tparams-implicit.check +++ b/test/files/run/macro-expand-tparams-implicit.check @@ -1,2 +1,2 @@ -ConcreteTypeTag[Int]
-ConcreteTypeTag[String]
+TypeTag[Int]
+TypeTag[String]
diff --git a/test/files/run/macro-expand-tparams-implicit/Impls_1.scala b/test/files/run/macro-expand-tparams-implicit/Impls_1.scala index 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.check b/test/files/run/macro-expand-tparams-prefix-a.check index 922be1a6dd..6c23b47d64 100644 --- a/test/files/run/macro-expand-tparams-prefix-a.check +++ b/test/files/run/macro-expand-tparams-prefix-a.check @@ -1,4 +1,4 @@ -ConcreteTypeTag[Int]
-ConcreteTypeTag[Int]
-ConcreteTypeTag[String]
-ConcreteTypeTag[Boolean]
+TypeTag[Int]
+TypeTag[Int]
+TypeTag[String]
+TypeTag[Boolean]
diff --git a/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala index 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.check b/test/files/run/macro-expand-tparams-prefix-b.check index a336bb51ec..67dabff11e 100644 --- a/test/files/run/macro-expand-tparams-prefix-b.check +++ b/test/files/run/macro-expand-tparams-prefix-b.check @@ -1,2 +1,2 @@ -ConcreteTypeTag[Boolean] ConcreteTypeTag[Int]
-ConcreteTypeTag[Boolean] ConcreteTypeTag[String]
+TypeTag[Boolean] TypeTag[Int]
+TypeTag[Boolean] TypeTag[String]
diff --git a/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala index 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.check b/test/files/run/macro-expand-tparams-prefix-c1.check index 87f295aa49..8d1c4e3416 100644 --- a/test/files/run/macro-expand-tparams-prefix-c1.check +++ b/test/files/run/macro-expand-tparams-prefix-c1.check @@ -1,3 +1,3 @@ -ConcreteTypeTag[Int]
-ConcreteTypeTag[String]
-ConcreteTypeTag[Boolean]
+TypeTag[Int]
+TypeTag[String]
+TypeTag[Boolean]
diff --git a/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala index 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.check b/test/files/run/macro-expand-tparams-prefix-c2.check index 87f295aa49..8d1c4e3416 100644 --- a/test/files/run/macro-expand-tparams-prefix-c2.check +++ b/test/files/run/macro-expand-tparams-prefix-c2.check @@ -1,3 +1,3 @@ -ConcreteTypeTag[Int]
-ConcreteTypeTag[String]
-ConcreteTypeTag[Boolean]
+TypeTag[Int]
+TypeTag[String]
+TypeTag[Boolean]
diff --git a/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala b/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala index 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.check b/test/files/run/macro-expand-tparams-prefix-d1.check index ca7a220475..319edfbed0 100644 --- a/test/files/run/macro-expand-tparams-prefix-d1.check +++ b/test/files/run/macro-expand-tparams-prefix-d1.check @@ -1,3 +1,3 @@ -TypeTag[T]
-TypeTag[U]
-ConcreteTypeTag[Boolean]
+AbsTypeTag[T]
+AbsTypeTag[U]
+TypeTag[Boolean]
diff --git a/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala index 4da5a9b823..f497e5f7a9 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( + def foo[T, U: c.AbsTypeTag, V](c: Ctx)(implicit T: c.AbsTypeTag[T], V: c.AbsTypeTag[V]): c.Expr[Unit] = { + import c.universe._ + c.Expr(Block(List( Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.TypeTag[U]].toString)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.AbsTypeTag[U]].toString)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(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-with-tparams.check b/test/files/run/macro-invalidusage-partialapplication-with-tparams.check new file mode 100644 index 0000000000..73f57b0b81 --- /dev/null +++ b/test/files/run/macro-invalidusage-partialapplication-with-tparams.check @@ -0,0 +1,3 @@ +reflective compilation has failed:
+
+macros cannot be partially applied
diff --git a/test/files/run/macro-reify-eval-eval.flags b/test/files/run/macro-invalidusage-partialapplication-with-tparams.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-reify-eval-eval.flags +++ b/test/files/run/macro-invalidusage-partialapplication-with-tparams.flags diff --git a/test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala b/test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala new file mode 100644 index 0000000000..67a19a6d62 --- /dev/null +++ b/test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala @@ -0,0 +1,13 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo[T: c.TypeTag](c: Ctx)(x: c.Expr[T]) = { + import c.universe._ + val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(x.tree.toString)))) + c.Expr[Unit](body) + } +} + +object Macros { + def foo[T](x: T) = macro Impls.foo[T] +}
\ No newline at end of file diff --git a/test/files/run/macro-invalidusage-partialapplication-with-tparams/Test_2.scala b/test/files/run/macro-invalidusage-partialapplication-with-tparams/Test_2.scala new file mode 100644 index 0000000000..f51cc7e699 --- /dev/null +++ b/test/files/run/macro-invalidusage-partialapplication-with-tparams/Test_2.scala @@ -0,0 +1,8 @@ +object Test extends App { + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox + val tree = Select(Ident("Macros"), newTermName("foo")) + try cm.mkToolBox().runExpr(tree) + catch { case ex: Throwable => println(ex.getMessage) } +} 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-abstypetag-notypeparams.check b/test/files/run/macro-reify-abstypetag-notypeparams.check new file mode 100644 index 0000000000..aadd713bef --- /dev/null +++ b/test/files/run/macro-reify-abstypetag-notypeparams.check @@ -0,0 +1,2 @@ +TypeTag[Int]
+TypeTag[List[Int]]
diff --git a/test/files/run/macro-reify-abstypetag-notypeparams/Test.scala b/test/files/run/macro-reify-abstypetag-notypeparams/Test.scala new file mode 100644 index 0000000000..34f742b9fb --- /dev/null +++ b/test/files/run/macro-reify-abstypetag-notypeparams/Test.scala @@ -0,0 +1,6 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + println(implicitly[AbsTypeTag[Int]]) + println(implicitly[AbsTypeTag[List[Int]]]) +}
\ No newline at end of file diff --git a/test/files/run/macro-reify-abstypetag-typeparams-notags.check b/test/files/run/macro-reify-abstypetag-typeparams-notags.check new file mode 100644 index 0000000000..be62b59a69 --- /dev/null +++ b/test/files/run/macro-reify-abstypetag-typeparams-notags.check @@ -0,0 +1,2 @@ +AbsTypeTag[T]
+AbsTypeTag[List[T]]
diff --git a/test/files/run/macro-reify-abstypetag-typeparams-notags/Test.scala b/test/files/run/macro-reify-abstypetag-typeparams-notags/Test.scala new file mode 100644 index 0000000000..0b42cc07b5 --- /dev/null +++ b/test/files/run/macro-reify-abstypetag-typeparams-notags/Test.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + def fooNoTypeTag[T] = { + println(implicitly[AbsTypeTag[T]]) + println(implicitly[AbsTypeTag[List[T]]]) + } + fooNoTypeTag[Int] +}
\ No newline at end of file diff --git a/test/files/run/macro-reify-abstypetag-typeparams-tags.check b/test/files/run/macro-reify-abstypetag-typeparams-tags.check new file mode 100644 index 0000000000..d6ca5a85ef --- /dev/null +++ b/test/files/run/macro-reify-abstypetag-typeparams-tags.check @@ -0,0 +1,2 @@ +TypeTag[Int]
+AbsTypeTag[List[Int]]
diff --git a/test/files/run/macro-reify-abstypetag-typeparams-tags/Test.scala b/test/files/run/macro-reify-abstypetag-typeparams-tags/Test.scala new file mode 100644 index 0000000000..82a7b7971d --- /dev/null +++ b/test/files/run/macro-reify-abstypetag-typeparams-tags/Test.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + def fooTypeTag[T: AbsTypeTag] = { + println(implicitly[AbsTypeTag[T]]) + println(implicitly[AbsTypeTag[List[T]]]) + } + fooTypeTag[Int] +}
\ No newline at end of file diff --git a/test/files/run/macro-reify-abstypetag-usetypetag.check b/test/files/run/macro-reify-abstypetag-usetypetag.check new file mode 100644 index 0000000000..d6ca5a85ef --- /dev/null +++ b/test/files/run/macro-reify-abstypetag-usetypetag.check @@ -0,0 +1,2 @@ +TypeTag[Int]
+AbsTypeTag[List[Int]]
diff --git a/test/files/run/macro-reify-abstypetag-usetypetag/Test.scala b/test/files/run/macro-reify-abstypetag-usetypetag/Test.scala new file mode 100644 index 0000000000..3c62725c42 --- /dev/null +++ b/test/files/run/macro-reify-abstypetag-usetypetag/Test.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + def fooTypeTag[T: TypeTag] = { + println(implicitly[AbsTypeTag[T]]) + println(implicitly[AbsTypeTag[List[T]]]) + } + fooTypeTag[Int] +}
\ No newline at end of file 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.check b/test/files/run/macro-reify-groundtypetag-notypeparams.check deleted file mode 100644 index d75b3c72b2..0000000000 --- a/test/files/run/macro-reify-groundtypetag-notypeparams.check +++ /dev/null @@ -1,2 +0,0 @@ -ConcreteTypeTag[Int]
-ConcreteTypeTag[List[Int]]
diff --git a/test/files/run/macro-reify-groundtypetag-notypeparams/Test.scala b/test/files/run/macro-reify-groundtypetag-notypeparams/Test.scala deleted file mode 100644 index d2f8fab5ec..0000000000 --- a/test/files/run/macro-reify-groundtypetag-notypeparams/Test.scala +++ /dev/null @@ -1,6 +0,0 @@ -import scala.reflect.mirror._ - -object Test extends App { - println(implicitly[ConcreteTypeTag[Int]]) - println(implicitly[ConcreteTypeTag[List[Int]]]) -}
\ No newline at end of file diff --git a/test/files/run/macro-reify-groundtypetag-typeparams-tags.check b/test/files/run/macro-reify-groundtypetag-typeparams-tags.check deleted file mode 100644 index d75b3c72b2..0000000000 --- a/test/files/run/macro-reify-groundtypetag-typeparams-tags.check +++ /dev/null @@ -1,2 +0,0 @@ -ConcreteTypeTag[Int]
-ConcreteTypeTag[List[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 deleted file mode 100644 index 6d7eab5f9a..0000000000 --- a/test/files/run/macro-reify-groundtypetag-typeparams-tags/Test.scala +++ /dev/null @@ -1,9 +0,0 @@ -import scala.reflect.mirror._ - -object Test extends App { - def fooTypeTag[T: ConcreteTypeTag] = { - println(implicitly[ConcreteTypeTag[T]]) - println(implicitly[ConcreteTypeTag[List[T]]]) - } - fooTypeTag[Int] -}
\ No newline at end of file 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-outside-reify.flags b/test/files/run/macro-reify-splice-outside-reify.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-reify-eval-outside-reify.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-value-outside-reify.flags b/test/files/run/macro-reify-splice-splice.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-reify-value-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.check b/test/files/run/macro-reify-typetag-notypeparams.check index d75b3c72b2..aadd713bef 100644 --- a/test/files/run/macro-reify-typetag-notypeparams.check +++ b/test/files/run/macro-reify-typetag-notypeparams.check @@ -1,2 +1,2 @@ -ConcreteTypeTag[Int]
-ConcreteTypeTag[List[Int]]
+TypeTag[Int]
+TypeTag[List[Int]]
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.check b/test/files/run/macro-reify-typetag-typeparams-notags.check deleted file mode 100644 index 11d78ece41..0000000000 --- a/test/files/run/macro-reify-typetag-typeparams-notags.check +++ /dev/null @@ -1,2 +0,0 @@ -TypeTag[T]
-TypeTag[List[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..aadd713bef 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[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 deleted file mode 100644 index 458593c449..0000000000 --- a/test/files/run/macro-reify-typetag-usegroundtypetag.check +++ /dev/null @@ -1,2 +0,0 @@ -ConcreteTypeTag[Int]
-*ConcreteTypeTag[List[Int]]
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/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.check b/test/files/run/macro-undetparams-consfromsls.check index 49e9140d5a..4b83c55437 100644 --- a/test/files/run/macro-undetparams-consfromsls.check +++ b/test/files/run/macro-undetparams-consfromsls.check @@ -1,5 +1,5 @@ -A = ConcreteTypeTag[Int]
-B = ConcreteTypeTag[Nothing]
+A = TypeTag[Int]
+B = TypeTag[Nothing]
List(1)
-A = ConcreteTypeTag[Any]
+A = TypeTag[Any]
List(abc, 1)
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..b9bb2cfcca 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 + def cons_impl[A: c.AbsTypeTag](c: Context)(x: c.Expr[A], xs: c.Expr[List[A]]): c.Expr[List[A]] = c.reify { + println("A = " + c.literal(implicitly[c.AbsTypeTag[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) + def nil_impl[B: c.AbsTypeTag](c: Context): c.Expr[List[B]] = c.reify { + println("B = " + c.literal(implicitly[c.AbsTypeTag[B]].toString).splice) Nil } diff --git a/test/files/run/macro-undetparams-implicitval.check b/test/files/run/macro-undetparams-implicitval.check index 6c2b601aa5..30681fa40d 100644 --- a/test/files/run/macro-undetparams-implicitval.check +++ b/test/files/run/macro-undetparams-implicitval.check @@ -1 +1 @@ -ConcreteTypeTag[Nothing]
+TypeTag[Nothing]
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.check b/test/files/run/macro-undetparams-macroitself.check index e57fc1217b..80c6b826ba 100644 --- a/test/files/run/macro-undetparams-macroitself.check +++ b/test/files/run/macro-undetparams-macroitself.check @@ -1,2 +1,2 @@ -ConcreteTypeTag[Int]
-ConcreteTypeTag[String]
+TypeTag[Int]
+TypeTag[String]
diff --git a/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala b/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala index 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..d83740c40c --- /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]
+TypeTag[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/patmat_unapp_abstype-new.scala b/test/files/run/patmat_unapp_abstype-new.scala index 45496f08a2..1141177504 100644 --- a/test/files/run/patmat_unapp_abstype-new.scala +++ b/test/files/run/patmat_unapp_abstype-new.scala @@ -1,10 +1,10 @@ +import reflect.{ClassTag, classTag} + // abstract types and extractors, oh my! trait TypesAPI { trait Type - // an alternative fix (implemented in the virtual pattern matcher, is to replace the isInstanceOf by a manifest-based run-time test) - // that's what typeRefMani is for - type TypeRef <: Type //; implicit def typeRefMani: Manifest[TypeRef] + type TypeRef <: Type val TypeRef: TypeRefExtractor; trait TypeRefExtractor { def apply(x: Int): TypeRef def unapply(x: TypeRef): Option[(Int)] @@ -19,11 +19,6 @@ trait TypesUser extends TypesAPI { def shouldNotCrash(tp: Type): Unit = { tp match { case TypeRef(x) => println("TypeRef") - // the above checks tp.isInstanceOf[TypeRef], which is erased to tp.isInstanceOf[Type] - // before calling TypeRef.unapply(tp), which will then crash unless tp.isInstanceOf[TypesImpl#TypeRef] (which is not implied by tp.isInstanceOf[Type]) - // tp.isInstanceOf[TypesImpl#TypeRef] is equivalent to classOf[TypesImpl#TypeRef].isAssignableFrom(tp.getClass) - // this is equivalent to manifest - // it is NOT equivalent to manifest[Type] <:< typeRefMani case MethodType(x) => println("MethodType") case _ => println("none of the above") } @@ -34,7 +29,6 @@ trait TypesImpl extends TypesAPI { object TypeRef extends TypeRefExtractor // this will have a bridged unapply(x: Type) = unapply(x.asInstanceOf[TypeRef]) case class TypeRef(n: Int) extends Type // this has a bridge from TypesAPI#Type to TypesImpl#TypeRef // --> the cast in the bridge will fail because the pattern matcher can't type test against the abstract types in TypesUser - //lazy val typeRefMani = manifest[TypeRef] } trait Foos { @@ -63,16 +57,15 @@ trait Intermed extends Foos { object TestUnappStaticallyKnownSynthetic extends TypesImpl with TypesUser { def test() = { - shouldNotCrash(TypeRef(10)) // should and does print "TypeRef" - // once #1697/#2337 are fixed, this should generate the correct output - shouldNotCrash(MethodType(10)) // should print "MethodType" but prints "none of the above" -- good one, pattern matcher! + shouldNotCrash(TypeRef(10)) // prints "TypeRef" + shouldNotCrash(MethodType(10)) // prints "MethodType" } } object TestUnappDynamicSynth extends RealFoos with Intermed { - case class FooToo(n: Int) extends Bar + case class NotAFoo(n: Int) extends Bar def test() = { - crash(FooToo(10)) + crash(NotAFoo(10)) crash(new Foo(5)) } } diff --git a/test/files/run/primitive-sigs-2-new.check b/test/files/run/primitive-sigs-2-new.check index b82ddbeaff..6f79d73d38 100644 --- a/test/files/run/primitive-sigs-2-new.check +++ b/test/files/run/primitive-sigs-2-new.check @@ -1,7 +1,7 @@ T<java.lang.Object>
List(A, char, class java.lang.Object)
a
-public <T> java.lang.Object Arr.arr4(java.lang.Object[],scala.reflect.ArrayTag<T>)
+public <T> java.lang.Object Arr.arr4(java.lang.Object[],scala.reflect.ClassTag<T>)
public float[] Arr.arr3(float[][])
public scala.collection.immutable.List<java.lang.Character> Arr.arr2(java.lang.Character[])
public scala.collection.immutable.List<java.lang.Object> Arr.arr1(int[])
diff --git a/test/files/run/primitive-sigs-2-new.scala b/test/files/run/primitive-sigs-2-new.scala index 7e13014cb2..cf6de9c81b 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.{ClassTag, classTag} import java.{ lang => jl } trait T[A] { @@ -10,7 +11,7 @@ class Arr { def arr1(xs: Array[Int]): List[Int] = xs.toList def arr2(xs: Array[jl.Character]): List[jl.Character] = xs.toList def arr3(xss: Array[Array[Float]]): Array[Float] = xss map (_.sum) - def arr4[T: ArrayTag](xss: Array[Array[T]]): Array[T] = xss map (_.head) + def arr4[T: ClassTag](xss: Array[Array[T]]): Array[T] = xss map (_.head) } object Test { @@ -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..870a200813 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.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-constructormirror-inner-badpath.check b/test/files/run/reflection-constructormirror-inner-badpath.check new file mode 100644 index 0000000000..28b936eca1 --- /dev/null +++ b/test/files/run/reflection-constructormirror-inner-badpath.check @@ -0,0 +1,2 @@ +this is an inner class, use reflectClass on an InstanceMirror to obtain its ClassMirror
+()
diff --git a/test/files/run/reflection-constructormirror-inner-badpath.scala b/test/files/run/reflection-constructormirror-inner-badpath.scala new file mode 100644 index 0000000000..a42bedea83 --- /dev/null +++ b/test/files/run/reflection-constructormirror-inner-badpath.scala @@ -0,0 +1,32 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.ClassTag + +class Foo{ + case class R( + sales : Int, + name : String + ) + + def foo = { + val expectedType = implicitly[TypeTag[R]] + val classTag = implicitly[ClassTag[R]] + val cl = classTag.runtimeClass.getClassLoader + val cm = runtimeMirror(cl) + val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethodSymbol + val sig = constructor.typeSignature + val sym = cm.classSymbol( classTag.runtimeClass ) + try { + val cls = cm.reflectClass( sym ) + cls.reflectConstructor( constructor )( 5,"test" ).asInstanceOf[R] + println("this indicates a failure") + } catch { + case ex: Throwable => + println(ex.getMessage) + } + } + +} +object Test extends App{ + val foo = new Foo + println( foo.foo ) +}
\ No newline at end of file diff --git a/test/files/run/reflection-constructormirror-inner-good.check b/test/files/run/reflection-constructormirror-inner-good.check new file mode 100644 index 0000000000..811ecb2e3f --- /dev/null +++ b/test/files/run/reflection-constructormirror-inner-good.check @@ -0,0 +1 @@ +R(5,test)
diff --git a/test/files/run/reflection-constructormirror-inner-good.scala b/test/files/run/reflection-constructormirror-inner-good.scala new file mode 100644 index 0000000000..c09f464b24 --- /dev/null +++ b/test/files/run/reflection-constructormirror-inner-good.scala @@ -0,0 +1,26 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.ClassTag + +class Foo{ + case class R( + sales : Int, + name : String + ) + + def foo = { + val expectedType = implicitly[TypeTag[R]] + val classTag = implicitly[ClassTag[R]] + val cl = classTag.runtimeClass.getClassLoader + val cm = runtimeMirror(cl) + val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethodSymbol + val sig = constructor.typeSignature + val sym = cm.classSymbol( classTag.runtimeClass ) + val cls = cm.reflect( this ).reflectClass( sym ) + cls.reflectConstructor( constructor )( 5,"test" ).asInstanceOf[R] + } + +} +object Test extends App{ + val foo = new Foo + println( foo.foo ) +}
\ No newline at end of file diff --git a/test/files/run/reflection-constructormirror-nested-badpath.check b/test/files/run/reflection-constructormirror-nested-badpath.check new file mode 100644 index 0000000000..9ceb603dc2 --- /dev/null +++ b/test/files/run/reflection-constructormirror-nested-badpath.check @@ -0,0 +1,2 @@ +this is a static class, use reflectClass on a RuntimeMirror to obtain its ClassMirror
+()
diff --git a/test/files/run/reflection-constructormirror-nested-badpath.scala b/test/files/run/reflection-constructormirror-nested-badpath.scala new file mode 100644 index 0000000000..ece0044c61 --- /dev/null +++ b/test/files/run/reflection-constructormirror-nested-badpath.scala @@ -0,0 +1,32 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.ClassTag + +class Foo{ + import Test._ + def foo = { + val expectedType = implicitly[TypeTag[R]] + val classTag = implicitly[ClassTag[R]] + val cl = classTag.runtimeClass.getClassLoader + val cm = runtimeMirror(cl) + val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethodSymbol + val sig = constructor.typeSignature + val sym = cm.classSymbol( classTag.runtimeClass ) + try { + val cls = cm.reflect( this ).reflectClass( sym ) + cls.reflectConstructor( constructor )( 5,"test" ).asInstanceOf[R] + println("this indicates a failure") + } catch { + case ex: Throwable => + println(ex.getMessage) + } + } + +} +object Test extends App{ + case class R( + sales : Int, + name : String + ) + val foo = new Foo + println( foo.foo ) +}
\ No newline at end of file diff --git a/test/files/run/reflection-constructormirror-nested-good.check b/test/files/run/reflection-constructormirror-nested-good.check new file mode 100644 index 0000000000..811ecb2e3f --- /dev/null +++ b/test/files/run/reflection-constructormirror-nested-good.check @@ -0,0 +1 @@ +R(5,test)
diff --git a/test/files/run/reflection-constructormirror-nested-good.scala b/test/files/run/reflection-constructormirror-nested-good.scala new file mode 100644 index 0000000000..432e9d3707 --- /dev/null +++ b/test/files/run/reflection-constructormirror-nested-good.scala @@ -0,0 +1,26 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.ClassTag + +class Foo{ + import Test._ + def foo = { + val expectedType = implicitly[TypeTag[R]] + val classTag = implicitly[ClassTag[R]] + val cl = classTag.runtimeClass.getClassLoader + val cm = runtimeMirror(cl) + val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethodSymbol + val sig = constructor.typeSignature + val sym = cm.classSymbol( classTag.runtimeClass ) + val cls = cm.reflectClass( sym ) + cls.reflectConstructor( constructor )( 5,"test" ).asInstanceOf[R] + } +} + +object Test extends App{ + case class R( + sales : Int, + name : String + ) + val foo = new Foo + println( foo.foo ) +}
\ No newline at end of file diff --git a/test/files/run/reflection-constructormirror-toplevel-badpath.check b/test/files/run/reflection-constructormirror-toplevel-badpath.check new file mode 100644 index 0000000000..9ceb603dc2 --- /dev/null +++ b/test/files/run/reflection-constructormirror-toplevel-badpath.check @@ -0,0 +1,2 @@ +this is a static class, use reflectClass on a RuntimeMirror to obtain its ClassMirror
+()
diff --git a/test/files/run/reflection-constructormirror-toplevel-badpath.scala b/test/files/run/reflection-constructormirror-toplevel-badpath.scala new file mode 100644 index 0000000000..7a7adbd603 --- /dev/null +++ b/test/files/run/reflection-constructormirror-toplevel-badpath.scala @@ -0,0 +1,33 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.ClassTag + +case class R( + sales : Int, + name : String +) + +class Foo{ + import Test._ + def foo = { + val expectedType = implicitly[TypeTag[R]] + val classTag = implicitly[ClassTag[R]] + val cl = classTag.runtimeClass.getClassLoader + val cm = runtimeMirror(cl) + val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethodSymbol + val sig = constructor.typeSignature + val sym = cm.classSymbol( classTag.runtimeClass ) + try { + val cls = cm.reflect( this ).reflectClass( sym ) + cls.reflectConstructor( constructor )( 5,"test" ).asInstanceOf[R] + println("this indicates a failure") + } catch { + case ex: Throwable => + println(ex.getMessage) + } + } +} + +object Test extends App{ + val foo = new Foo + println( foo.foo ) +}
\ No newline at end of file diff --git a/test/files/run/reflection-constructormirror-toplevel-good.check b/test/files/run/reflection-constructormirror-toplevel-good.check new file mode 100644 index 0000000000..811ecb2e3f --- /dev/null +++ b/test/files/run/reflection-constructormirror-toplevel-good.check @@ -0,0 +1 @@ +R(5,test)
diff --git a/test/files/run/reflection-constructormirror-toplevel-good.scala b/test/files/run/reflection-constructormirror-toplevel-good.scala new file mode 100644 index 0000000000..96713a11cb --- /dev/null +++ b/test/files/run/reflection-constructormirror-toplevel-good.scala @@ -0,0 +1,27 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.ClassTag + +case class R( + sales : Int, + name : String +) + +class Foo{ + import Test._ + def foo = { + val expectedType = implicitly[TypeTag[R]] + val classTag = implicitly[ClassTag[R]] + val cl = classTag.runtimeClass.getClassLoader + val cm = runtimeMirror(cl) + val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethodSymbol + val sig = constructor.typeSignature + val sym = cm.classSymbol( classTag.runtimeClass ) + val cls = cm.reflectClass( sym ) + cls.reflectConstructor( constructor )( 5,"test" ).asInstanceOf[R] + } +} + +object Test extends App{ + val foo = new Foo + println( foo.foo ) +}
\ No newline at end of file diff --git a/test/files/run/reflection-fieldmirror-ctorparam.check b/test/files/run/reflection-fieldmirror-ctorparam.check new file mode 100644 index 0000000000..8b99a6f772 --- /dev/null +++ b/test/files/run/reflection-fieldmirror-ctorparam.check @@ -0,0 +1 @@ +class java.lang.NoSuchFieldException: Test$A$$x
diff --git a/test/files/run/reflection-fieldmirror-ctorparam.scala b/test/files/run/reflection-fieldmirror-ctorparam.scala new file mode 100644 index 0000000000..fa9dd81d7f --- /dev/null +++ b/test/files/run/reflection-fieldmirror-ctorparam.scala @@ -0,0 +1,21 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} + +object Test extends App { + class A(x: Int) { + private[this] var xx = x + } + + val a = new A(42) + + val im: InstanceMirror = cm.reflect(a) + val cs = im.symbol + val f = cs.typeSignature.declaration(newTermName("x")).asTermSymbol + try { + val fm: FieldMirror = im.reflectField(f) + println(fm.get) + } catch { + case ex: Throwable => + println(s"${ex.getClass}: ${ex.getMessage}") + } +} diff --git a/test/files/run/reflection-fieldmirror-getsetval.check b/test/files/run/reflection-fieldmirror-getsetval.check new file mode 100644 index 0000000000..707bbcccce --- /dev/null +++ b/test/files/run/reflection-fieldmirror-getsetval.check @@ -0,0 +1,2 @@ +42
+cannot set an immutable field
diff --git a/test/files/run/reflection-fieldmirror-getsetval.scala b/test/files/run/reflection-fieldmirror-getsetval.scala new file mode 100644 index 0000000000..af9a6e4c56 --- /dev/null +++ b/test/files/run/reflection-fieldmirror-getsetval.scala @@ -0,0 +1,24 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} + +object Test extends App { + class A { + val x: Int = 42 + } + + val a = new A + + val im: InstanceMirror = cm.reflect(a) + val cs = im.symbol + val f = cs.typeSignature.declaration(newTermName("x" + nme.LOCAL_SUFFIX_STRING)).asTermSymbol + val fm: FieldMirror = im.reflectField(f) + try { + println(fm.get) + fm.set(2) + println(fm.get) + println("this indicates a failure") + } catch { + case ex: Throwable => + println(ex.getMessage) + } +} diff --git a/test/files/run/reflection-fieldmirror-getsetvar.check b/test/files/run/reflection-fieldmirror-getsetvar.check new file mode 100644 index 0000000000..a9b0ccc6a0 --- /dev/null +++ b/test/files/run/reflection-fieldmirror-getsetvar.check @@ -0,0 +1,2 @@ +42
+2
diff --git a/test/files/run/reflection-fieldmirror-getsetvar.scala b/test/files/run/reflection-fieldmirror-getsetvar.scala new file mode 100644 index 0000000000..d9fbdaade0 --- /dev/null +++ b/test/files/run/reflection-fieldmirror-getsetvar.scala @@ -0,0 +1,18 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} + +object Test extends App { + class A { + var x: Int = 42 + } + + val a = new A + + val im: InstanceMirror = cm.reflect(a) + val cs = im.symbol + val f = cs.typeSignature.declaration(newTermName("x" + nme.LOCAL_SUFFIX_STRING)).asTermSymbol + val fm: FieldMirror = im.reflectField(f) + println(fm.get) + fm.set(2) + println(fm.get) +} diff --git a/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.check b/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.check new file mode 100644 index 0000000000..fe75c80bca --- /dev/null +++ b/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.check @@ -0,0 +1 @@ +true
diff --git a/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala b/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala new file mode 100644 index 0000000000..d89e6a90ef --- /dev/null +++ b/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala @@ -0,0 +1,16 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} + +object Test extends App { + class A { + var x: Int = 42 + } + + val a = new A + + val im: InstanceMirror = cm.reflect(a) + val cs = im.symbol + val f = cs.typeSignature.declaration(newTermName("x" + nme.LOCAL_SUFFIX_STRING)).asTermSymbol + val fm: FieldMirror = im.reflectField(f) + println(fm.symbol.isVariable) +} diff --git a/test/files/run/reflection-fieldmirror-privatethis.check b/test/files/run/reflection-fieldmirror-privatethis.check new file mode 100644 index 0000000000..889b7c2c34 --- /dev/null +++ b/test/files/run/reflection-fieldmirror-privatethis.check @@ -0,0 +1,3 @@ +true
+42
+2
diff --git a/test/files/run/reflection-fieldmirror-privatethis.scala b/test/files/run/reflection-fieldmirror-privatethis.scala new file mode 100644 index 0000000000..0c415e09e4 --- /dev/null +++ b/test/files/run/reflection-fieldmirror-privatethis.scala @@ -0,0 +1,19 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} + +object Test extends App { + class A { + private[this] var x: Int = 42 + } + + val a = new A + + val im: InstanceMirror = cm.reflect(a) + val cs = im.symbol + val f = cs.typeSignature.declaration(newTermName("x")).asTermSymbol + val fm: FieldMirror = im.reflectField(f) + println(fm.symbol.isVariable) + println(fm.get) + fm.set(2) + println(fm.get) +} diff --git a/test/files/run/reflection-fieldmirror-sanitycheck.check b/test/files/run/reflection-fieldmirror-sanitycheck.check new file mode 100644 index 0000000000..e5134de4e3 --- /dev/null +++ b/test/files/run/reflection-fieldmirror-sanitycheck.check @@ -0,0 +1,6 @@ +expected a field symbol, you provided a method symbol +A typical cause of this problem is using a field accessor symbol instead of a field symbol. +To obtain a field symbol append nme.LOCAL_SUFFIX_STRING to the name of the field, +when searching for a member with Type.members or Type.declarations. +This is a temporary inconvenience that will be resolved before 2.10.0-final. +More information can be found here: https://issues.scala-lang.org/browse/SI-5895.
diff --git a/test/files/run/reflection-fieldmirror-sanitycheck.scala b/test/files/run/reflection-fieldmirror-sanitycheck.scala new file mode 100644 index 0000000000..6a992dd282 --- /dev/null +++ b/test/files/run/reflection-fieldmirror-sanitycheck.scala @@ -0,0 +1,22 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} + +object Test extends App { + class A { + var x: Int = 42 + } + + val a = new A + + val im: InstanceMirror = cm.reflect(a) + val cs = im.symbol + //val f = cs.typeSignature.declaration(newTermName("x" + nme.LOCAL_SUFFIX_STRING)).asTermSymbol + val f = cs.typeSignature.declaration(newTermName("x")).asTermSymbol + try { + val fm: FieldMirror = im.reflectField(f) + println("this indicates a failure") + } catch { + case ex: Throwable => + println(ex.getMessage) + } +} 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..b3c0081ccf --- /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.classSymbol(classTag[Foo].runtimeClass).typeSignature.declaration(newTermName("bar")).typeSignature == + cm.classSymbol(classTag[Bar].runtimeClass).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.classSymbol(implClass) + } +} + +trait Foo { + def bar = 1 +} + +trait Outer { + trait Bar { + def foo = 1 + } +} diff --git a/test/files/run/reflection-modulemirror-inner-badpath.check b/test/files/run/reflection-modulemirror-inner-badpath.check new file mode 100644 index 0000000000..d3fe43336e --- /dev/null +++ b/test/files/run/reflection-modulemirror-inner-badpath.check @@ -0,0 +1,2 @@ +this is an inner module, use reflectModule on an InstanceMirror to obtain its ModuleMirror +() diff --git a/test/files/run/reflection-modulemirror-inner-badpath.scala b/test/files/run/reflection-modulemirror-inner-badpath.scala new file mode 100644 index 0000000000..de200c548b --- /dev/null +++ b/test/files/run/reflection-modulemirror-inner-badpath.scala @@ -0,0 +1,24 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.reflect.ClassTag + +class Foo{ + object R { override def toString = "R" } + def foo = { + val classTag = implicitly[ClassTag[R.type]] + val sym = cm.moduleSymbol(classTag.runtimeClass) + try { + val cls = cm.reflectModule(sym) + cls.instance + println("this indicates a failure") + } catch { + case ex: Throwable => + println(ex.getMessage) + } + } +} + +object Test extends App{ + val foo = new Foo + println(foo.foo) +}
\ No newline at end of file diff --git a/test/files/run/reflection-modulemirror-inner-good.check b/test/files/run/reflection-modulemirror-inner-good.check new file mode 100644 index 0000000000..0bf38a73d1 --- /dev/null +++ b/test/files/run/reflection-modulemirror-inner-good.check @@ -0,0 +1,2 @@ +inner and nested modules are not supported yet
+()
diff --git a/test/files/run/reflection-modulemirror-inner-good.scala b/test/files/run/reflection-modulemirror-inner-good.scala new file mode 100644 index 0000000000..b5540dbe1c --- /dev/null +++ b/test/files/run/reflection-modulemirror-inner-good.scala @@ -0,0 +1,23 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.reflect.ClassTag + +class Foo{ + object R { override def toString = "R" } + def foo = { + val classTag = implicitly[ClassTag[R.type]] + val sym = cm.moduleSymbol(classTag.runtimeClass) + val cls = cm.reflect(this).reflectModule(sym) + try { + cls.instance + } catch { + case ex: Throwable => + println(ex.getMessage) + } + } +} + +object Test extends App{ + val foo = new Foo + println(foo.foo) +}
\ No newline at end of file diff --git a/test/files/run/reflection-modulemirror-nested-badpath.check b/test/files/run/reflection-modulemirror-nested-badpath.check new file mode 100644 index 0000000000..16a5b10390 --- /dev/null +++ b/test/files/run/reflection-modulemirror-nested-badpath.check @@ -0,0 +1,2 @@ +this is a static module, use reflectModule on a RuntimeMirror to obtain its ModuleMirror +() diff --git a/test/files/run/reflection-modulemirror-nested-badpath.scala b/test/files/run/reflection-modulemirror-nested-badpath.scala new file mode 100644 index 0000000000..43cae00f9c --- /dev/null +++ b/test/files/run/reflection-modulemirror-nested-badpath.scala @@ -0,0 +1,26 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.reflect.ClassTag + +class Foo{ + import Test._ + def foo = { + val classTag = implicitly[ClassTag[R.type]] + val sym = cm.moduleSymbol(classTag.runtimeClass) + try { + val cls = cm.reflect(this).reflectModule(sym) + cls.instance + println("this indicates a failure") + } catch { + case ex: Throwable => + println(ex.getMessage) + } + } + +} + +object Test extends App{ + object R { override def toString = "R" } + val foo = new Foo + println(foo.foo) +} diff --git a/test/files/run/reflection-modulemirror-nested-good.check b/test/files/run/reflection-modulemirror-nested-good.check new file mode 100644 index 0000000000..0bf38a73d1 --- /dev/null +++ b/test/files/run/reflection-modulemirror-nested-good.check @@ -0,0 +1,2 @@ +inner and nested modules are not supported yet
+()
diff --git a/test/files/run/reflection-modulemirror-nested-good.scala b/test/files/run/reflection-modulemirror-nested-good.scala new file mode 100644 index 0000000000..8390bbaac7 --- /dev/null +++ b/test/files/run/reflection-modulemirror-nested-good.scala @@ -0,0 +1,24 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.reflect.ClassTag + +class Foo{ + import Test._ + def foo = { + val classTag = implicitly[ClassTag[R.type]] + val sym = cm.moduleSymbol(classTag.runtimeClass) + val cls = cm.reflectModule(sym) + try { + cls.instance + } catch { + case ex: Throwable => + println(ex.getMessage) + } + } +} + +object Test extends App{ + object R { override def toString = "R" } + val foo = new Foo + println(foo.foo) +}
\ No newline at end of file diff --git a/test/files/run/reflection-modulemirror-toplevel-badpath.check b/test/files/run/reflection-modulemirror-toplevel-badpath.check new file mode 100644 index 0000000000..16a5b10390 --- /dev/null +++ b/test/files/run/reflection-modulemirror-toplevel-badpath.check @@ -0,0 +1,2 @@ +this is a static module, use reflectModule on a RuntimeMirror to obtain its ModuleMirror +() diff --git a/test/files/run/reflection-modulemirror-toplevel-badpath.scala b/test/files/run/reflection-modulemirror-toplevel-badpath.scala new file mode 100644 index 0000000000..8b2994cabb --- /dev/null +++ b/test/files/run/reflection-modulemirror-toplevel-badpath.scala @@ -0,0 +1,26 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.reflect.ClassTag + +object R { override def toString = "R" } + +class Foo{ + import Test._ + def foo = { + val classTag = implicitly[ClassTag[R.type]] + val sym = cm.moduleSymbol(classTag.runtimeClass) + try { + val cls = cm.reflect(this).reflectModule(sym) + cls.instance + println("this indicates a failure") + } catch { + case ex: Throwable => + println(ex.getMessage) + } + } +} + +object Test extends App{ + val foo = new Foo + println(foo.foo) +}
\ No newline at end of file diff --git a/test/files/run/reflection-modulemirror-toplevel-good.check b/test/files/run/reflection-modulemirror-toplevel-good.check new file mode 100644 index 0000000000..ac044e5e46 --- /dev/null +++ b/test/files/run/reflection-modulemirror-toplevel-good.check @@ -0,0 +1 @@ +R
\ No newline at end of file diff --git a/test/files/run/reflection-modulemirror-toplevel-good.scala b/test/files/run/reflection-modulemirror-toplevel-good.scala new file mode 100644 index 0000000000..0663136a22 --- /dev/null +++ b/test/files/run/reflection-modulemirror-toplevel-good.scala @@ -0,0 +1,20 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.reflect.ClassTag + +object R { override def toString = "R" } + +class Foo{ + import Test._ + def foo = { + val classTag = implicitly[ClassTag[R.type]] + val sym = cm.moduleSymbol(classTag.runtimeClass) + val cls = cm.reflectModule(sym) + cls.instance + } +} + +object Test extends App{ + val foo = new Foo + println(foo.foo) +}
\ No newline at end of file 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..ec34b71cec 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.classSymbol(classOf[Foo]).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..42a1deef26 100644 --- a/test/files/run/reify_implicits-new.scala +++ b/test/files/run/reify_implicits-new.scala @@ -1,8 +1,10 @@ -import scala.reflect.mirror._ +import scala.reflect.{ClassTag, classTag} +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { - implicit def arrayWrapper[A : ArrayTag](x: Array[A]) = + implicit def arrayWrapper[A : ClassTag](x: Array[A]) = new { def sort(p: (A, A) => Boolean) = { util.Sorting.stableSort(x, p); x @@ -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..a688a98fbc 100644 --- a/test/files/run/reify_newimpl_25.check +++ b/test/files/run/reify_newimpl_25.check @@ -3,18 +3,16 @@ 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]
+TypeTag[x.type]
scala>
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..6c5f124960 100644 --- a/test/files/run/reify_newimpl_26.check +++ b/test/files/run/reify_newimpl_26.check @@ -3,20 +3,18 @@ Type :help for more information. scala>
-scala> import scala.reflect.mirror._
-import scala.reflect.mirror._
-
scala> def foo[T]{
- val tt = implicitly[TypeTag[List[T]]]
+ import scala.reflect.runtime.universe._
+ val tt = implicitly[AbsTypeTag[List[T]]]
println(tt)
}
-<console>:11: free type: Ident(newTypeName("T")) defined by foo in <console>:10:16
- val tt = implicitly[TypeTag[List[T]]]
+<console>:9: free type: Ident(newTypeName("T")) defined by foo in <console>:7:16
+ val tt = implicitly[AbsTypeTag[List[T]]]
^
foo: [T]=> Unit
scala> foo[Int]
-TypeTag[List[T]]
+AbsTypeTag[List[T]]
scala>
diff --git a/test/files/run/reify_newimpl_26.scala b/test/files/run/reify_newimpl_26.scala index f2dd1bfc4e..a12d8a2970 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]{ - val tt = implicitly[TypeTag[List[T]]] + import scala.reflect.runtime.universe._ + val tt = implicitly[AbsTypeTag[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/repl-colon-type.check b/test/files/run/repl-colon-type.check index cb0b9a6c8b..35cd04ba87 100644 --- a/test/files/run/repl-colon-type.check +++ b/test/files/run/repl-colon-type.check @@ -82,8 +82,10 @@ TypeRef( TypeRef( TypeSymbol(abstract trait Function1[-T1, +R] extends Object) args = List( - TypeRef(TypeSymbol(final class Int extends AnyVal)) - TypeRef(TypeSymbol(final class Boolean extends AnyVal)) + TypeRef(TypeSymbol(final abstract class Int extends AnyVal)) + TypeRef( + TypeSymbol(final abstract class Boolean extends AnyVal) + ) ) ) TypeRef( @@ -92,7 +94,7 @@ TypeRef( ) args = List( - TypeRef(TypeSymbol(final class Int extends AnyVal)) + TypeRef(TypeSymbol(final abstract class Int extends AnyVal)) ) ) ) @@ -125,14 +127,14 @@ scala> :type -v def x = 1 ; def bar[T >: Null <: AnyRef](xyz: T) = 5 OverloadedType( alts = List( NullaryMethodType( - TypeRef(TypeSymbol(final class Int extends AnyVal)) + TypeRef(TypeSymbol(final abstract class Int extends AnyVal)) ) PolyType( typeParams = List(TypeParam(T >: Null <: AnyRef)) resultType = MethodType( params = List(TermSymbol(xyz: T)) resultType = TypeRef( - TypeSymbol(final class Int extends AnyVal) + TypeSymbol(final abstract class Int extends AnyVal) ) ) ) @@ -147,7 +149,7 @@ Int => Iterator[List[Nothing]] TypeRef( TypeSymbol(abstract trait Function1[-T1, +R] extends Object) args = List( - TypeRef(TypeSymbol(final class Int extends AnyVal)) + TypeRef(TypeSymbol(final abstract class Int extends AnyVal)) TypeRef( TypeSymbol( abstract trait Iterator[+A] extends TraversableOnce[A] @@ -180,7 +182,7 @@ PolyType( TypeRef( TypeSymbol(abstract trait Function1[-T1, +R] extends Object) args = List( - TypeRef(TypeSymbol(final class Int extends AnyVal)) + TypeRef(TypeSymbol(final abstract class Int extends AnyVal)) TypeRef( TypeSymbol( abstract trait Iterator[+A] extends TraversableOnce[A] diff --git a/test/files/run/repl-type-verbose.check b/test/files/run/repl-type-verbose.check index 103ac3e64d..989c0735b0 100644 --- a/test/files/run/repl-type-verbose.check +++ b/test/files/run/repl-type-verbose.check @@ -11,7 +11,7 @@ scala> :type -v def f = 5 // Internal Type structure NullaryMethodType( - TypeRef(TypeSymbol(final class Int extends AnyVal)) + TypeRef(TypeSymbol(final abstract class Int extends AnyVal)) ) scala> :type -v def f() = 5 @@ -20,7 +20,9 @@ scala> :type -v def f() = 5 // Internal Type structure NullaryMethodType( - resultType = TypeRef(TypeSymbol(final class Int extends AnyVal)) + resultType = TypeRef( + TypeSymbol(final abstract class Int extends AnyVal) + ) ) scala> :type -v def f[T] = 5 @@ -31,7 +33,7 @@ scala> :type -v def f[T] = 5 PolyType( typeParams = List(TypeParam(T)) resultType = NullaryMethodType( - TypeRef(TypeSymbol(final class Int extends AnyVal)) + TypeRef(TypeSymbol(final abstract class Int extends AnyVal)) ) ) @@ -43,7 +45,7 @@ scala> :type -v def f[T >: Null] = 5 PolyType( typeParams = List(TypeParam(T >: Null)) resultType = NullaryMethodType( - TypeRef(TypeSymbol(final class Int extends AnyVal)) + TypeRef(TypeSymbol(final abstract class Int extends AnyVal)) ) ) @@ -55,7 +57,7 @@ scala> :type -v def f[T <: String] = 5 PolyType( typeParams = List(TypeParam(T <: String)) resultType = NullaryMethodType( - TypeRef(TypeSymbol(final class Int extends AnyVal)) + TypeRef(TypeSymbol(final abstract class Int extends AnyVal)) ) ) @@ -67,7 +69,9 @@ scala> :type -v def f[T]() = 5 PolyType( typeParams = List(TypeParam(T)) resultType = NullaryMethodType( - resultType = TypeRef(TypeSymbol(final class Int extends AnyVal)) + resultType = TypeRef( + TypeSymbol(final abstract class Int extends AnyVal) + ) ) ) @@ -79,7 +83,9 @@ scala> :type -v def f[T, U]() = 5 PolyType( typeParams = List(TypeParam(T), TypeParam(U)) resultType = NullaryMethodType( - resultType = TypeRef(TypeSymbol(final class Int extends AnyVal)) + resultType = TypeRef( + TypeSymbol(final abstract class Int extends AnyVal) + ) ) ) @@ -93,7 +99,7 @@ PolyType( resultType = NullaryMethodType( resultType = NullaryMethodType( resultType = TypeRef( - TypeSymbol(final class Int extends AnyVal) + TypeSymbol(final abstract class Int extends AnyVal) ) ) ) @@ -107,7 +113,7 @@ scala> :type -v def f[T, U <: T] = 5 PolyType( typeParams = List(TypeParam(T), TypeParam(U <: T)) resultType = NullaryMethodType( - TypeRef(TypeSymbol(final class Int extends AnyVal)) + TypeRef(TypeSymbol(final abstract class Int extends AnyVal)) ) ) @@ -123,7 +129,7 @@ PolyType( resultType = MethodType( params = List(TermSymbol(y: U)) resultType = TypeRef( - TypeSymbol(final class Int extends AnyVal) + TypeSymbol(final abstract class Int extends AnyVal) ) ) ) @@ -138,7 +144,9 @@ PolyType( typeParams = List(TypeParam(T)) resultType = MethodType( params = List(TermSymbol(implicit evidence$1: Ordering[T])) - resultType = TypeRef(TypeSymbol(final class Int extends AnyVal)) + resultType = TypeRef( + TypeSymbol(final abstract class Int extends AnyVal) + ) ) ) @@ -177,7 +185,7 @@ PolyType( ) ) resultType = NullaryMethodType( - TypeRef(TypeSymbol(final class Int extends AnyVal)) + TypeRef(TypeSymbol(final abstract class Int extends AnyVal)) ) ) 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..8df5aa1992 100644 --- a/test/files/run/t0421-new.scala +++ b/test/files/run/t0421-new.scala @@ -1,7 +1,9 @@ +import scala.reflect.{ClassTag, classTag} + // ticket #421 object Test extends App { - def transpose[A: ArrayTag](xss: Array[Array[A]]) = { + def transpose[A: ClassTag](xss: Array[Array[A]]) = { for (i <- Array.range(0, xss(0).length)) yield for (xs <- xss) yield xs(i) } @@ -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..15c8b4aa19 100644 --- a/test/files/run/t0677-new.scala +++ b/test/files/run/t0677-new.scala @@ -1,8 +1,10 @@ +import scala.reflect.{ClassTag, classTag} + object Test extends App { - class X[T: ArrayTag] { + class X[T: ClassTag] { val a = Array.ofDim[T](3, 4) } 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..6f2684f42d 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.ClassTag
+import scala.reflect.ClassTag
+
+scala> def f[A: ClassTag](a: A) = java.util.Arrays.asList(Array(a): _*)
+f: [A](a: A)(implicit evidence$1: scala.reflect.ClassTag[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..ecaae5bea2 100644 --- a/test/files/run/t4216.scala +++ b/test/files/run/t4216.scala @@ -4,7 +4,8 @@ import scala.tools.partest.ReplTest object Test extends ReplTest { def code = """ - |def f[A: ArrayTag](a: A) = java.util.Arrays.asList(Array(a): _*) + |import scala.reflect.ClassTag + |def f[A: ClassTag](a: A) = java.util.Arrays.asList(Array(a): _*) |f(".") |f(0) |def i(a: Int) = java.util.Arrays.asList(Array(a): _*) 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..84ef97b0d2 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.classSymbol(classOf[A]) 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..0ffab8a668 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.classSymbol(classOf[A]) 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..d56215f6eb --- /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.classSymbol(classOf[A]) + 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..dd32c05a93 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.classSymbol(classOf[A])
+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..24ac1eb316 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.classSymbol(classOf[A]) +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..6c6de90acc 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..f83546f2c0 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.classSymbol(classOf[C#A]) 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..c840793fd5 100644 --- a/test/files/run/t5256f.check +++ b/test/files/run/t5256f.check @@ -1,4 +1,12 @@ +class A1 Test.A1 -true -Test.this.A2 -true +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..80c7ad8018 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.classSymbol(classOf[A1]) 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.classSymbol(classOf[A2]) 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..358c18601a --- /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.classSymbol(mutant.getClass) + 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..fd4ffd9b12 --- /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.classSymbol(mutant.getClass) + 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..9b8ba090fa 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.classSymbol(classOf[A]) + 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/t5857.scala b/test/files/run/t5857.scala new file mode 100644 index 0000000000..bf67bedf54 --- /dev/null +++ b/test/files/run/t5857.scala @@ -0,0 +1,45 @@ + + + +object Test { + + def time[U](b: =>U): Long = { + val start = System.currentTimeMillis + b + val end = System.currentTimeMillis + + end - start + } + + def main(args: Array[String]) { + val sz = 1000000000 + + val range = 1 to sz + check { assert(range.min == 1, range.min) } + check { assert(range.max == sz, range.max) } + + val descending = sz to 1 by -1 + check { assert(descending.min == 1) } + check { assert(descending.max == sz) } + + val numeric = 1.0 to sz.toDouble by 1 + check { assert(numeric.min == 1.0) } + check { assert(numeric.max == sz.toDouble) } + + val numdesc = sz.toDouble to 1.0 by -1 + check { assert(numdesc.min == 1.0) } + check { assert(numdesc.max == sz.toDouble) } + } + + def check[U](b: =>U) { + val exectime = time { + b + } + + // whatever it is, it should be less than, say, 250ms + // if `max` involves traversal, it takes over 5 seconds on a 3.2GHz i7 CPU + //println(exectime) + assert(exectime < 250, exectime) + } + +} diff --git a/test/files/run/t5880.scala b/test/files/run/t5880.scala index 08cd0d6bf8..4cda599f79 100644 --- a/test/files/run/t5880.scala +++ b/test/files/run/t5880.scala @@ -35,7 +35,7 @@ object Test { } // println(hits.toBuffer) // println(ChiSquare) - assert(ChiSquare < 2.0) + assert(ChiSquare < 4.0, ChiSquare + " -> " + hits.mkString(", ")) } } 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 deleted file mode 100644 index f124aa6a35..0000000000 --- a/test/files/run/typetags_core.check +++ /dev/null @@ -1,32 +0,0 @@ -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] diff --git a/test/files/run/typetags_core.scala b/test/files/run/typetags_core.scala deleted file mode 100644 index 7d6be16379..0000000000 --- a/test/files/run/typetags_core.scala +++ /dev/null @@ -1,34 +0,0 @@ -object Test extends App { - println(implicitly[TypeTag[Byte]] eq TypeTag.Byte) - println(implicitly[TypeTag[Byte]]) - println(implicitly[TypeTag[Short]] eq TypeTag.Short) - println(implicitly[TypeTag[Short]]) - println(implicitly[TypeTag[Char]] eq TypeTag.Char) - println(implicitly[TypeTag[Char]]) - println(implicitly[TypeTag[Int]] eq TypeTag.Int) - println(implicitly[TypeTag[Int]]) - println(implicitly[TypeTag[Long]] eq TypeTag.Long) - println(implicitly[TypeTag[Long]]) - println(implicitly[TypeTag[Float]] eq TypeTag.Float) - println(implicitly[TypeTag[Float]]) - println(implicitly[TypeTag[Double]] eq TypeTag.Double) - println(implicitly[TypeTag[Double]]) - println(implicitly[TypeTag[Boolean]] eq TypeTag.Boolean) - println(implicitly[TypeTag[Boolean]]) - println(implicitly[TypeTag[Unit]] eq TypeTag.Unit) - println(implicitly[TypeTag[Unit]]) - println(implicitly[TypeTag[Any]] eq TypeTag.Any) - 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) - println(implicitly[TypeTag[Nothing]]) - println(implicitly[TypeTag[String]] eq TypeTag.String) - println(implicitly[TypeTag[String]]) -}
\ No newline at end of file diff --git a/test/files/run/typetags_multi.check b/test/files/run/typetags_multi.check deleted file mode 100644 index 613106985c..0000000000 --- a/test/files/run/typetags_multi.check +++ /dev/null @@ -1,5 +0,0 @@ -ConcreteTypeTag[Int]
-ConcreteTypeTag[Array[Int]]
-ConcreteTypeTag[Array[Array[Int]]]
-ConcreteTypeTag[Array[Array[Array[Int]]]]
-ConcreteTypeTag[Array[Array[Array[Array[Int]]]]]
diff --git a/test/files/run/typetags_multi.scala b/test/files/run/typetags_multi.scala deleted file mode 100644 index 868edc2b2a..0000000000 --- a/test/files/run/typetags_multi.scala +++ /dev/null @@ -1,7 +0,0 @@ -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]]]]]) -}
\ No newline at end of file diff --git a/test/files/run/virtpatmat_typetag.check b/test/files/run/virtpatmat_typetag.check new file mode 100644 index 0000000000..f9800b84d0 --- /dev/null +++ b/test/files/run/virtpatmat_typetag.check @@ -0,0 +1,10 @@ +1 is not a ClassTag[int]; it's a class java.lang.Integer +1 is a ClassTag[class java.lang.Integer] +1 is not a ClassTag[class java.lang.String]; it's a class java.lang.Integer +true is a ClassTag[class java.lang.Object] +woele is a ClassTag[class java.lang.String] +1 is not a ClassTag[int]; it's a class java.lang.Integer +1 is a ClassTag[class java.lang.Integer] +1 is not a ClassTag[class java.lang.String]; it's a class java.lang.Integer +true is a ClassTag[class java.lang.Object] +woele is a ClassTag[class java.lang.String] diff --git a/test/files/run/virtpatmat_typetag.flags b/test/files/run/virtpatmat_typetag.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/run/virtpatmat_typetag.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/run/virtpatmat_typetag.scala b/test/files/run/virtpatmat_typetag.scala new file mode 100644 index 0000000000..c1b1fd813a --- /dev/null +++ b/test/files/run/virtpatmat_typetag.scala @@ -0,0 +1,36 @@ +import reflect.{ClassTag, classTag} + +trait Extractors { + type T + implicit val tTag: ClassTag[T] + object ExtractT { + def unapply(x: T) = Some(x) + } + def apply(a: Any) = a match { + case ExtractT(x) => println(x +" is a "+ implicitly[ClassTag[T]]) + case _ => println(a+ " is not a "+ implicitly[ClassTag[T]] +"; it's a "+ a.getClass) + } +} + +object Test extends App { + def typeMatch[T: ClassTag](a: Any) = a match { + case x : T => println(x +" is a "+ implicitly[ClassTag[T]]) + case _ => println(a+ " is not a "+ implicitly[ClassTag[T]] +"; it's a "+ a.getClass) + } + + // the same match as typeMatch, but using an extractor + def extractorMatch[S: ClassTag](a: Any) = + (new Extractors { type T = S; val tTag = classTag[T] })(a) + + typeMatch[Int](1) + typeMatch[Integer](1) + typeMatch[String](1) + typeMatch[Any](true) + typeMatch[String]("woele") + + extractorMatch[Int](1) + extractorMatch[Integer](1) + extractorMatch[String](1) + extractorMatch[Any](true) + extractorMatch[String]("woele") +}
\ No newline at end of file diff --git a/test/files/scalacheck/array-new.scala b/test/files/scalacheck/array-new.scala index 18d577ca6d..e13a47a5d5 100644 --- a/test/files/scalacheck/array-new.scala +++ b/test/files/scalacheck/array-new.scala @@ -1,3 +1,4 @@ +import scala.reflect.{ClassTag, classTag} import org.scalacheck._ import Prop._ import Gen._ @@ -9,7 +10,7 @@ import scala.collection.mutable.ArraySeq object Test extends Properties("Array") { /** At this moment the authentic scalacheck Array Builder/Arb bits are commented out. */ - implicit def arbArray[T](implicit a: Arbitrary[T], m: ArrayTag[T]): Arbitrary[Array[T]] = + implicit def arbArray[T](implicit a: Arbitrary[T], m: ClassTag[T]): Arbitrary[Array[T]] = Arbitrary(containerOf[List,T](arbitrary[T]) map (_.toArray)) val arrGen: Gen[Array[_]] = oneOf( @@ -33,4 +34,4 @@ object Test extends Properties("Array") { val flattened = arr flatMap (x => x) flatMap (x => x) flattened.length == i1 * i2 * i3 } -} +}
\ No newline at end of file diff --git a/test/files/specialized/SI-5005.check b/test/files/specialized/SI-5005.check deleted file mode 100644 index 81e8342dad..0000000000 --- a/test/files/specialized/SI-5005.check +++ /dev/null @@ -1,33 +0,0 @@ -[[syntax trees at end of specialize]] // newSource1 -package <empty> { - class C2[@specialized(scala.Boolean) U >: Nothing <: Any] extends Object { - def <init>(): C2[U] = { - C2.super.<init>(); - () - }; - def apply(x: U): U = x; - <specialized> def apply$mcZ$sp(x: Boolean): Boolean = C2.this.apply(x.asInstanceOf[U]()).asInstanceOf[Boolean]() - }; - class B extends Object { - def <init>(): B = { - B.super.<init>(); - () - }; - new C2$mcZ$sp().apply$mcZ$sp(true) - }; - <specialized> class C2$mcZ$sp extends C2[Boolean] { - <specialized> def <init>(): C2$mcZ$sp = { - C2$mcZ$sp.super.<init>(); - () - }; - @inline final override <specialized> def apply(x: Boolean): Boolean = C2$mcZ$sp.this.apply$mcZ$sp(x); - @inline final override <specialized> def apply$mcZ$sp(x: Boolean): Boolean = x - } -} - -[log inliner] Analyzing C2.apply count 0 with 1 blocks -[log inliner] C2.apply blocks before inlining: 1 (2) after: 1 (2) -[log inliner] Analyzing C2.apply$mcZ$sp count 0 with 1 blocks -[log inliner] C2.apply$mcZ$sp blocks before inlining: 1 (8) after: 1 (8) -[log inliner] Not inlining into apply because it is marked @inline. -[log inliner] Not inlining into apply$mcZ$sp because it is marked @inline. diff --git a/test/files/specialized/SI-5005.scala b/test/files/specialized/SI-5005.scala deleted file mode 100644 index 3d1ada49e2..0000000000 --- a/test/files/specialized/SI-5005.scala +++ /dev/null @@ -1,27 +0,0 @@ -import scala.tools.partest._ -import java.io._ - -object Test extends DirectTest { - - override def extraSettings: String = "-usejavacp -Xprint:spec -optimize -Ylog:inliner -d " + testOutput.path - - override def code = """ - class C2[@specialized(Boolean) U]() { - @inline final def apply(x: U): U = x - } - - class B { - (new C2[Boolean]())(true) - } - """ - - override def show(): Unit = { - // redirect err to out, for inliner log - val prevErr = System.err - System.setErr(System.out) - compile() - System.setErr(prevErr) - } - - override def isDebug = false // so we don't get the newSettings warning -} diff --git a/test/files/specialized/spec-matrix-new.scala b/test/files/specialized/spec-matrix-new.scala index 65b46e8d48..e9a6e35219 100644 --- a/test/files/specialized/spec-matrix-new.scala +++ b/test/files/specialized/spec-matrix-new.scala @@ -1,7 +1,9 @@ +import scala.reflect.{ClassTag, classTag} + /** Test matrix multiplication with specialization. */ -class Matrix[@specialized A: ArrayTag](val rows: Int, val cols: Int) { +class Matrix[@specialized A: ClassTag](val rows: Int, val cols: Int) { private val arr: Array[Array[A]] = Array.ofDim[A](rows, cols) def apply(i: Int, j: Int): A = { @@ -52,7 +54,7 @@ object Test { } } - def multTag[@specialized(Int) T](m: Matrix[T], n: Matrix[T])(implicit at: ArrayTag[T], num: Numeric[T]) { + def multTag[@specialized(Int) T](m: Matrix[T], n: Matrix[T])(implicit at: ClassTag[T], num: Numeric[T]) { val p = new Matrix[T](m.rows, n.cols) import num._ @@ -77,4 +79,4 @@ object Test { } p } -} +}
\ No newline at end of file diff --git a/test/files/speclib/instrumented.jar.desired.sha1 b/test/files/speclib/instrumented.jar.desired.sha1 index a7da67429e..24856fe19a 100644 --- a/test/files/speclib/instrumented.jar.desired.sha1 +++ b/test/files/speclib/instrumented.jar.desired.sha1 @@ -1 +1 @@ -15f200d9f0f25f9fd871bad2ebb4ba5cfc671db4 ?instrumented.jar +474d8c20ab31438d5d4a2ba6bc07ebdcdb530b50 ?instrumented.jar |