diff options
Diffstat (limited to 'test/files/run')
419 files changed, 3337 insertions, 2303 deletions
diff --git a/test/files/run/Meter.scala b/test/files/run/Meter.scala index d94f338ca9..a10ad31b4a 100644 --- a/test/files/run/Meter.scala +++ b/test/files/run/Meter.scala @@ -1,8 +1,13 @@ package a { + abstract class BoxingConversions[Boxed, Unboxed] { + def box(x: Unboxed): Boxed + def unbox(x: Boxed): Unboxed + } + class Meter(val underlying: Double) extends AnyVal with _root_.b.Printable { def + (other: Meter): Meter = new Meter(this.underlying + other.underlying) - def / (other: Meter): Double = this.underlying / other.underlying + def / (other: Meter)(implicit dummy: Meter.MeterArg = null): Double = this.underlying / other.underlying def / (factor: Double): Meter = new Meter(this.underlying / factor) def < (other: Meter): Boolean = this.underlying < other.underlying def toFoot: Foot = new Foot(this.underlying * 0.3048) @@ -12,6 +17,8 @@ package a { object Meter extends (Double => Meter) { + private[a] trait MeterArg + def apply(x: Double): Meter = new Meter(x) implicit val boxings = new BoxingConversions[Meter, Double] { @@ -80,7 +87,7 @@ object Test extends App { println(m) foo(arr) } - // + // // { println("testing wrapped arrays") // import collection.mutable.FlatArray // val arr = FlatArray(x, y + x) diff --git a/test/files/run/MeterCaseClass.scala b/test/files/run/MeterCaseClass.scala index e5979cf761..39d95c2af5 100644 --- a/test/files/run/MeterCaseClass.scala +++ b/test/files/run/MeterCaseClass.scala @@ -1,8 +1,13 @@ package a { + abstract class BoxingConversions[Boxed, Unboxed] { + def box(x: Unboxed): Boxed + def unbox(x: Boxed): Unboxed + } + case class Meter(underlying: Double) extends AnyVal with _root_.b.Printable { def + (other: Meter): Meter = new Meter(this.underlying + other.underlying) - def / (other: Meter): Double = this.underlying / other.underlying + def / (other: Meter)(implicit dummy: Meter.MeterArg = null): Double = this.underlying / other.underlying def / (factor: Double): Meter = new Meter(this.underlying / factor) def < (other: Meter): Boolean = this.underlying < other.underlying def toFoot: Foot = new Foot(this.underlying * 0.3048) @@ -11,6 +16,8 @@ package a { object Meter extends (Double => Meter) { + private[a] trait MeterArg + implicit val boxings = new BoxingConversions[Meter, Double] { def box(x: Double) = new Meter(x) def unbox(m: Meter) = m.underlying @@ -77,7 +84,7 @@ object Test extends App { println(m) foo(arr) } - // + // // { println("testing wrapped arrays") // import collection.mutable.FlatArray // val arr = FlatArray(x, y + x) diff --git a/test/files/run/abstypetags_core.check b/test/files/run/abstypetags_core.check index 8d20e099c4..980b4719bf 100644 --- a/test/files/run/abstypetags_core.check +++ b/test/files/run/abstypetags_core.check @@ -1,30 +1,30 @@ -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[AnyVal]
-true
-TypeTag[AnyRef]
-true
-TypeTag[java.lang.Object]
-true
-TypeTag[Null]
-true
-TypeTag[Nothing]
+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[AnyVal] +true +TypeTag[AnyRef] +true +TypeTag[java.lang.Object] +true +TypeTag[Null] +true +TypeTag[Nothing] diff --git a/test/files/run/abstypetags_serialize.check b/test/files/run/abstypetags_serialize.check index aafb4761ad..bddc4523e6 100644 --- a/test/files/run/abstypetags_serialize.check +++ b/test/files/run/abstypetags_serialize.check @@ -1,2 +1,2 @@ -java.io.NotSerializableException: Test$$typecreator1$1
-java.io.NotSerializableException: Test$$typecreator2$1
+java.io.NotSerializableException: Test$$typecreator1$1 +java.io.NotSerializableException: Test$$typecreator2$1 diff --git a/test/files/run/abstypetags_serialize.scala b/test/files/run/abstypetags_serialize.scala index 38a7aba325..93fb5dcd06 100644 --- a/test/files/run/abstypetags_serialize.scala +++ b/test/files/run/abstypetags_serialize.scala @@ -1,5 +1,6 @@ import java.io._ import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} import scala.reflect.runtime.{currentMirror => cm} object Test extends App { @@ -13,7 +14,7 @@ object Test extends App { val fin = new ByteArrayInputStream(fout.toByteArray) val in = new ObjectInputStream(fin) - val retag = in.readObject().asInstanceOf[scala.reflect.basis.WeakTypeTag[_]].in(cm) + val retag = in.readObject().asInstanceOf[ru.WeakTypeTag[_]].in(cm) in.close() fin.close() diff --git a/test/files/run/applydynamic_sip.check b/test/files/run/applydynamic_sip.check index d94db4417e..6d04dc4524 100644 --- a/test/files/run/applydynamic_sip.check +++ b/test/files/run/applydynamic_sip.check @@ -20,3 +20,10 @@ qual.selectDynamic(sel) qual.selectDynamic(sel) .apply .update(1, 1) +qual.applyDynamic(apply)(a) +qual.applyDynamic(apply)(a) +qual.applyDynamic(apply)(a) +qual.applyDynamic(apply)(a) +qual.applyDynamicNamed(apply)((arg,a)) +qual.applyDynamicNamed(apply)((,a), (arg2,a2)) +qual.applyDynamic(update)(a, a2) diff --git a/test/files/run/applydynamic_sip.scala b/test/files/run/applydynamic_sip.scala index 57cb4349f7..cf918a82ed 100644 --- a/test/files/run/applydynamic_sip.scala +++ b/test/files/run/applydynamic_sip.scala @@ -55,4 +55,12 @@ object Test extends App { qual.sel() = expr // parser turns this into qual.sel.update(expr) qual.sel.apply(1) qual.sel.apply(1) = 1 -}
\ No newline at end of file + + qual.apply(a) + qual.apply[String](a) + qual(a) + qual[String](a) + qual[T](arg = a) + qual(a, arg2 = "a2") + qual(a) = a2 +} diff --git a/test/files/run/classmanifests_new_alias.check b/test/files/run/classmanifests_new_alias.check index ffb8482f91..032521a929 100644 --- a/test/files/run/classmanifests_new_alias.check +++ b/test/files/run/classmanifests_new_alias.check @@ -1,2 +1,2 @@ -Int
-true
+Int +true diff --git a/test/files/run/classmanifests_new_core.check b/test/files/run/classmanifests_new_core.check index ffb8482f91..032521a929 100644 --- a/test/files/run/classmanifests_new_core.check +++ b/test/files/run/classmanifests_new_core.check @@ -1,2 +1,2 @@ -Int
-true
+Int +true diff --git a/test/files/run/classtags_contextbound.check b/test/files/run/classtags_contextbound.check index 4104d544ba..604122846e 100644 --- a/test/files/run/classtags_contextbound.check +++ b/test/files/run/classtags_contextbound.check @@ -1 +1 @@ -class [I
+class [I diff --git a/test/files/run/classtags_core.check b/test/files/run/classtags_core.check index 5a9b41fd6d..d5c4386482 100644 --- a/test/files/run/classtags_core.check +++ b/test/files/run/classtags_core.check @@ -1,30 +1,30 @@ -true
-Byte
-true
-Short
-true
-Char
-true
-Int
-true
-Long
-true
-Float
-true
-Double
-true
-Boolean
-true
-Unit
-true
-Any
-true
-AnyVal
-true
-Object
-true
-Object
-true
-Null
-true
-Nothing
+true +Byte +true +Short +true +Char +true +Int +true +Long +true +Float +true +Double +true +Boolean +true +Unit +true +Any +true +AnyVal +true +Object +true +Object +true +Null +true +Nothing diff --git a/test/files/run/classtags_multi.check b/test/files/run/classtags_multi.check index 68cee4841d..56da87eeb1 100644 --- a/test/files/run/classtags_multi.check +++ b/test/files/run/classtags_multi.check @@ -1,5 +1,5 @@ -Int
-Array[int]
-Array[Array[int]]
-Array[Array[Array[int]]]
-Array[Array[Array[Array[int]]]]
+Int +Array[int] +Array[Array[int]] +Array[Array[Array[int]]] +Array[Array[Array[Array[int]]]] diff --git a/test/files/run/collection-stacks.check b/test/files/run/collection-stacks.check new file mode 100644 index 0000000000..aa25cd1fa6 --- /dev/null +++ b/test/files/run/collection-stacks.check @@ -0,0 +1,14 @@ +3-2-1: true +3-2-1: true +apply +3: true +3: true +1: true +1: true +top +3: true +3: true +pop +2-1: true +3: true +2-1: true diff --git a/test/files/run/collection-stacks.scala b/test/files/run/collection-stacks.scala new file mode 100644 index 0000000000..fbee3f8594 --- /dev/null +++ b/test/files/run/collection-stacks.scala @@ -0,0 +1,38 @@ +import scala.collection.{ immutable, mutable } + +object Test extends Application { + def mutableStack[T](xs: T*): mutable.Stack[T] = { + val s = new mutable.Stack[T] + s.pushAll(xs) + s + } + + def immutableStack[T](xs: T*): immutable.Stack[T] = { + immutable.Stack.empty[T] pushAll xs + } + + def check[T](expected: T, got: T) { + println(got + ": " + (expected == got)) + } + + // check #957 + check("3-2-1", immutableStack(1, 2, 3).iterator.mkString("-")) + check("3-2-1", mutableStack(1, 2, 3).iterator.mkString("-")) + + println("apply") + check(3, immutableStack(1, 2, 3).apply(0)) + check(3, mutableStack(1, 2, 3).apply(0)) + check(1, immutableStack(1, 2, 3).apply(2)) + check(1, mutableStack(1, 2, 3).apply(2)) + + println("top") + check(3, immutableStack(1, 2, 3).top) + check(3, mutableStack(1, 2, 3).top) + + println("pop") + check("2-1", immutableStack(1, 2, 3).pop.mkString("-")) + check(3, mutableStack(1, 2, 3).pop()) + check("2-1", { val s = mutableStack(1, 2, 3); s.pop(); s.toList.mkString("-") }) +} + +// vim: set ts=2 sw=2 et: diff --git a/test/files/run/collections.check b/test/files/run/collections.check index b87a5998c5..c24150b24d 100644 --- a/test/files/run/collections.check +++ b/test/files/run/collections.check @@ -2,6 +2,10 @@ test1: 14005 test2: 25005003, iters = 5000 test3: 25005003 +***** mutable.LinkedHashSet: +test1: 14005 +test2: 25005003, iters = 5000 +test3: 25005003 ***** immutable.Set: test1: 14005 test2: 25005003, iters = 5000 @@ -18,6 +22,10 @@ test3: 25005003 test1: 14005 test2: 25005003, iters = 5000 test3: 25005003 +***** mutable.LinkedHashMap: +test1: 14005 +test2: 25005003, iters = 5000 +test3: 25005003 ***** immutable.Map: test1: 14005 test2: 25005003, iters = 5000 diff --git a/test/files/run/collections.scala b/test/files/run/collections.scala index 60f0765e6a..69c40fae80 100644 --- a/test/files/run/collections.scala +++ b/test/files/run/collections.scala @@ -106,10 +106,12 @@ object Test extends App { } test("mutable.HashSet", new mutable.HashSet[Int], 5000) + test("mutable.LinkedHashSet", new mutable.LinkedHashSet[Int], 5000) test("immutable.Set", immutable.Set[Int](), 5000) test("immutable.ListSet", new immutable.ListSet[Int], 5000) test("immutable.TreeSet", new immutable.TreeSet[Int], 5000) test("mutable.HashMap", new mutable.HashMap[Int, Int], 5000) + test("mutable.LinkedHashMap", new mutable.LinkedHashMap[Int, Int], 5000) test("immutable.Map", immutable.Map[Int, Int](), 5000) test("immutable.TreeMap", new immutable.TreeMap[Int, Int], 5000) test("immutable.ListMap", new immutable.ListMap[Int, Int], 3000) diff --git a/test/files/run/colltest.check b/test/files/run/colltest.check index 1ad81a1350..e5bb013ed7 100644 --- a/test/files/run/colltest.check +++ b/test/files/run/colltest.check @@ -5,3 +5,4 @@ false true false succeeded for 10 iterations. +succeeded for 10 iterations. diff --git a/test/files/run/colltest.scala b/test/files/run/colltest.scala index ecd234bdd1..703e94a3c7 100644 --- a/test/files/run/colltest.scala +++ b/test/files/run/colltest.scala @@ -61,5 +61,6 @@ object Test extends App { } t3954 - new TestSet(HashSet.empty, new scala.collection.mutable.LinkedHashSet) + new TestSet(HashSet.empty, new LinkedHashSet) + new TestSet(new ImmutableSetAdaptor(collection.immutable.Set.empty[Int]), new LinkedHashSet) } diff --git a/test/files/run/colltest1.check b/test/files/run/colltest1.check index 7377174281..5ec6286d9e 100644 --- a/test/files/run/colltest1.check +++ b/test/files/run/colltest1.check @@ -107,3 +107,5 @@ List((A,A), (B,B), (C,C), (D,D), (E,E), (F,F), (G,G), (H,H), (I,I), (J,J), (K,K) List((A,A), (B,B), (C,C), (D,D), (E,E), (F,F), (G,G), (H,H), (I,I), (J,J), (K,K), (L,L), (M,M), (N,N), (O,O), (P,P), (Q,Q), (R,R), (S,S), (T,T), (U,U), (V,V), (W,W), (X,X), (Y,Y), (Z,Z)) List((A,A), (B,B), (C,C), (D,D), (E,E), (F,F), (G,G), (H,H), (I,I), (J,J), (K,K), (L,L), (M,M), (N,N), (O,O), (P,P), (Q,Q), (R,R), (S,S), (T,T), (U,U), (V,V), (W,W), (X,X), (Y,Y), (Z,Z)) List((A,A), (B,B), (C,C), (D,D), (E,E), (F,F), (G,G), (H,H), (I,I), (J,J), (K,K), (L,L), (M,M), (N,N), (O,O), (P,P), (Q,Q), (R,R), (S,S), (T,T), (U,U), (V,V), (W,W), (X,X), (Y,Y), (Z,Z)) +List((A,A), (B,B), (C,C), (D,D), (E,E), (F,F), (G,G), (H,H), (I,I), (J,J), (K,K), (L,L), (M,M), (N,N), (O,O), (P,P), (Q,Q), (R,R), (S,S), (T,T), (U,U), (V,V), (W,W), (X,X), (Y,Y), (Z,Z)) +List((A,A), (B,B), (C,C), (D,D), (E,E), (F,F), (G,G), (H,H), (I,I), (J,J), (K,K), (L,L), (M,M), (N,N), (O,O), (P,P), (Q,Q), (R,R), (S,S), (T,T), (U,U), (V,V), (W,W), (X,X), (Y,Y), (Z,Z)) diff --git a/test/files/run/colltest1.scala b/test/files/run/colltest1.scala index 1cbd932222..54adeb7cda 100644 --- a/test/files/run/colltest1.scala +++ b/test/files/run/colltest1.scala @@ -226,6 +226,7 @@ object Test extends App { setTest(mutable.Set()) setTest(immutable.Set()) setTest(mutable.HashSet()) + setTest(mutable.LinkedHashSet()) setTest(immutable.HashSet()) mapTest(Map()) @@ -233,5 +234,6 @@ object Test extends App { mapTest(immutable.Map()) mapTest(immutable.TreeMap()) mutableMapTest(mutable.HashMap()) + mutableMapTest(mutable.LinkedHashMap()) mapTest(immutable.HashMap()) } diff --git a/test/files/run/constant-type.check b/test/files/run/constant-type.check new file mode 100644 index 0000000000..4eededb8ba --- /dev/null +++ b/test/files/run/constant-type.check @@ -0,0 +1,30 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> :power +** Power User mode enabled - BEEP WHIR GYVE ** +** :phase has been set to 'typer'. ** +** scala.tools.nsc._ has been imported ** +** global._, definitions._ also imported ** +** Try :help, :vals, power.<tab> ** + +scala> val s = transformedType(StringClass.toType).asInstanceOf[Type] +s: $r.intp.global.Type = String + +scala> { println(exitingPhase(currentRun.erasurePhase)(ConstantType(Constant(s)))) } +Class[String](classOf[java.lang.String]) + +scala> { exitingPhase(currentRun.erasurePhase)(println(ConstantType(Constant(s)))) } +Class(classOf[java.lang.String]) + +scala> { ConstantType(Constant(s)); println(exitingPhase(currentRun.erasurePhase)(ConstantType(Constant(s)))); } +Class[String](classOf[java.lang.String]) + +scala> { ConstantType(Constant(s)); exitingPhase(currentRun.erasurePhase)(println(ConstantType(Constant(s)))); } +Class(classOf[java.lang.String]) + +scala> + +scala> diff --git a/test/files/run/constant-type.scala b/test/files/run/constant-type.scala new file mode 100644 index 0000000000..373746af4a --- /dev/null +++ b/test/files/run/constant-type.scala @@ -0,0 +1,17 @@ +import scala.tools.partest.ReplTest + +// see the commit message to understand what this stuff is about +// just a quick note: +// transformedType returns an erased version of the type +// as explained in the commit message, Type.erasure won't do for this test +// because it does some postprocessing to the result of transformedType +object Test extends ReplTest { + def code = """ +:power +val s = transformedType(StringClass.toType).asInstanceOf[Type] +{ println(exitingPhase(currentRun.erasurePhase)(ConstantType(Constant(s)))) } +{ exitingPhase(currentRun.erasurePhase)(println(ConstantType(Constant(s)))) } +{ ConstantType(Constant(s)); println(exitingPhase(currentRun.erasurePhase)(ConstantType(Constant(s)))); } +{ ConstantType(Constant(s)); exitingPhase(currentRun.erasurePhase)(println(ConstantType(Constant(s)))); } + """ +} diff --git a/test/files/run/deeps.check b/test/files/run/deeps.check new file mode 100644 index 0000000000..a68e474f62 --- /dev/null +++ b/test/files/run/deeps.check @@ -0,0 +1,87 @@ +testEquals1 +false +false +true + +testEquals2 +false +false +true + +testEquals3 +x=Array(1) +y=Array(1) +false +false +true + +x=Array(Array(1), Array(1)) +y=Array(Array(1), Array(1)) +false +false +true + +x=Array(Array(Array(1), Array(1)), Array(Array(1), Array(1))) +y=Array(Array(Array(1), Array(1)), Array(Array(1), Array(1))) +false +false +true + +testEquals4 +false +false +true +false +false +true +Array(true, false) +Array(true, false) +[true;false] +true;false + +Array(Array(true, false), Array(true, false)) +Array(Array(true, false), Array(true, false)) +[Array(true, false);Array(true, false)] +Array(true, false);Array(true, false) + +Array(Array(Array(true, false), Array(true, false)), Array(Array(true, false), Array(true, false))) +Array(Array(Array(true, false), Array(true, false)), Array(Array(true, false), Array(true, false))) +[Array(Array(true, false), Array(true, false));Array(Array(true, false), Array(true, false))] +Array(Array(true, false), Array(true, false));Array(Array(true, false), Array(true, false)) + +Array(1.0, 0.0) +Array(1.0, 0.0) +[1.0;0.0] +1.0;0.0 + +Array(Array(1.0, 0.0), Array(1.0, 0.0)) +Array(Array(1.0, 0.0), Array(1.0, 0.0)) +[Array(1.0, 0.0);Array(1.0, 0.0)] +Array(1.0, 0.0);Array(1.0, 0.0) + +Array(Array(Array(1.0, 0.0), Array(1.0, 0.0)), Array(Array(1.0, 0.0), Array(1.0, 0.0))) +Array(Array(Array(1.0, 0.0), Array(1.0, 0.0)), Array(Array(1.0, 0.0), Array(1.0, 0.0))) +[Array(Array(1.0, 0.0), Array(1.0, 0.0));Array(Array(1.0, 0.0), Array(1.0, 0.0))] +Array(Array(1.0, 0.0), Array(1.0, 0.0));Array(Array(1.0, 0.0), Array(1.0, 0.0)) + +Array(a, b) +Array(a, b) +[a;b] +a;b + +Array(Array(a, b), Array(a, b)) +Array(Array(a, b), Array(a, b)) +[Array(a, b);Array(a, b)] +Array(a, b);Array(a, b) + +Array(Array(Array(a, b), Array(a, b)), Array(Array(a, b), Array(a, b))) +Array(Array(Array(a, b), Array(a, b)), Array(Array(a, b), Array(a, b))) +[Array(Array(a, b), Array(a, b));Array(Array(a, b), Array(a, b))] +Array(Array(a, b), Array(a, b));Array(Array(a, b), Array(a, b)) + +[Array(true, false); Array(false)] +[Array(1, 2); Array(3)] +[Array(1, 2); Array(3)] + +Array(boo, and, foo) +Array(a) diff --git a/test/files/run/deeps.scala b/test/files/run/deeps.scala new file mode 100644 index 0000000000..6049cc6024 --- /dev/null +++ b/test/files/run/deeps.scala @@ -0,0 +1,114 @@ +//############################################################################ +// deepEquals / deep.toString +//############################################################################ + +//############################################################################ +// need to revisit array equqality +object Test { + + def testEquals1 { + println(Array(1) == Array(1)) + println(Array(1) equals Array(1)) + println(Array(1).deep == Array(1).deep) + println + } + + def testEquals2 { + println(Array(Array(1), Array(2)) == Array(Array(1), Array(2))) + println(Array(Array(1), Array(2)) equals Array(Array(1), Array(2))) + println(Array(Array(1), Array(2)).deep equals Array(Array(1), Array(2)).deep) + println + } + + def testEquals3 { + val a1 = Array(1) + val b1 = Array(1) + val a2 = Array(a1, b1) + val b2 = Array(a1, b1) + val a3 = Array(a2, b2) + val b3 = Array(a2, b2) + def test[T](x: Array[T], y: Array[T]) { + println("x=" + x.deep.toString) + println("y=" + y.deep.toString) + println(x == y) + println(x equals y) + println(x.deep == y.deep) + println + } + test(a1, b1) + test(a2, b2) + test(a3, b3) + } + + def testEquals4 { + println("boo:and:foo".split(':') == "boo:and:foo".split(':')) + println("boo:and:foo".split(':') equals "boo:and:foo".split(':')) + println("boo:and:foo".split(':').deep == "boo:and:foo".split(':').deep) + + val xs = new java.util.ArrayList[String](); xs.add("a") + val ys = new java.util.ArrayList[String](); ys.add("a") + println(xs.toArray == ys.toArray) + println(xs.toArray equals ys.toArray) + println(xs.toArray.deep == ys.toArray.deep) + } + + def testToString1 { + def sweep(s: String) = ( + s.replaceAll("D@[0-9a-fA-F]+", "D@0000000") + .replaceAll("Z@[0-9a-fA-F]+", "Z@0000000") + .replaceAll(";@[0-9a-fA-F]+", ";@0000000") + ) + def test[T](a: Array[T]) { + println(sweep(a.deep.toString)) + println(a.deep.toString) + println(a.deep.mkString("[", ";", "]")) + println(a.deep.mkString(";")) + println + } + + val ba1 = Array(true, false) + val ba2 = Array(ba1, ba1) + val ba3 = Array(ba2, ba2) + test(ba1) + test(ba2) + test(ba3) + + val da1 = Array(1.0d, 0.0d) + val da2 = Array(da1, da1) + val da3 = Array(da2, da2) + test(da1) + test(da2) + test(da3) + + val sa1 = Array("a", "b") + val sa2 = Array(sa1, sa1) + val sa3 = Array(sa2, sa2) + test(sa1) + test(sa2) + test(sa3) + } + + def testToString2 { + println(Array(Array(true, false), Array(false)).deep.mkString("[", "; ", "]")) + println(Array(Array('1', '2'), Array('3')).deep.mkString("[", "; ", "]")) + println(Array(Array(1, 2), Array(3)).deep.mkString("[", "; ", "]")) + println + } + + def testToString3 { + println("boo:and:foo".split(':').deep.toString) + + val xs = new java.util.ArrayList[String](); xs.add("a") + println(xs.toArray.deep.toString) + } + + def main(args: Array[String]): Unit = { + println("testEquals1") ; testEquals1 + println("testEquals2") ; testEquals2 + println("testEquals3") ; testEquals3 + println("testEquals4") ; testEquals4 + testToString1 + testToString2 + testToString3 + } +} diff --git a/test/files/run/empty-array.check b/test/files/run/empty-array.check new file mode 100644 index 0000000000..bb0b1cf658 --- /dev/null +++ b/test/files/run/empty-array.check @@ -0,0 +1,3 @@ +0 +0 +0 diff --git a/test/files/run/empty-array.scala b/test/files/run/empty-array.scala new file mode 100644 index 0000000000..6e37dca37d --- /dev/null +++ b/test/files/run/empty-array.scala @@ -0,0 +1,8 @@ +object Test { + def main(args: Array[String]): Unit = { + println(Array.emptyByteArray.length) + println(Array.emptyDoubleArray.length) + println(Array.emptyBooleanArray.length) + // okay okay okay + } +} diff --git a/test/files/run/existentials3-new.check b/test/files/run/existentials3-new.check index 2550f4dae0..00614b19db 100644 --- a/test/files/run/existentials3-new.check +++ b/test/files/run/existentials3-new.check @@ -1,24 +1,24 @@ -Bar.type, t=TypeRef, s=type Bar.type
-Bar, t=TypeRef, s=type 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=TypeRef, s=type $anon
-$anon, t=TypeRef, s=type $anon
-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=TypeRef, s=type Bar.type
-Bar, t=TypeRef, s=type 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=TypeRef, s=type $anon
-$anon, t=TypeRef, s=type $anon
-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=TypeRef, s=type Bar.type +Bar, t=TypeRef, s=type Bar +Test.ToS, t=RefinedType, s=f3 +Test.ToS, t=RefinedType, s=f4 +Test.ToS, t=RefinedType, s=f5 +() => Test.ToS, t=TypeRef, s=trait Function0 +() => Test.ToS, t=TypeRef, s=trait Function0 +$anon, t=TypeRef, s=type $anon +$anon, t=TypeRef, s=type $anon +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=TypeRef, s=type Bar.type +Bar, t=TypeRef, s=type Bar +Test.ToS, t=RefinedType, s=g3 +Test.ToS, t=RefinedType, s=g4 +Test.ToS, t=RefinedType, s=g5 +() => Test.ToS, t=TypeRef, s=trait Function0 +() => Test.ToS, t=TypeRef, s=trait Function0 +$anon, t=TypeRef, s=type $anon +$anon, t=TypeRef, s=type $anon +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/exprs_serialize.check b/test/files/run/exprs_serialize.check index a3bf9ccdc4..20ad6c110c 100644 --- a/test/files/run/exprs_serialize.check +++ b/test/files/run/exprs_serialize.check @@ -1,2 +1,2 @@ -java.io.NotSerializableException: Test$$treecreator1$1
-java.io.NotSerializableException: Test$$treecreator2$1
+java.io.NotSerializableException: Test$$treecreator1$1 +java.io.NotSerializableException: Test$$treecreator2$1 diff --git a/test/files/run/exprs_serialize.scala b/test/files/run/exprs_serialize.scala index 075c902a34..c4310b0fe1 100644 --- a/test/files/run/exprs_serialize.scala +++ b/test/files/run/exprs_serialize.scala @@ -1,5 +1,6 @@ import java.io._ import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} import scala.reflect.runtime.{currentMirror => cm} object Test extends App { @@ -13,7 +14,7 @@ object Test extends App { val fin = new ByteArrayInputStream(fout.toByteArray) val in = new ObjectInputStream(fin) - val reexpr = in.readObject().asInstanceOf[scala.reflect.basis.Expr[_]].in(cm) + val reexpr = in.readObject().asInstanceOf[ru.Expr[_]].in(cm) in.close() fin.close() diff --git a/test/files/run/fail-non-value-types.check b/test/files/run/fail-non-value-types.check new file mode 100644 index 0000000000..714dce2c50 --- /dev/null +++ b/test/files/run/fail-non-value-types.check @@ -0,0 +1,3 @@ +[B, That](f: A => B)(implicit cbf: ImaginaryCanBuildFrom[CompletelyIndependentList.this.Repr,B,That])That +[B, That](f: Int => B)(implicit cbf: ImaginaryCanBuildFrom[CompletelyIndependentList[Int]#Repr,B,That])That +()CompletelyIndependentList[A] diff --git a/test/files/run/fail-non-value-types.scala b/test/files/run/fail-non-value-types.scala new file mode 100644 index 0000000000..51198a5f31 --- /dev/null +++ b/test/files/run/fail-non-value-types.scala @@ -0,0 +1,40 @@ +import scala.reflect.runtime.universe._ + +class ImaginaryCanBuildFrom[-From, -Elem, +To] +class CompletelyIndependentList[+A] { + type Repr <: CompletelyIndependentList[A] + def map[B, That](f: A => B)(implicit cbf: ImaginaryCanBuildFrom[Repr, B, That]): That = ??? + def distinct(): CompletelyIndependentList[A] = ??? +} + +object Test { + var failed = false + def expectFailure[T](body: => T): Boolean = { + try { val res = body ; failed = true ; println(res + " failed to fail.") ; false } + catch { case _: AssertionError => true } + } + + /** Attempt to use a method type as a type argument - expect failure. */ + def tcon[T: TypeTag](args: Type*) = appliedType(typeOf[T].typeConstructor, args.toList) + + def cil = typeOf[CompletelyIndependentList[Int]] + def map = cil.member("map": TermName).asMethod + def distinct = cil.member("distinct": TermName).asMethod + + def main(args: Array[String]): Unit = { + // Need the assert in there to fail. + // expectFailure(println(tcon[CompletelyIndependentList[Int]](map))) + // expectFailure(tcon[CompletelyIndependentList[Int]](distinct)) + + // Why is the first map signature printing showing an + // uninitialized symbol? + // + // [B <: <?>, That <: <?>](f: <?>)(implicit cbf: <?>)That + // + + println(map.typeSignature) + println(map.typeSignatureIn(cil)) + println(distinct.typeSignature) + if (failed) sys.exit(1) + } +} diff --git a/test/files/run/freetypes_false_alarm1.check b/test/files/run/freetypes_false_alarm1.check index 92efacc2b7..a9df3544ac 100644 --- a/test/files/run/freetypes_false_alarm1.check +++ b/test/files/run/freetypes_false_alarm1.check @@ -1 +1 @@ -List[Int]
+List[Int] diff --git a/test/files/run/interop_classtags_are_classmanifests.check b/test/files/run/interop_classtags_are_classmanifests.check index c07ed0e657..5a8fc2b782 100644 --- a/test/files/run/interop_classtags_are_classmanifests.check +++ b/test/files/run/interop_classtags_are_classmanifests.check @@ -1,3 +1,3 @@ -Int
-java.lang.String
-Array[int]
+Int +java.lang.String +Array[int] diff --git a/test/files/run/interop_manifests_are_abstypetags.check b/test/files/run/interop_manifests_are_abstypetags.check index c59e92d4eb..19a35ad3db 100644 --- a/test/files/run/interop_manifests_are_abstypetags.check +++ b/test/files/run/interop_manifests_are_abstypetags.check @@ -1,3 +1,3 @@ -Int
-java.lang.String
-Array[Int]
+Int +java.lang.String +Array[Int] diff --git a/test/files/run/interop_manifests_are_classtags.check b/test/files/run/interop_manifests_are_classtags.check index aaf4aba012..f3f704121b 100644 --- a/test/files/run/interop_manifests_are_classtags.check +++ b/test/files/run/interop_manifests_are_classtags.check @@ -1,18 +1,18 @@ -Int
-List()
-List(0, 0, 0, 0, 0)
-java.lang.String
-List()
-List(null, null, null, null, null)
-Array[Int]
-List()
-List(null, null, null, null, null)
-Int
-List()
-List(0, 0, 0, 0, 0)
-java.lang.String
-List()
-List(null, null, null, null, null)
-Array[Int]
-List()
-List(null, null, null, null, null)
+Int +List() +List(0, 0, 0, 0, 0) +java.lang.String +List() +List(null, null, null, null, null) +Array[Int] +List() +List(null, null, null, null, null) +Int +List() +List(0, 0, 0, 0, 0) +java.lang.String +List() +List(null, null, null, null, null) +Array[Int] +List() +List(null, null, null, null, null) diff --git a/test/files/run/interop_manifests_are_typetags.check b/test/files/run/interop_manifests_are_typetags.check index c59e92d4eb..19a35ad3db 100644 --- a/test/files/run/interop_manifests_are_typetags.check +++ b/test/files/run/interop_manifests_are_typetags.check @@ -1,3 +1,3 @@ -Int
-java.lang.String
-Array[Int]
+Int +java.lang.String +Array[Int] diff --git a/test/files/run/interop_typetags_are_manifests.check b/test/files/run/interop_typetags_are_manifests.check index 871167e3ab..e02de1fdc2 100644 --- a/test/files/run/interop_typetags_are_manifests.check +++ b/test/files/run/interop_typetags_are_manifests.check @@ -1,3 +1,3 @@ -int
-java.lang.String
-Array[Int]
+int +java.lang.String +Array[Int] diff --git a/test/files/run/macro-abort-fresh.check b/test/files/run/macro-abort-fresh.check index 28057c2883..75ad5e79f8 100644 --- a/test/files/run/macro-abort-fresh.check +++ b/test/files/run/macro-abort-fresh.check @@ -1,6 +1,6 @@ -$1$
-qwe1
-qwe2
-reflective compilation has failed:
-
-blargh
+$1$ +qwe1 +qwe2 +reflective compilation has failed: + +blargh diff --git a/test/files/run/macro-abort-fresh/Test_2.scala b/test/files/run/macro-abort-fresh/Test_2.scala index c6caa2b585..15c498efb0 100644 --- a/test/files/run/macro-abort-fresh/Test_2.scala +++ b/test/files/run/macro-abort-fresh/Test_2.scala @@ -3,6 +3,6 @@ object Test extends App { import scala.reflect.runtime.{currentMirror => cm} import scala.tools.reflect.ToolBox val tree = Select(Ident("Macros"), newTermName("foo")) - try cm.mkToolBox().runExpr(tree) + try cm.mkToolBox().eval(tree) catch { case ex: Throwable => println(ex.getMessage) } }
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-annotation.check b/test/files/run/macro-declared-in-annotation.check index 1ea14b4e20..7658ad2c24 100644 --- a/test/files/run/macro-declared-in-annotation.check +++ b/test/files/run/macro-declared-in-annotation.check @@ -1 +1 @@ -it works
+it works diff --git a/test/files/run/macro-declared-in-block.check b/test/files/run/macro-declared-in-block.check index a61fd13087..5e687db8bf 100644 --- a/test/files/run/macro-declared-in-block.check +++ b/test/files/run/macro-declared-in-block.check @@ -1,2 +1,2 @@ -prefix = Expr[Nothing](<empty>)
-it works
+prefix = Expr[Nothing](<empty>) +it works diff --git a/test/files/run/macro-declared-in-class-class.check b/test/files/run/macro-declared-in-class-class.check index 480c2f906f..47248d7af7 100644 --- a/test/files/run/macro-declared-in-class-class.check +++ b/test/files/run/macro-declared-in-class-class.check @@ -1,2 +1,2 @@ -prefix = Expr[Nothing](new Test.this.outer.Macros())
-it works
+prefix = Expr[Nothing](new Test.this.outer.Macros()) +it works diff --git a/test/files/run/macro-declared-in-class-object.check b/test/files/run/macro-declared-in-class-object.check index f7ba5a53cb..35af59e40f 100644 --- a/test/files/run/macro-declared-in-class-object.check +++ b/test/files/run/macro-declared-in-class-object.check @@ -1,2 +1,2 @@ -prefix = Expr[Nothing](Test.this.outer.Macros)
-it works
+prefix = Expr[Nothing](Test.this.outer.Macros) +it works diff --git a/test/files/run/macro-declared-in-class.check b/test/files/run/macro-declared-in-class.check index 946851e4bb..a1c1d7af8b 100644 --- a/test/files/run/macro-declared-in-class.check +++ b/test/files/run/macro-declared-in-class.check @@ -1,2 +1,2 @@ -prefix = Expr[Nothing](new Macros())
-it works
+prefix = Expr[Nothing](new Macros()) +it works diff --git a/test/files/run/macro-declared-in-default-param.check b/test/files/run/macro-declared-in-default-param.check index 00052ad018..6decd7aa4d 100644 --- a/test/files/run/macro-declared-in-default-param.check +++ b/test/files/run/macro-declared-in-default-param.check @@ -1,5 +1,5 @@ -prefix = Expr[Nothing](<empty>)
-it works
-it works
-prefix = Expr[Nothing](<empty>)
-it works
+prefix = Expr[Nothing](<empty>) +it works +it works +prefix = Expr[Nothing](<empty>) +it works diff --git a/test/files/run/macro-declared-in-implicit-class.check b/test/files/run/macro-declared-in-implicit-class.check index b3640ceaa7..5dc968c08c 100644 --- a/test/files/run/macro-declared-in-implicit-class.check +++ b/test/files/run/macro-declared-in-implicit-class.check @@ -1,2 +1,2 @@ -prefix = Expr[Nothing](Macros.foo("2"))
-Some(2)
+prefix = Expr[Nothing](Macros.foo("2")) +Some(2) diff --git a/test/files/run/macro-declared-in-method.check b/test/files/run/macro-declared-in-method.check index a61fd13087..5e687db8bf 100644 --- a/test/files/run/macro-declared-in-method.check +++ b/test/files/run/macro-declared-in-method.check @@ -1,2 +1,2 @@ -prefix = Expr[Nothing](<empty>)
-it works
+prefix = Expr[Nothing](<empty>) +it works diff --git a/test/files/run/macro-declared-in-object-class.check b/test/files/run/macro-declared-in-object-class.check index 480c2f906f..47248d7af7 100644 --- a/test/files/run/macro-declared-in-object-class.check +++ b/test/files/run/macro-declared-in-object-class.check @@ -1,2 +1,2 @@ -prefix = Expr[Nothing](new Test.this.outer.Macros())
-it works
+prefix = Expr[Nothing](new Test.this.outer.Macros()) +it works diff --git a/test/files/run/macro-declared-in-object-object.check b/test/files/run/macro-declared-in-object-object.check index f7ba5a53cb..35af59e40f 100644 --- a/test/files/run/macro-declared-in-object-object.check +++ b/test/files/run/macro-declared-in-object-object.check @@ -1,2 +1,2 @@ -prefix = Expr[Nothing](Test.this.outer.Macros)
-it works
+prefix = Expr[Nothing](Test.this.outer.Macros) +it works diff --git a/test/files/run/macro-declared-in-object.check b/test/files/run/macro-declared-in-object.check index 05a8cc48ea..4d955a96b1 100644 --- a/test/files/run/macro-declared-in-object.check +++ b/test/files/run/macro-declared-in-object.check @@ -1,2 +1,2 @@ -prefix = Expr[Nothing](Macros)
-it works
+prefix = Expr[Nothing](Macros) +it works diff --git a/test/files/run/macro-declared-in-package-object.check b/test/files/run/macro-declared-in-package-object.check index 6f797f3c68..bc0069178d 100644 --- a/test/files/run/macro-declared-in-package-object.check +++ b/test/files/run/macro-declared-in-package-object.check @@ -1,2 +1,2 @@ -prefix = Expr[Nothing](Macros.`package`)
-it works
+prefix = Expr[Nothing](Macros.`package`) +it works diff --git a/test/files/run/macro-declared-in-refinement.check b/test/files/run/macro-declared-in-refinement.check index 861cd43b01..09b8d015a6 100644 --- a/test/files/run/macro-declared-in-refinement.check +++ b/test/files/run/macro-declared-in-refinement.check @@ -1,2 +1,2 @@ -prefix = Expr[Nothing](Test.this.macros)
-it works
+prefix = Expr[Nothing](Test.this.macros) +it works diff --git a/test/files/run/macro-declared-in-trait.check b/test/files/run/macro-declared-in-trait.check index d5d9e4e457..104ff1e99b 100644 --- a/test/files/run/macro-declared-in-trait.check +++ b/test/files/run/macro-declared-in-trait.check @@ -1,15 +1,15 @@ -prefix = Expr[Nothing]({
- final class $anon extends Object with Base {
- def <init>(): anonymous class $anon = {
- $anon.super.<init>();
- ()
- };
- <empty>
- };
- new $anon()
-})
-it works
-prefix = Expr[Nothing](Macros)
-it works
-prefix = Expr[Nothing](new Macros())
-it works
+prefix = Expr[Nothing]({ + final class $anon extends Object with Base { + def <init>(): anonymous class $anon = { + $anon.super.<init>(); + () + }; + <empty> + }; + new $anon() +}) +it works +prefix = Expr[Nothing](Macros) +it works +prefix = Expr[Nothing](new Macros()) +it works diff --git a/test/files/run/macro-def-infer-return-type-b.check b/test/files/run/macro-def-infer-return-type-b.check index f34d257c82..ae2dc7a06f 100644 --- a/test/files/run/macro-def-infer-return-type-b.check +++ b/test/files/run/macro-def-infer-return-type-b.check @@ -1,6 +1,6 @@ -reflective compilation has failed:
-
-exception during macro expansion:
-java.lang.Error: an implementation is missing
- at Impls$.foo(Impls_Macros_1.scala:5)
-
+reflective compilation has failed: + +exception during macro expansion: +java.lang.Error: an implementation is missing + at Impls$.foo(Impls_Macros_1.scala:5) + 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 0f84859545..ef2920a432 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 @@ -3,6 +3,6 @@ object Test extends App { import scala.reflect.runtime.{currentMirror => cm} import scala.tools.reflect.ToolBox val tree = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(42)))) - try cm.mkToolBox().runExpr(tree) + try cm.mkToolBox().eval(tree) catch { case ex: Throwable => println(ex.getMessage) } } diff --git a/test/files/run/macro-def-path-dependent-a.check b/test/files/run/macro-def-path-dependent-a.check index 1ea14b4e20..7658ad2c24 100644 --- a/test/files/run/macro-def-path-dependent-a.check +++ b/test/files/run/macro-def-path-dependent-a.check @@ -1 +1 @@ -it works
+it works diff --git a/test/files/run/macro-def-path-dependent-b.check b/test/files/run/macro-def-path-dependent-b.check index 1ea14b4e20..7658ad2c24 100644 --- a/test/files/run/macro-def-path-dependent-b.check +++ b/test/files/run/macro-def-path-dependent-b.check @@ -1 +1 @@ -it works
+it works diff --git a/test/files/run/macro-def-path-dependent-c.check b/test/files/run/macro-def-path-dependent-c.check index 1ea14b4e20..7658ad2c24 100644 --- a/test/files/run/macro-def-path-dependent-c.check +++ b/test/files/run/macro-def-path-dependent-c.check @@ -1 +1 @@ -it works
+it works diff --git a/test/files/run/macro-def-path-dependent-d1.check b/test/files/run/macro-def-path-dependent-d1.check index 1ea14b4e20..7658ad2c24 100644 --- a/test/files/run/macro-def-path-dependent-d1.check +++ b/test/files/run/macro-def-path-dependent-d1.check @@ -1 +1 @@ -it works
+it works diff --git a/test/files/run/macro-def-path-dependent-d2.check b/test/files/run/macro-def-path-dependent-d2.check index 1ea14b4e20..7658ad2c24 100644 --- a/test/files/run/macro-def-path-dependent-d2.check +++ b/test/files/run/macro-def-path-dependent-d2.check @@ -1 +1 @@ -it works
+it works diff --git a/test/files/run/macro-expand-implicit-argument.check b/test/files/run/macro-expand-implicit-argument.check index fb42345748..15a62794a9 100644 --- a/test/files/run/macro-expand-implicit-argument.check +++ b/test/files/run/macro-expand-implicit-argument.check @@ -1 +1 @@ -List(1, 2, 3)
+List(1, 2, 3) diff --git a/test/files/run/macro-expand-implicit-argument/Macros_1.scala b/test/files/run/macro-expand-implicit-argument/Macros_1.scala index 86c4198870..b1665256cd 100644 --- a/test/files/run/macro-expand-implicit-argument/Macros_1.scala +++ b/test/files/run/macro-expand-implicit-argument/Macros_1.scala @@ -4,7 +4,7 @@ import scala.{specialized => spec} import language.experimental.macros -import scala.reflect.{ClassTag, TypeTag} +import scala.reflect.ClassTag import scala.reflect.macros.Context object Macros { diff --git a/test/files/run/macro-expand-implicit-macro-has-implicit.check b/test/files/run/macro-expand-implicit-macro-has-implicit.check index 2f562a182f..d81cc0710e 100644 --- a/test/files/run/macro-expand-implicit-macro-has-implicit.check +++ b/test/files/run/macro-expand-implicit-macro-has-implicit.check @@ -1 +1 @@ -42
+42 diff --git a/test/files/run/macro-expand-implicit-macro-is-implicit.check b/test/files/run/macro-expand-implicit-macro-is-implicit.check index 42abf4579b..c205945d05 100644 --- a/test/files/run/macro-expand-implicit-macro-is-implicit.check +++ b/test/files/run/macro-expand-implicit-macro-is-implicit.check @@ -1,2 +1,2 @@ -Some(2)
-2
+Some(2) +2 diff --git a/test/files/run/macro-expand-implicit-macro-is-val.check b/test/files/run/macro-expand-implicit-macro-is-val.check index 78c6baefdd..0cfbf08886 100644 --- a/test/files/run/macro-expand-implicit-macro-is-val.check +++ b/test/files/run/macro-expand-implicit-macro-is-val.check @@ -1 +1 @@ -2
+2 diff --git a/test/files/run/macro-expand-implicit-macro-is-view.check b/test/files/run/macro-expand-implicit-macro-is-view.check index 78c6baefdd..0cfbf08886 100644 --- a/test/files/run/macro-expand-implicit-macro-is-view.check +++ b/test/files/run/macro-expand-implicit-macro-is-view.check @@ -1 +1 @@ -2
+2 diff --git a/test/files/run/macro-expand-nullary-generic.check b/test/files/run/macro-expand-nullary-generic.check index 0895c30c3f..133840c469 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 TypeTag[Int]
-it works TypeTag[Int]
-it works TypeTag[Int]
-it works TypeTag[Int]
-it works TypeTag[Int]
-kkthxbai
+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-overload.check b/test/files/run/macro-expand-overload.check index 9d9989d85f..a2b7b0e781 100644 --- a/test/files/run/macro-expand-overload.check +++ b/test/files/run/macro-expand-overload.check @@ -1,6 +1,6 @@ -(fooObjectString,Expr[Nothing](Macros),42)
-(fooObjectInt,Expr[Nothing](Macros),42)
-fooObjectBoolean
-(fooClassString,Expr[Nothing](new Macros()),42)
-(fooClassInt,Expr[Nothing](new Macros()),42)
-fooClassBoolean
+(fooObjectString,Expr[Nothing](Macros),42) +(fooObjectInt,Expr[Nothing](Macros),42) +fooObjectBoolean +(fooClassString,Expr[Nothing](new Macros()),42) +(fooClassInt,Expr[Nothing](new Macros()),42) +fooClassBoolean diff --git a/test/files/run/macro-expand-override.check b/test/files/run/macro-expand-override.check index 486bec7098..b41dc156c4 100644 --- a/test/files/run/macro-expand-override.check +++ b/test/files/run/macro-expand-override.check @@ -1,15 +1,15 @@ -(fooBString,Expr[Nothing](Test.this.dd),42)
-(fooDInt,Expr[Nothing](Test.this.dd),42)
-fooBBoolean
-(fooBString,Expr[Nothing](Test.this.db),42)
-(fooBInt,Expr[Nothing](Test.this.db),42)
-fooBBoolean
-(fooZString,Expr[Nothing](Test.this.zz),42)
-(fooDInt,Expr[Nothing](Test.this.zz),42)
-fooZBoolean
-(fooBString,Expr[Nothing](Test.this.zd),42)
-(fooDInt,Expr[Nothing](Test.this.zd),42)
-fooZBoolean
-(fooBString,Expr[Nothing](Test.this.zb),42)
-(fooBInt,Expr[Nothing](Test.this.zb),42)
-fooZBoolean
+(fooBString,Expr[Nothing](Test.this.dd),42) +(fooDInt,Expr[Nothing](Test.this.dd),42) +fooBBoolean +(fooBString,Expr[Nothing](Test.this.db),42) +(fooBInt,Expr[Nothing](Test.this.db),42) +fooBBoolean +(fooZString,Expr[Nothing](Test.this.zz),42) +(fooDInt,Expr[Nothing](Test.this.zz),42) +fooZBoolean +(fooBString,Expr[Nothing](Test.this.zd),42) +(fooDInt,Expr[Nothing](Test.this.zd),42) +fooZBoolean +(fooBString,Expr[Nothing](Test.this.zb),42) +(fooBInt,Expr[Nothing](Test.this.zb),42) +fooZBoolean diff --git a/test/files/run/macro-expand-recursive.check b/test/files/run/macro-expand-recursive.check index 1ea14b4e20..7658ad2c24 100644 --- a/test/files/run/macro-expand-recursive.check +++ b/test/files/run/macro-expand-recursive.check @@ -1 +1 @@ -it works
+it works diff --git a/test/files/run/macro-expand-tparams-explicit.check b/test/files/run/macro-expand-tparams-explicit.check index 19e6d39bc8..e7e6718406 100644 --- a/test/files/run/macro-expand-tparams-explicit.check +++ b/test/files/run/macro-expand-tparams-explicit.check @@ -1 +1 @@ -TypeTag[Int]
+TypeTag[Int] diff --git a/test/files/run/macro-expand-tparams-implicit.check b/test/files/run/macro-expand-tparams-implicit.check index 37226ec68d..fa6b335afb 100644 --- a/test/files/run/macro-expand-tparams-implicit.check +++ b/test/files/run/macro-expand-tparams-implicit.check @@ -1,2 +1,2 @@ -TypeTag[Int]
-WeakTypeTag[String]
+TypeTag[Int] +WeakTypeTag[String] diff --git a/test/files/run/macro-expand-tparams-optional.check b/test/files/run/macro-expand-tparams-optional.check index 3bacd7a4e0..b4a0f394c1 100644 --- a/test/files/run/macro-expand-tparams-optional.check +++ b/test/files/run/macro-expand-tparams-optional.check @@ -1 +1 @@ -don't know U
+don't know U diff --git a/test/files/run/macro-expand-tparams-prefix-a.check b/test/files/run/macro-expand-tparams-prefix-a.check index 7ef9fa7330..0bf3c55bbe 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 @@ -TypeTag[Int]
-TypeTag[Int]
-WeakTypeTag[String]
-TypeTag[Boolean]
+TypeTag[Int] +TypeTag[Int] +WeakTypeTag[String] +TypeTag[Boolean] diff --git a/test/files/run/macro-expand-tparams-prefix-b.check b/test/files/run/macro-expand-tparams-prefix-b.check index f4a2a8e80d..77c2ee9051 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 @@ -TypeTag[Boolean] TypeTag[Int]
-TypeTag[Boolean] WeakTypeTag[String]
+TypeTag[Boolean] TypeTag[Int] +TypeTag[Boolean] WeakTypeTag[String] diff --git a/test/files/run/macro-expand-tparams-prefix-c1.check b/test/files/run/macro-expand-tparams-prefix-c1.check index 473668ac58..f0dd5b9cd8 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 @@ -TypeTag[Int]
-WeakTypeTag[String]
-TypeTag[Boolean]
+TypeTag[Int] +WeakTypeTag[String] +TypeTag[Boolean] diff --git a/test/files/run/macro-expand-tparams-prefix-c2.check b/test/files/run/macro-expand-tparams-prefix-c2.check index 473668ac58..f0dd5b9cd8 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 @@ -TypeTag[Int]
-WeakTypeTag[String]
-TypeTag[Boolean]
+TypeTag[Int] +WeakTypeTag[String] +TypeTag[Boolean] diff --git a/test/files/run/macro-expand-tparams-prefix-d1.check b/test/files/run/macro-expand-tparams-prefix-d1.check index 2331e2549e..c5aaaf5a09 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 @@ -WeakTypeTag[T]
-WeakTypeTag[U]
-TypeTag[Boolean]
+WeakTypeTag[T] +WeakTypeTag[U] +TypeTag[Boolean] diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad.check b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad.check index fd1d654cf8..1c3ecfdefb 100644 --- a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad.check +++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad.check @@ -1,4 +1,4 @@ -reflective compilation has failed:
-
+reflective compilation has failed: + no `: _*' annotation allowed here -(such annotations are only allowed in arguments to *-parameters)
+(such annotations are only allowed in arguments to *-parameters) 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 c0319fcd6c..16d2c1e6ac 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 @@ -7,6 +7,6 @@ object Test extends App { 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 cm.mkToolBox().runExpr(tree) + try cm.mkToolBox().eval(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.check b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good.check index 835137b4a2..fe90caed3c 100644 --- a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good.check +++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good.check @@ -1 +1 @@ -List(1, 2, 3, 4, 5)
+List(1, 2, 3, 4, 5) diff --git a/test/files/run/macro-expand-varargs-explicit-over-varargs.check b/test/files/run/macro-expand-varargs-explicit-over-varargs.check index 835137b4a2..fe90caed3c 100644 --- a/test/files/run/macro-expand-varargs-explicit-over-varargs.check +++ b/test/files/run/macro-expand-varargs-explicit-over-varargs.check @@ -1 +1 @@ -List(1, 2, 3, 4, 5)
+List(1, 2, 3, 4, 5) diff --git a/test/files/run/macro-expand-varargs-implicit-over-nonvarargs.check b/test/files/run/macro-expand-varargs-implicit-over-nonvarargs.check index 0a6596858c..bcfab19847 100644 --- a/test/files/run/macro-expand-varargs-implicit-over-nonvarargs.check +++ b/test/files/run/macro-expand-varargs-implicit-over-nonvarargs.check @@ -1 +1 @@ -(1,2,3,4,5)
+(1,2,3,4,5) diff --git a/test/files/run/macro-expand-varargs-implicit-over-varargs.check b/test/files/run/macro-expand-varargs-implicit-over-varargs.check index f25fa141d3..2c174a8a99 100644 --- a/test/files/run/macro-expand-varargs-implicit-over-varargs.check +++ b/test/files/run/macro-expand-varargs-implicit-over-varargs.check @@ -1 +1 @@ -WrappedArray(1, 2, 3, 4, 5)
+WrappedArray(1, 2, 3, 4, 5) diff --git a/test/files/run/macro-impl-default-params.check b/test/files/run/macro-impl-default-params.check index eaf94458e6..b32e345706 100644 --- a/test/files/run/macro-impl-default-params.check +++ b/test/files/run/macro-impl-default-params.check @@ -1,5 +1,5 @@ -foo_targs:
-invoking foo_targs...
-type of prefix is: Nothing
-type of prefix tree is: Macros[Int]
-U is: String
+foo_targs: +invoking foo_targs... +type of prefix is: Nothing +type of prefix tree is: Macros[Int] +U is: String diff --git a/test/files/run/macro-impl-rename-context.check b/test/files/run/macro-impl-rename-context.check index 753edcd970..6a34e5fd87 100644 --- a/test/files/run/macro-impl-rename-context.check +++ b/test/files/run/macro-impl-rename-context.check @@ -1,2 +1,2 @@ -foo
-invoking foo...
+foo +invoking foo... diff --git a/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype.check b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype.check index e21e05157a..916195145e 100644 --- a/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype.check +++ b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype.check @@ -1,5 +1,5 @@ -reflective compilation has failed:
-
+reflective compilation has failed: + type mismatch; found : String("42") - required: Int
+ required: Int 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 c6caa2b585..15c498efb0 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 @@ -3,6 +3,6 @@ object Test extends App { import scala.reflect.runtime.{currentMirror => cm} import scala.tools.reflect.ToolBox val tree = Select(Ident("Macros"), newTermName("foo")) - try cm.mkToolBox().runExpr(tree) + try cm.mkToolBox().eval(tree) catch { case ex: Throwable => println(ex.getMessage) } }
\ No newline at end of file diff --git a/test/files/run/macro-invalidret-nontypeable.check b/test/files/run/macro-invalidret-nontypeable.check index eee08528e2..cf7acb0d60 100644 --- a/test/files/run/macro-invalidret-nontypeable.check +++ b/test/files/run/macro-invalidret-nontypeable.check @@ -1,3 +1,3 @@ -reflective compilation has failed:
-
-not found: value IDoNotExist
+reflective compilation has failed: + +not found: value IDoNotExist diff --git a/test/files/run/macro-invalidret-nontypeable/Test_2.scala b/test/files/run/macro-invalidret-nontypeable/Test_2.scala index c6caa2b585..15c498efb0 100644 --- a/test/files/run/macro-invalidret-nontypeable/Test_2.scala +++ b/test/files/run/macro-invalidret-nontypeable/Test_2.scala @@ -3,6 +3,6 @@ object Test extends App { import scala.reflect.runtime.{currentMirror => cm} import scala.tools.reflect.ToolBox val tree = Select(Ident("Macros"), newTermName("foo")) - try cm.mkToolBox().runExpr(tree) + try cm.mkToolBox().eval(tree) catch { case ex: Throwable => println(ex.getMessage) } }
\ No newline at end of file diff --git a/test/files/run/macro-invalidusage-badret.check b/test/files/run/macro-invalidusage-badret.check index 5bdc484644..221732eefc 100644 --- a/test/files/run/macro-invalidusage-badret.check +++ b/test/files/run/macro-invalidusage-badret.check @@ -1,5 +1,5 @@ -reflective compilation has failed:
-
+reflective compilation has failed: + type mismatch; found : Int(42) - required: String
+ required: String diff --git a/test/files/run/macro-invalidusage-badret/Test_2.scala b/test/files/run/macro-invalidusage-badret/Test_2.scala index 8322e8a4e0..f3a76f3fff 100644 --- a/test/files/run/macro-invalidusage-badret/Test_2.scala +++ b/test/files/run/macro-invalidusage-badret/Test_2.scala @@ -3,6 +3,6 @@ object Test extends App { 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 cm.mkToolBox().runExpr(tree) + try cm.mkToolBox().eval(tree) catch { case ex: Throwable => println(ex.getMessage) } } diff --git a/test/files/run/macro-invalidusage-partialapplication-with-tparams.check b/test/files/run/macro-invalidusage-partialapplication-with-tparams.check index 73f57b0b81..f1d5e925fa 100644 --- a/test/files/run/macro-invalidusage-partialapplication-with-tparams.check +++ b/test/files/run/macro-invalidusage-partialapplication-with-tparams.check @@ -1,3 +1,3 @@ -reflective compilation has failed:
-
-macros cannot be partially applied
+reflective compilation has failed: + +macros cannot be partially applied 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 index f51cc7e699..c91fd7d380 100644 --- a/test/files/run/macro-invalidusage-partialapplication-with-tparams/Test_2.scala +++ b/test/files/run/macro-invalidusage-partialapplication-with-tparams/Test_2.scala @@ -3,6 +3,6 @@ object Test extends App { import scala.reflect.runtime.{currentMirror => cm} import scala.tools.reflect.ToolBox val tree = Select(Ident("Macros"), newTermName("foo")) - try cm.mkToolBox().runExpr(tree) + try cm.mkToolBox().eval(tree) catch { case ex: Throwable => println(ex.getMessage) } } diff --git a/test/files/run/macro-invalidusage-partialapplication.check b/test/files/run/macro-invalidusage-partialapplication.check index 73f57b0b81..f1d5e925fa 100644 --- a/test/files/run/macro-invalidusage-partialapplication.check +++ b/test/files/run/macro-invalidusage-partialapplication.check @@ -1,3 +1,3 @@ -reflective compilation has failed:
-
-macros cannot be partially applied
+reflective compilation has failed: + +macros cannot be partially applied diff --git a/test/files/run/macro-invalidusage-partialapplication/Test_2.scala b/test/files/run/macro-invalidusage-partialapplication/Test_2.scala index 64020b2aa9..cbfee725e2 100644 --- a/test/files/run/macro-invalidusage-partialapplication/Test_2.scala +++ b/test/files/run/macro-invalidusage-partialapplication/Test_2.scala @@ -3,6 +3,6 @@ object Test extends App { import scala.reflect.runtime.{currentMirror => cm} import scala.tools.reflect.ToolBox val tree = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(40)))) - try cm.mkToolBox().runExpr(tree) + try cm.mkToolBox().eval(tree) catch { case ex: Throwable => println(ex.getMessage) } } diff --git a/test/files/run/macro-openmacros.check b/test/files/run/macro-openmacros.check index a4b06a1e1a..ba0ae3ff42 100644 --- a/test/files/run/macro-openmacros.check +++ b/test/files/run/macro-openmacros.check @@ -1,3 +1,3 @@ -List(MacroContext(foo@source-Test_2.scala,line-2,offset=35 +0))
-List(MacroContext(foo@source-Test_2.scala,line-2,offset=35 +1), MacroContext(foo@source-Test_2.scala,line-2,offset=35 +0))
-List(MacroContext(foo@source-Test_2.scala,line-2,offset=35 +2), MacroContext(foo@source-Test_2.scala,line-2,offset=35 +1), MacroContext(foo@source-Test_2.scala,line-2,offset=35 +0))
+List(MacroContext(foo@source-Test_2.scala,line-2,offset=35 +0)) +List(MacroContext(foo@source-Test_2.scala,line-2,offset=35 +1), MacroContext(foo@source-Test_2.scala,line-2,offset=35 +0)) +List(MacroContext(foo@source-Test_2.scala,line-2,offset=35 +2), MacroContext(foo@source-Test_2.scala,line-2,offset=35 +1), MacroContext(foo@source-Test_2.scala,line-2,offset=35 +0)) diff --git a/test/files/run/macro-openmacros/Impls_Macros_1.scala b/test/files/run/macro-openmacros/Impls_Macros_1.scala index 38d46c5185..b863ac048b 100644 --- a/test/files/run/macro-openmacros/Impls_Macros_1.scala +++ b/test/files/run/macro-openmacros/Impls_Macros_1.scala @@ -4,8 +4,7 @@ object Macros { def impl(c: Context): c.Expr[Unit] = { // 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.getCanonicalFile.getParentFile + val dir = c.enclosingUnit.source.file.file.getCanonicalFile.getParentFile def normalizePaths(s: String) = { val base = (dir.getCanonicalPath + java.io.File.separator).replace('\\', '/') var regex = """\Q%s\E""" format base 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 67666a632b..373c6a6fca 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 @@ -3,5 +3,5 @@ object Test extends App { import scala.reflect.runtime.{currentMirror => cm} import scala.tools.reflect.ToolBox val tree = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(42)))) - println(cm.mkToolBox().runExpr(tree)) + println(cm.mkToolBox().eval(tree)) } 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 7a2c0a6fa9..089f30f389 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 @@ -16,5 +16,5 @@ object Test extends App { val macroapp = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(42)))) val tree = Block(macrodef, module, macroapp) val toolbox = cm.mkToolBox(options = "-language:experimental.macros") - println(toolbox.runExpr(tree)) + println(toolbox.eval(tree)) } diff --git a/test/files/run/macro-reify-abstypetag-notypeparams.check b/test/files/run/macro-reify-abstypetag-notypeparams.check index aadd713bef..7732c10d75 100644 --- a/test/files/run/macro-reify-abstypetag-notypeparams.check +++ b/test/files/run/macro-reify-abstypetag-notypeparams.check @@ -1,2 +1,2 @@ -TypeTag[Int]
-TypeTag[List[Int]]
+TypeTag[Int] +TypeTag[List[Int]] diff --git a/test/files/run/macro-reify-abstypetag-typeparams-notags.check b/test/files/run/macro-reify-abstypetag-typeparams-notags.check index 6aeec96079..a741d11ebd 100644 --- a/test/files/run/macro-reify-abstypetag-typeparams-notags.check +++ b/test/files/run/macro-reify-abstypetag-typeparams-notags.check @@ -1,2 +1,2 @@ -WeakTypeTag[T]
-WeakTypeTag[List[T]]
+WeakTypeTag[T] +WeakTypeTag[List[T]] diff --git a/test/files/run/macro-reify-abstypetag-typeparams-tags.check b/test/files/run/macro-reify-abstypetag-typeparams-tags.check index 6e2646c5e0..e225e57757 100644 --- a/test/files/run/macro-reify-abstypetag-typeparams-tags.check +++ b/test/files/run/macro-reify-abstypetag-typeparams-tags.check @@ -1,2 +1,2 @@ -TypeTag[Int]
-WeakTypeTag[List[Int]]
+TypeTag[Int] +WeakTypeTag[List[Int]] diff --git a/test/files/run/macro-reify-abstypetag-usetypetag.check b/test/files/run/macro-reify-abstypetag-usetypetag.check index 6e2646c5e0..e225e57757 100644 --- a/test/files/run/macro-reify-abstypetag-usetypetag.check +++ b/test/files/run/macro-reify-abstypetag-usetypetag.check @@ -1,2 +1,2 @@ -TypeTag[Int]
-WeakTypeTag[List[Int]]
+TypeTag[Int] +WeakTypeTag[List[Int]] diff --git a/test/files/run/macro-reify-basic.check b/test/files/run/macro-reify-basic.check index f35d3e67b4..3b18e512db 100644 --- a/test/files/run/macro-reify-basic.check +++ b/test/files/run/macro-reify-basic.check @@ -1 +1 @@ -hello world
+hello world diff --git a/test/files/run/macro-reify-freevars.check b/test/files/run/macro-reify-freevars.check index 2e925f9fa8..f13806889e 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: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
+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/Test_2.scala b/test/files/run/macro-reify-freevars/Test_2.scala index 603cf10d41..e24758cfb4 100644 --- a/test/files/run/macro-reify-freevars/Test_2.scala +++ b/test/files/run/macro-reify-freevars/Test_2.scala @@ -6,6 +6,6 @@ object Test extends App { 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 cm.mkToolBox().runExpr(tree) + try cm.mkToolBox().eval(tree) catch { case ex: Throwable => println(ex.getMessage) } }
\ 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 ae2def2d3e..b4351c2c53 100644 --- a/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala +++ b/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala @@ -23,9 +23,10 @@ case class Utils[C <: Context]( c:C ) { object QueryableMacros{ def _helper[C <: Context,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = { import c.universe._ + import treeBuild._ val element_type = implicitly[c.WeakTypeTag[S]].tpe val foo = c.Expr[ru.Expr[Queryable[S]]]( - c.reifyTree( c.runtimeUniverse, EmptyTree, c.typeCheck( + c.reifyTree( mkRuntimeUniverseRef, EmptyTree, c.typeCheck( Utils[c.type](c).removeDoubleReify( Apply(Select(c.prefix.tree, newTermName( name )), List( projection.tree )) ).asInstanceOf[Tree] diff --git a/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala b/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala index ae2def2d3e..b4351c2c53 100644 --- a/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala +++ b/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala @@ -23,9 +23,10 @@ case class Utils[C <: Context]( c:C ) { object QueryableMacros{ def _helper[C <: Context,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = { import c.universe._ + import treeBuild._ val element_type = implicitly[c.WeakTypeTag[S]].tpe val foo = c.Expr[ru.Expr[Queryable[S]]]( - c.reifyTree( c.runtimeUniverse, EmptyTree, c.typeCheck( + c.reifyTree( mkRuntimeUniverseRef, EmptyTree, c.typeCheck( Utils[c.type](c).removeDoubleReify( Apply(Select(c.prefix.tree, newTermName( name )), List( projection.tree )) ).asInstanceOf[Tree] diff --git a/test/files/run/macro-reify-ref-to-packageless.check b/test/files/run/macro-reify-ref-to-packageless.check index 2f562a182f..d81cc0710e 100644 --- a/test/files/run/macro-reify-ref-to-packageless.check +++ b/test/files/run/macro-reify-ref-to-packageless.check @@ -1 +1 @@ -42
+42 diff --git a/test/files/run/macro-reify-splice-outside-reify.check b/test/files/run/macro-reify-splice-outside-reify.check index 2f562a182f..d81cc0710e 100644 --- a/test/files/run/macro-reify-splice-outside-reify.check +++ b/test/files/run/macro-reify-splice-outside-reify.check @@ -1 +1 @@ -42
+42 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 index f3e1c9ae95..5330d0e32b 100644 --- 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 @@ -4,18 +4,7 @@ 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] + c.literal(c.eval(x1)) } } diff --git a/test/files/run/macro-reify-splice-outside-reify/Test_2.scala b/test/files/run/macro-reify-splice-outside-reify/Test_2.scala index 5bca7db668..8f96ea199d 100644 --- a/test/files/run/macro-reify-splice-outside-reify/Test_2.scala +++ b/test/files/run/macro-reify-splice-outside-reify/Test_2.scala @@ -3,6 +3,6 @@ object Test extends App { 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(cm.mkToolBox().runExpr(tree)) + try println(cm.mkToolBox().eval(tree)) catch { case ex: Throwable => println(ex.getMessage) } } diff --git a/test/files/run/macro-reify-splice-splice.check b/test/files/run/macro-reify-splice-splice.check index f35d3e67b4..3b18e512db 100644 --- a/test/files/run/macro-reify-splice-splice.check +++ b/test/files/run/macro-reify-splice-splice.check @@ -1 +1 @@ -hello world
+hello world diff --git a/test/files/run/macro-reify-tagful-a.check b/test/files/run/macro-reify-tagful-a.check index 8a701df6a5..3f4c719990 100644 --- a/test/files/run/macro-reify-tagful-a.check +++ b/test/files/run/macro-reify-tagful-a.check @@ -1 +1 @@ -List(hello world)
+List(hello world) diff --git a/test/files/run/macro-reify-tagless-a.check b/test/files/run/macro-reify-tagless-a.check index c2385ba008..231741edc5 100644 --- a/test/files/run/macro-reify-tagless-a.check +++ b/test/files/run/macro-reify-tagless-a.check @@ -1,3 +1,3 @@ -reflective compilation has failed:
-
-Macro expansion contains free type variable T defined by foo in Impls_Macros_1.scala:7:13. Have you forgotten to use c.WeakTypeTag annotation for this type parameter? If you have troubles tracking free type variables, consider using -Xlog-free-types
+reflective compilation has failed: + +Macro expansion contains free type variable T defined by foo in Impls_Macros_1.scala:7:13. Have you forgotten to use c.WeakTypeTag annotation for this type parameter? If you have troubles tracking free type variables, consider using -Xlog-free-types 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 7029e59ea1..1bb3945ece 100644 --- a/test/files/run/macro-reify-tagless-a/Test_2.scala +++ b/test/files/run/macro-reify-tagless-a/Test_2.scala @@ -9,6 +9,6 @@ object Test extends App { 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 cm.mkToolBox().runExpr(tree) + try cm.mkToolBox().eval(tree) catch { case ex: Throwable => println(ex.getMessage) } } diff --git a/test/files/run/macro-reify-type.check b/test/files/run/macro-reify-type.check new file mode 100644 index 0000000000..ea5e70e10d --- /dev/null +++ b/test/files/run/macro-reify-type.check @@ -0,0 +1 @@ +[B, That](f: Int => B)(implicit bf: scala.collection.generic.CanBuildFrom[List[Int],B,That])That
\ No newline at end of file diff --git a/test/files/run/macro-reify-type.flags b/test/files/run/macro-reify-type.flags new file mode 100644 index 0000000000..cd66464f2f --- /dev/null +++ b/test/files/run/macro-reify-type.flags @@ -0,0 +1 @@ +-language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-reify-type/Macros_1.scala b/test/files/run/macro-reify-type/Macros_1.scala new file mode 100644 index 0000000000..06de05735d --- /dev/null +++ b/test/files/run/macro-reify-type/Macros_1.scala @@ -0,0 +1,27 @@ +import scala.reflect.macros.Context +import scala.reflect.runtime.{universe => ru} + +object StaticReflect { + def method[A](name: String): ru.Type = macro methodImpl[A] + + def methodImpl[A: c.WeakTypeTag](c: Context)(name: c.Expr[String]): c.Expr[ru.Type] = { + import c.universe._ + + val nameName: TermName = name.tree match { + case Literal(Constant(str: String)) => newTermName(str) + case _ => c.error(c.enclosingPosition, s"Method name not constant.") ; return reify(ru.NoType) + } + val clazz = weakTypeOf[A] + + clazz member nameName match { + case NoSymbol => c.error(c.enclosingPosition, s"No member called $nameName in $clazz.") ; reify(ru.NoType) + case member => + val mtpe = member typeSignatureIn clazz + val mtag = c.reifyType(treeBuild.mkRuntimeUniverseRef, Select(treeBuild.mkRuntimeUniverseRef, newTermName("rootMirror")), mtpe) + val mtree = Select(mtag, newTermName("tpe")) + + c.Expr[ru.Type](mtree) + } + } + +} diff --git a/test/files/run/macro-reify-type/Test_2.scala b/test/files/run/macro-reify-type/Test_2.scala new file mode 100644 index 0000000000..9beaf98681 --- /dev/null +++ b/test/files/run/macro-reify-type/Test_2.scala @@ -0,0 +1,21 @@ +import StaticReflect._ + +object Test extends App { + //println(method[List[Int]]("distinct")) + println(method[List[Int]]("map")) + //val $u: scala.reflect.runtime.universe.type = scala.reflect.runtime.universe; + //val $m: $u.Mirror = scala.reflect.runtime.universe.rootMirror; + //import $u._, $m._, Flag._ + //val tpe = { + // val symdef$B2 = build.newNestedSymbol(build.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), newTypeName("B"), NoPosition, DEFERRED | PARAM, false); + // val symdef$That2 = build.newNestedSymbol(build.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), newTypeName("That"), NoPosition, DEFERRED | PARAM, false); + // val symdef$f2 = build.newNestedSymbol(build.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), newTermName("f"), NoPosition, PARAM, false); + // val symdef$bf2 = build.newNestedSymbol(build.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), newTermName("bf"), NoPosition, IMPLICIT | PARAM, false); + // build.setTypeSignature(symdef$B2, TypeBounds(staticClass("scala.Nothing").asType.toTypeConstructor, staticClass("scala.Any").asType.toTypeConstructor)); + // build.setTypeSignature(symdef$That2, TypeBounds(staticClass("scala.Nothing").asType.toTypeConstructor, staticClass("scala.Any").asType.toTypeConstructor)); + // build.setTypeSignature(symdef$f2, TypeRef(ThisType(staticPackage("scala").asModule.moduleClass), staticClass("scala.Function1"), List(staticClass("scala.Int").asType.toTypeConstructor, TypeRef(NoPrefix, symdef$B2, List())))); + // build.setTypeSignature(symdef$bf2, TypeRef(ThisType(staticPackage("scala.collection.generic").asModule.moduleClass), staticClass("scala.collection.generic.CanBuildFrom"), List(TypeRef(ThisType(staticPackage("scala.collection.immutable").asModule.moduleClass), staticClass("scala.collection.immutable.List"), List(staticClass("scala.Int").asType.toTypeConstructor)), TypeRef(NoPrefix, symdef$B2, List()), TypeRef(NoPrefix, symdef$That2, List())))); + // PolyType(List(symdef$B2, symdef$That2), MethodType(List(symdef$f2), MethodType(List(symdef$bf2), TypeRef(NoPrefix, symdef$That2, List())))) + //} + //println(tpe) +}
\ No newline at end of file diff --git a/test/files/run/macro-reify-typetag-notypeparams.check b/test/files/run/macro-reify-typetag-notypeparams.check index aadd713bef..7732c10d75 100644 --- a/test/files/run/macro-reify-typetag-notypeparams.check +++ b/test/files/run/macro-reify-typetag-notypeparams.check @@ -1,2 +1,2 @@ -TypeTag[Int]
-TypeTag[List[Int]]
+TypeTag[Int] +TypeTag[List[Int]] diff --git a/test/files/run/macro-reify-typetag-typeparams-tags.check b/test/files/run/macro-reify-typetag-typeparams-tags.check index aadd713bef..7732c10d75 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 @@ -TypeTag[Int]
-TypeTag[List[Int]]
+TypeTag[Int] +TypeTag[List[Int]] diff --git a/test/files/run/macro-reify-unreify.check b/test/files/run/macro-reify-unreify.check index 8f8d9d944d..7a6d53c47e 100644 --- a/test/files/run/macro-reify-unreify.check +++ b/test/files/run/macro-reify-unreify.check @@ -1 +1 @@ -hello world = Expr[java.lang.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 620a929210..9f04c13014 100644 --- a/test/files/run/macro-reify-unreify/Macros_1.scala +++ b/test/files/run/macro-reify-unreify/Macros_1.scala @@ -6,9 +6,10 @@ object Macros { object Impls { def foo(c: Ctx)(s: c.Expr[String]) = { import c.universe._ + import treeBuild._ - 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 world = c.reifyTree(mkRuntimeUniverseRef, EmptyTree, s.tree) + val greeting = c.reifyTree(mkRuntimeUniverseRef, EmptyTree, c.typeCheck(Apply(Select(Literal(Constant("hello ")), newTermName("$plus")), List(c.unreifyTree(world))))) val typedGreeting = c.Expr[String](greeting) c.universe.reify { diff --git a/test/files/run/macro-repl-basic.check b/test/files/run/macro-repl-basic.check index 4a50c60469..7deed4a878 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.macros.{Context => Ctx}
-import scala.reflect.macros.{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>
+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.macros.{Context => Ctx} +import scala.reflect.macros.{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-dontexpand.check b/test/files/run/macro-repl-dontexpand.check index 3c378cdf09..628a9146c4 100644 --- a/test/files/run/macro-repl-dontexpand.check +++ b/test/files/run/macro-repl-dontexpand.check @@ -1,12 +1,12 @@ -Type in expressions to have them evaluated.
-Type :help for more information.
-
-scala>
-
-scala> def bar(c: scala.reflect.macros.Context) = ???
-bar: (c: scala.reflect.macros.Context)Nothing
-
-scala> def foo = macro bar
-foo: Any
-
-scala>
+Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> def bar(c: scala.reflect.macros.Context) = ??? +bar: (c: scala.reflect.macros.Context)Nothing + +scala> def foo = macro bar +foo: Any + +scala> diff --git a/test/files/run/macro-settings.check b/test/files/run/macro-settings.check index 33784d1c15..050d53cdbb 100644 --- a/test/files/run/macro-settings.check +++ b/test/files/run/macro-settings.check @@ -1 +1 @@ -List(hello=1)
+List(hello=1) diff --git a/test/files/run/macro-sip19-revised.check b/test/files/run/macro-sip19-revised.check index aa2fbd11d3..86c3d819b0 100644 --- a/test/files/run/macro-sip19-revised.check +++ b/test/files/run/macro-sip19-revised.check @@ -1,5 +1,5 @@ -hey, i've been called from SourceLocation1(null,Test_2.scala,11,251)
-hey, i've been called from SourceLocation1(SourceLocation1(null,Test_2.scala,11,251),Test_2.scala,8,222)
-hey, i've been called from SourceLocation1(SourceLocation1(SourceLocation1(null,Test_2.scala,11,251),Test_2.scala,8,222),Test_2.scala,8,222)
-hey, i've been called from SourceLocation1(SourceLocation1(SourceLocation1(SourceLocation1(null,Test_2.scala,11,251),Test_2.scala,8,222),Test_2.scala,8,222),Test_2.scala,6,180)
-2
+hey, i've been called from SourceLocation1(null,Test_2.scala,11,251) +hey, i've been called from SourceLocation1(SourceLocation1(null,Test_2.scala,11,251),Test_2.scala,8,222) +hey, i've been called from SourceLocation1(SourceLocation1(SourceLocation1(null,Test_2.scala,11,251),Test_2.scala,8,222),Test_2.scala,8,222) +hey, i've been called from SourceLocation1(SourceLocation1(SourceLocation1(SourceLocation1(null,Test_2.scala,11,251),Test_2.scala,8,222),Test_2.scala,8,222),Test_2.scala,6,180) +2 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 0793696fd4..5f3f61ca3f 100644 --- a/test/files/run/macro-sip19-revised/Impls_Macros_1.scala +++ b/test/files/run/macro-sip19-revised/Impls_Macros_1.scala @@ -8,7 +8,7 @@ object Macros { 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 fileName = fun.pos.source.file.file.getName val line = fun.pos.line val charOffset = fun.pos.point c.universe.reify { SourceLocation1(outer.splice, c.literal(fileName).splice, c.literal(line).splice, c.literal(charOffset).splice) } diff --git a/test/files/run/macro-sip19.check b/test/files/run/macro-sip19.check index 6b317ccb47..07cfd8c1e1 100644 --- a/test/files/run/macro-sip19.check +++ b/test/files/run/macro-sip19.check @@ -1,5 +1,5 @@ -hey, i've been called from SourceLocation(Test_2.scala,15,366)
-hey, i've been called from SourceLocation(Test_2.scala,11,331)
-hey, i've been called from SourceLocation(Test_2.scala,11,331)
-hey, i've been called from SourceLocation(Test_2.scala,9,285)
-2
+hey, i've been called from SourceLocation(Test_2.scala,15,366) +hey, i've been called from SourceLocation(Test_2.scala,11,331) +hey, i've been called from SourceLocation(Test_2.scala,11,331) +hey, i've been called from SourceLocation(Test_2.scala,9,285) +2 diff --git a/test/files/run/macro-sip19/Impls_Macros_1.scala b/test/files/run/macro-sip19/Impls_Macros_1.scala index f89e51f560..535ec2ccf0 100644 --- a/test/files/run/macro-sip19/Impls_Macros_1.scala +++ b/test/files/run/macro-sip19/Impls_Macros_1.scala @@ -4,7 +4,7 @@ object Macros { def impl(c: Context) = { import c.universe._ val Apply(fun, args) = c.enclosingImplicits(0)._2 - val fileName = fun.pos.fileInfo.getName + val fileName = fun.pos.source.file.file.getName val line = fun.pos.line val charOffset = fun.pos.point c.universe.reify { SourceLocation(c.literal(fileName).splice, c.literal(line).splice, c.literal(charOffset).splice) } diff --git a/test/files/run/macro-typecheck-implicitsdisabled.check b/test/files/run/macro-typecheck-implicitsdisabled.check index aa6c8e1f07..6cf25076a7 100644 --- a/test/files/run/macro-typecheck-implicitsdisabled.check +++ b/test/files/run/macro-typecheck-implicitsdisabled.check @@ -1,2 +1,2 @@ -scala.this.Predef.any2ArrowAssoc[Int](1).->[Int](2)
-scala.reflect.internal.Types$TypeError: value -> is not a member of Int
+scala.this.Predef.any2ArrowAssoc[Int](1).->[Int](2) +scala.reflect.internal.Types$TypeError: value -> is not a member of Int diff --git a/test/files/run/macro-typecheck-macrosdisabled.check b/test/files/run/macro-typecheck-macrosdisabled.check index c560b0e4b5..29a881f8b1 100644 --- a/test/files/run/macro-typecheck-macrosdisabled.check +++ b/test/files/run/macro-typecheck-macrosdisabled.check @@ -1,32 +1,32 @@ -{
- 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: 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()
- }))
-}
-ru.reify[Int](2)
+{ + 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.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Tree = { + val $u: U = $m$untyped.universe; + val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; + $u.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.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Type = { + val $u: U = $m$untyped.universe; + val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; + $u.ConstantType.apply($u.Constant.apply(2)) + } + }; + new $typecreator2() + })) +} +ru.reify[Int](2) diff --git a/test/files/run/macro-typecheck-macrosdisabled2.check b/test/files/run/macro-typecheck-macrosdisabled2.check index 55e7913250..7bdd1d6a3a 100644 --- a/test/files/run/macro-typecheck-macrosdisabled2.check +++ b/test/files/run/macro-typecheck-macrosdisabled2.check @@ -1,32 +1,32 @@ -{
- 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: U = $m$untyped.universe;
- val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
- $u.Apply.apply($u.Select.apply($u.Select.apply($u.build.Ident($m.staticPackage("scala")), $u.newTermName("Array")), $u.newTermName("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2))))
- }
- };
- new $treecreator1()
- })($u.TypeTag.apply[Array[Int]]($m, {
- final class $typecreator2 extends TypeCreator {
- def <init>(): $typecreator2 = {
- $typecreator2.super.<init>();
- ()
- };
- def apply[U >: 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.staticPackage("scala").asModule.moduleClass), $m.staticClass("scala.Array"), scala.collection.immutable.List.apply[$u.Type]($m.staticClass("scala.Int").asType.toTypeConstructor))
- }
- };
- new $typecreator2()
- }))
-}
-ru.reify[Array[Int]](scala.Array.apply(2))
+{ + val $u: 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.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Tree = { + val $u: U = $m$untyped.universe; + val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; + $u.Apply.apply($u.Select.apply($u.Select.apply($u.build.Ident($m.staticPackage("scala")), $u.newTermName("Array")), $u.newTermName("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2)))) + } + }; + new $treecreator1() + })($u.TypeTag.apply[Array[Int]]($m, { + final class $typecreator2 extends TypeCreator { + def <init>(): $typecreator2 = { + $typecreator2.super.<init>(); + () + }; + def apply[U >: Nothing <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Type = { + val $u: U = $m$untyped.universe; + val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; + $u.TypeRef.apply($u.ThisType.apply($m.staticPackage("scala").asModule.moduleClass), $m.staticClass("scala.Array"), scala.collection.immutable.List.apply[$u.Type]($m.staticClass("scala.Int").asType.toTypeConstructor)) + } + }; + new $typecreator2() + })) +} +ru.reify[Array[Int]](scala.Array.apply(2)) diff --git a/test/files/run/macro-undetparams-consfromsls.check b/test/files/run/macro-undetparams-consfromsls.check index 4b83c55437..b10a90043e 100644 --- a/test/files/run/macro-undetparams-consfromsls.check +++ b/test/files/run/macro-undetparams-consfromsls.check @@ -1,5 +1,5 @@ -A = TypeTag[Int]
-B = TypeTag[Nothing]
-List(1)
-A = TypeTag[Any]
-List(abc, 1)
+A = TypeTag[Int] +B = TypeTag[Nothing] +List(1) +A = TypeTag[Any] +List(abc, 1) diff --git a/test/files/run/macro-undetparams-implicitval.check b/test/files/run/macro-undetparams-implicitval.check index 30681fa40d..541b922b21 100644 --- a/test/files/run/macro-undetparams-implicitval.check +++ b/test/files/run/macro-undetparams-implicitval.check @@ -1 +1 @@ -TypeTag[Nothing]
+TypeTag[Nothing] diff --git a/test/files/run/macro-undetparams-macroitself.check b/test/files/run/macro-undetparams-macroitself.check index 37226ec68d..fa6b335afb 100644 --- a/test/files/run/macro-undetparams-macroitself.check +++ b/test/files/run/macro-undetparams-macroitself.check @@ -1,2 +1,2 @@ -TypeTag[Int]
-WeakTypeTag[String]
+TypeTag[Int] +WeakTypeTag[String] diff --git a/test/files/run/newTags.check b/test/files/run/newTags.check index 2cbc265d7a..16be9b124e 100644 --- a/test/files/run/newTags.check +++ b/test/files/run/newTags.check @@ -1,5 +1,3 @@ -TypeRef(SingleType(SingleType(SingleType(NoPrefix,class <root>),module scala),module package),class List,List(TypeRef(ThisType(class scala),class Int,List())))
-List[Int]
-TypeRef(SingleType(ThisType(class scala),module Predef),class Map,List(TypeRef(SingleType(ThisType(class scala),module Predef),class String,List()), TypeRef(SingleType(ThisType(class scala),module Predef),class String,List())))
-Map[String,String]
-TypeTag[TypeRef(SingleType(ThisType(class scala),module Predef),class Map,List(TypeRef(SingleType(ThisType(class scala),module Predef),class String,List()), TypeRef(SingleType(ThisType(class scala),module Predef),class String,List())))]
+List[Int] +Map[String,String] +TypeTag[Map[String,String]] diff --git a/test/files/run/newTags.scala b/test/files/run/newTags.scala index a758599515..c5199d4e55 100644 --- a/test/files/run/newTags.scala +++ b/test/files/run/newTags.scala @@ -1,14 +1,11 @@ -import scala.reflect.base.{Universe => BaseUniverse} -import scala.reflect.{basis => rb} +import scala.reflect.api.{Universe => ApiUniverse} import scala.reflect.runtime.{universe => ru} object Test extends App { - println(rb.typeOf[List[Int]]) println(ru.typeOf[List[Int]]) - def foo[T: rb.TypeTag] = { - println(rb.typeOf[T]) + def foo[T: ru.TypeTag] = { println(ru.typeOf[T]) - println(implicitly[BaseUniverse#TypeTag[T]]) + println(implicitly[ApiUniverse#TypeTag[T]]) } foo[Map[String, String]] }
\ No newline at end of file diff --git a/test/files/run/partialfun.check b/test/files/run/partialfun.check index a317f7b150..d4e9f494cd 100644 --- a/test/files/run/partialfun.check +++ b/test/files/run/partialfun.check @@ -1,6 +1,6 @@ -47
-147
-100
-0:isDefinedAt
-1:isDefinedAt
-2:apply
+47 +147 +100 +0:isDefinedAt +1:isDefinedAt +2:apply diff --git a/test/files/run/partialfun.scala b/test/files/run/partialfun.scala index 4b360750c9..f3c53b94ae 100644 --- a/test/files/run/partialfun.scala +++ b/test/files/run/partialfun.scala @@ -1,86 +1,86 @@ -import collection._
-import collection.generic._
-
-object Test {
- def collectIDA[A, B, Repr, That](_this: TraversableLike[A, Repr])(pf: PartialFunction[A, B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
- val repr: Repr = _this.asInstanceOf[Repr]
- val b = bf(repr)
- _this foreach { x => if (pf isDefinedAt x) b += pf(x) }
- b.result
- }
-
- def collectRW[A, B, Repr, That](_this: TraversableLike[A, Repr])(pf: PartialFunction[A, B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
- val repr: Repr = _this.asInstanceOf[Repr]
- val b = bf(repr)
- val f = pf runWith { b += _ }
- _this foreach f
- b.result
- }
-
- var cnt = 0
-
- object Ex1 {
- def unapply(x: Int) : Option[Int] = {
- cnt += 1
- if ((x % 3) == 0) Some(-x) else None
- }
- }
-
- object Ex2 {
- def unapply(x: Int) : Option[Int] = {
- //cnt += 1
- if ((x % 5) == 0) Some(x) else None
- }
- }
-
- def resetCnt() = { val r = cnt; cnt = 0; r }
-
- val pf: PartialFunction[Int,Int] = {
- case Ex1(result) => result
- case Ex2(result) => result
- }
-
- def collectTest() {
- val xs = 1 to 100
- resetCnt()
-
- val ysIDA = collectIDA(xs)(pf)
- val cntIDA = resetCnt()
-
- val ysRW = collectRW(xs)(pf)
- val cntRW = resetCnt()
-
- val ys = xs collect pf
-
- assert(ys == ysIDA)
- assert(ys == ysRW)
- assert(cntIDA == xs.length + ys.length)
- assert(cntRW == xs.length)
- println(ys.length)
- println(cntIDA)
- println(cntRW)
- }
-
- def orElseTest() {
- val pf0 = new PartialFunction[Unit, Unit] {
- def apply(u: Unit) { println("0:apply") }
- def isDefinedAt(u: Unit) = { println("0:isDefinedAt"); false }
- }
- val pf1 = new PartialFunction[Unit, Unit] {
- def apply(u: Unit) { println("1:apply") }
- def isDefinedAt(u: Unit) = { println("1:isDefinedAt"); false }
- }
- val pf2 = new PartialFunction[Unit, Unit] {
- def apply(u: Unit) { println("2:apply") }
- def isDefinedAt(u: Unit) = { println("2:isDefinedAt"); true }
- }
-
- val chained = pf0 orElse pf1 orElse pf2
- chained()
- }
-
- def main(args: Array[String]): Unit = {
- collectTest()
- orElseTest()
- }
-}
+import collection._ +import collection.generic._ + +object Test { + def collectIDA[A, B, Repr, That](_this: TraversableLike[A, Repr])(pf: PartialFunction[A, B])(implicit bf: CanBuildFrom[Repr, B, That]): That = { + val repr: Repr = _this.asInstanceOf[Repr] + val b = bf(repr) + _this foreach { x => if (pf isDefinedAt x) b += pf(x) } + b.result + } + + def collectRW[A, B, Repr, That](_this: TraversableLike[A, Repr])(pf: PartialFunction[A, B])(implicit bf: CanBuildFrom[Repr, B, That]): That = { + val repr: Repr = _this.asInstanceOf[Repr] + val b = bf(repr) + val f = pf runWith { b += _ } + _this foreach f + b.result + } + + var cnt = 0 + + object Ex1 { + def unapply(x: Int) : Option[Int] = { + cnt += 1 + if ((x % 3) == 0) Some(-x) else None + } + } + + object Ex2 { + def unapply(x: Int) : Option[Int] = { + //cnt += 1 + if ((x % 5) == 0) Some(x) else None + } + } + + def resetCnt() = { val r = cnt; cnt = 0; r } + + val pf: PartialFunction[Int,Int] = { + case Ex1(result) => result + case Ex2(result) => result + } + + def collectTest() { + val xs = 1 to 100 + resetCnt() + + val ysIDA = collectIDA(xs)(pf) + val cntIDA = resetCnt() + + val ysRW = collectRW(xs)(pf) + val cntRW = resetCnt() + + val ys = xs collect pf + + assert(ys == ysIDA) + assert(ys == ysRW) + assert(cntIDA == xs.length + ys.length) + assert(cntRW == xs.length) + println(ys.length) + println(cntIDA) + println(cntRW) + } + + def orElseTest() { + val pf0 = new PartialFunction[Unit, Unit] { + def apply(u: Unit) { println("0:apply") } + def isDefinedAt(u: Unit) = { println("0:isDefinedAt"); false } + } + val pf1 = new PartialFunction[Unit, Unit] { + def apply(u: Unit) { println("1:apply") } + def isDefinedAt(u: Unit) = { println("1:isDefinedAt"); false } + } + val pf2 = new PartialFunction[Unit, Unit] { + def apply(u: Unit) { println("2:apply") } + def isDefinedAt(u: Unit) = { println("2:isDefinedAt"); true } + } + + val chained = pf0 orElse pf1 orElse pf2 + chained() + } + + def main(args: Array[String]): Unit = { + collectTest() + orElseTest() + } +} diff --git a/test/files/run/primitive-sigs-2-new.check b/test/files/run/primitive-sigs-2-new.check index 6f79d73d38..59d864947c 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.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[])
+T<java.lang.Object> +List(A, char, class java.lang.Object) +a +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-old.check b/test/files/run/primitive-sigs-2-old.check index 9132b4d8ae..feb0619525 100644 --- a/test/files/run/primitive-sigs-2-old.check +++ b/test/files/run/primitive-sigs-2-old.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.Manifest<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[])
+T<java.lang.Object> +List(A, char, class java.lang.Object) +a +public <T> java.lang.Object Arr.arr4(java.lang.Object[],scala.reflect.Manifest<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/reflection-allmirrors-tostring.check b/test/files/run/reflection-allmirrors-tostring.check index b5fe6c33bb..2a3be29402 100644 --- a/test/files/run/reflection-allmirrors-tostring.check +++ b/test/files/run/reflection-allmirrors-tostring.check @@ -1,14 +1,14 @@ -class mirror for C (bound to null)
-module mirror for M (bound to null)
-instance mirror for an instance of C
-field mirror for C.f1 (bound to an instance of C)
-field mirror for C.f2 (bound to an instance of C)
-method mirror for C.m1: Int (bound to an instance of C)
-method mirror for C.m2(): Int (bound to an instance of C)
-method mirror for C.m3[T >: String <: Int]: T (bound to an instance of C)
-method mirror for C.m4[A, B <: A[Int]](x: A[B])(implicit y: Int): Nothing (bound to an instance of C)
-method mirror for C.m5(x: => Int, y: Int*): String (bound to an instance of C)
-class mirror for C.C (bound to an instance of C)
-module mirror for C.M (bound to an instance of C)
-constructor mirror for C.<init>(): C (bound to null)
-constructor mirror for C.C.<init>(): C.this.C (bound to an instance of C)
+class mirror for C (bound to null) +module mirror for M (bound to null) +instance mirror for an instance of C +field mirror for C.f1 (bound to an instance of C) +field mirror for C.f2 (bound to an instance of C) +method mirror for C.m1: Int (bound to an instance of C) +method mirror for C.m2(): Int (bound to an instance of C) +method mirror for C.m3[T >: String <: Int]: T (bound to an instance of C) +method mirror for C.m4[A, B <: A[Int]](x: A[B])(implicit y: Int): Nothing (bound to an instance of C) +method mirror for C.m5(x: => Int, y: Int*): String (bound to an instance of C) +class mirror for C.C (bound to an instance of C) +module mirror for C.M (bound to an instance of C) +constructor mirror for C.<init>(): C (bound to null) +constructor mirror for C.C.<init>(): C.this.C (bound to an instance of C) diff --git a/test/files/run/reflection-constructormirror-inner-badpath.check b/test/files/run/reflection-constructormirror-inner-badpath.check index 2fb0610ad6..83852aa80b 100644 --- a/test/files/run/reflection-constructormirror-inner-badpath.check +++ b/test/files/run/reflection-constructormirror-inner-badpath.check @@ -1,2 +1,2 @@ -class R is an inner class, use reflectClass on an InstanceMirror to obtain its ClassMirror
-()
+class R is an inner class, use reflectClass on an InstanceMirror to obtain its ClassMirror +() diff --git a/test/files/run/reflection-constructormirror-inner-good.check b/test/files/run/reflection-constructormirror-inner-good.check index 811ecb2e3f..d38fb33f97 100644 --- a/test/files/run/reflection-constructormirror-inner-good.check +++ b/test/files/run/reflection-constructormirror-inner-good.check @@ -1 +1 @@ -R(5,test)
+R(5,test) diff --git a/test/files/run/reflection-constructormirror-nested-badpath.check b/test/files/run/reflection-constructormirror-nested-badpath.check index acd21df9c0..4c65b8a58b 100644 --- a/test/files/run/reflection-constructormirror-nested-badpath.check +++ b/test/files/run/reflection-constructormirror-nested-badpath.check @@ -1,2 +1,2 @@ -class R is a static class, use reflectClass on a RuntimeMirror to obtain its ClassMirror
-()
+class R is a static class, use reflectClass on a RuntimeMirror to obtain its ClassMirror +() diff --git a/test/files/run/reflection-constructormirror-nested-good.check b/test/files/run/reflection-constructormirror-nested-good.check index 811ecb2e3f..d38fb33f97 100644 --- a/test/files/run/reflection-constructormirror-nested-good.check +++ b/test/files/run/reflection-constructormirror-nested-good.check @@ -1 +1 @@ -R(5,test)
+R(5,test) diff --git a/test/files/run/reflection-constructormirror-toplevel-badpath.check b/test/files/run/reflection-constructormirror-toplevel-badpath.check index acd21df9c0..4c65b8a58b 100644 --- a/test/files/run/reflection-constructormirror-toplevel-badpath.check +++ b/test/files/run/reflection-constructormirror-toplevel-badpath.check @@ -1,2 +1,2 @@ -class R is a static class, use reflectClass on a RuntimeMirror to obtain its ClassMirror
-()
+class R is a static class, use reflectClass on a RuntimeMirror to obtain its ClassMirror +() diff --git a/test/files/run/reflection-constructormirror-toplevel-good.check b/test/files/run/reflection-constructormirror-toplevel-good.check index 811ecb2e3f..d38fb33f97 100644 --- a/test/files/run/reflection-constructormirror-toplevel-good.check +++ b/test/files/run/reflection-constructormirror-toplevel-good.check @@ -1 +1 @@ -R(5,test)
+R(5,test) diff --git a/test/files/run/reflection-enclosed-basic.check b/test/files/run/reflection-enclosed-basic.check index 41f6a72f1c..6210b42ea5 100644 --- a/test/files/run/reflection-enclosed-basic.check +++ b/test/files/run/reflection-enclosed-basic.check @@ -1,18 +1,18 @@ -class B1
-B1
-1
-class B2
-B2
-2
-object B3
-B3
-3
-object B4
-B4
-4
-object B5
-B5
-5
-object B6
-B6
-6
+class B1 +B1 +1 +class B2 +B2 +2 +object B3 +B3 +3 +object B4 +B4 +4 +object B5 +B5 +5 +object B6 +B6 +6 diff --git a/test/files/run/reflection-enclosed-inner-basic.check b/test/files/run/reflection-enclosed-inner-basic.check index 984fb1ff12..2496ee407b 100644 --- a/test/files/run/reflection-enclosed-inner-basic.check +++ b/test/files/run/reflection-enclosed-inner-basic.check @@ -1,20 +1,20 @@ -class B
-List(constructor B, class B1, class B2, object B3, object B4, object B5, object B6)
-class B1
-B1
-1
-class B2
-B2
-2
-object B3
-B3
-3
-object B4
-B4
-4
-object B5
-B5
-5
-object B6
-B6
-6
+class B +List(constructor B, class B1, class B2, object B3, object B4, object B5, object B6) +class B1 +B1 +1 +class B2 +B2 +2 +object B3 +B3 +3 +object B4 +B4 +4 +object B5 +B5 +5 +object B6 +B6 +6 diff --git a/test/files/run/reflection-enclosed-inner-inner-basic.check b/test/files/run/reflection-enclosed-inner-inner-basic.check index 8987f31b18..add7a81c0a 100644 --- a/test/files/run/reflection-enclosed-inner-inner-basic.check +++ b/test/files/run/reflection-enclosed-inner-inner-basic.check @@ -1,20 +1,20 @@ -class BB
-List(constructor BB, class B1, class B2, object B3, object B4, object B5, object B6)
-class B1
-B1
-1
-class B2
-B2
-2
-object B3
-B3
-3
-object B4
-B4
-4
-object B5
-B5
-5
-object B6
-B6
-6
+class BB +List(constructor BB, class B1, class B2, object B3, object B4, object B5, object B6) +class B1 +B1 +1 +class B2 +B2 +2 +object B3 +B3 +3 +object B4 +B4 +4 +object B5 +B5 +5 +object B6 +B6 +6 diff --git a/test/files/run/reflection-fieldmirror-accessorsareokay.check b/test/files/run/reflection-fieldmirror-accessorsareokay.check index 635dcd04ce..e6936c8acc 100644 --- a/test/files/run/reflection-fieldmirror-accessorsareokay.check +++ b/test/files/run/reflection-fieldmirror-accessorsareokay.check @@ -1,6 +1,6 @@ -true
-42
-2
-true
-2
-2
+true +42 +2 +true +2 +2 diff --git a/test/files/run/reflection-fieldmirror-ctorparam.check b/test/files/run/reflection-fieldmirror-ctorparam.check index 31f6491b14..e391e7ccfe 100644 --- a/test/files/run/reflection-fieldmirror-ctorparam.check +++ b/test/files/run/reflection-fieldmirror-ctorparam.check @@ -1,3 +1,3 @@ class scala.ScalaReflectionException: Scala field x isn't represented as a Java field, neither it has a Java accessor method note that private parameters of class constructors don't get mapped onto fields and/or accessors, -unless they are used outside of their declaring constructors.
+unless they are used outside of their declaring constructors. diff --git a/test/files/run/reflection-fieldmirror-getsetval.check b/test/files/run/reflection-fieldmirror-getsetval.check index e1927f68d0..82fef37c25 100644 --- a/test/files/run/reflection-fieldmirror-getsetval.check +++ b/test/files/run/reflection-fieldmirror-getsetval.check @@ -1,2 +1,2 @@ -42
-cannot set an immutable field x
+42 +cannot set an immutable field x diff --git a/test/files/run/reflection-fieldmirror-getsetvar.check b/test/files/run/reflection-fieldmirror-getsetvar.check index a9b0ccc6a0..1e959a9900 100644 --- a/test/files/run/reflection-fieldmirror-getsetvar.check +++ b/test/files/run/reflection-fieldmirror-getsetvar.check @@ -1,2 +1,2 @@ -42
-2
+42 +2 diff --git a/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.check b/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.check index fe75c80bca..27ba77ddaf 100644 --- a/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.check +++ b/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.check @@ -1 +1 @@ -true
+true diff --git a/test/files/run/reflection-fieldmirror-privatethis.check b/test/files/run/reflection-fieldmirror-privatethis.check index 889b7c2c34..16010115e1 100644 --- a/test/files/run/reflection-fieldmirror-privatethis.check +++ b/test/files/run/reflection-fieldmirror-privatethis.check @@ -1,3 +1,3 @@ -true
-42
-2
+true +42 +2 diff --git a/test/files/run/reflection-fieldsymbol-navigation.check b/test/files/run/reflection-fieldsymbol-navigation.check index 79f0928ea5..ae0597a045 100644 --- a/test/files/run/reflection-fieldsymbol-navigation.check +++ b/test/files/run/reflection-fieldsymbol-navigation.check @@ -1,6 +1,6 @@ -method x
-false
-variable x
-true
-method x
-method x_=
+method x +false +variable x +true +method x +method x_= diff --git a/test/files/run/reflection-implicit.check b/test/files/run/reflection-implicit.check new file mode 100644 index 0000000000..5a88a46f0b --- /dev/null +++ b/test/files/run/reflection-implicit.check @@ -0,0 +1,2 @@ +List(true, true, true, true) +true diff --git a/test/files/run/reflection-implicit.scala b/test/files/run/reflection-implicit.scala new file mode 100644 index 0000000000..637ef24e14 --- /dev/null +++ b/test/files/run/reflection-implicit.scala @@ -0,0 +1,15 @@ +import scala.reflect.runtime.universe._ + +class C { + implicit val v = new C + implicit def d(x: C)(implicit c: C): Int = ??? + implicit class X(val x: Int) +} + +object Test extends App { + val decls = typeOf[C].typeSymbol.typeSignature.declarations.sorted.toList.filter(sym => !sym.isTerm || (sym.isMethod && !sym.asMethod.isConstructor)) + println(decls map (_.isImplicit)) + val param = decls.find(_.name.toString == "d").get.asMethod.params.last.head + param.typeSignature + println(param.isImplicit) +}
\ No newline at end of file diff --git a/test/files/run/reflection-java-annotations.check b/test/files/run/reflection-java-annotations.check new file mode 100644 index 0000000000..53c53cfbcc --- /dev/null +++ b/test/files/run/reflection-java-annotations.check @@ -0,0 +1 @@ +List(JavaComplexAnnotation(v1 = 1, v10 = "hello", v101 = [101, 101], v102 = [102, 102], v103 = ['g', 'g'], v104 = [104, 104], v105 = [105L, 105L], v106 = [106.0, 106.0], v107 = [107.0, 107.0], v108 = [false, true], v11 = classOf[JavaAnnottee], v110 = ["hello", "world"], v111 = [classOf[JavaSimpleAnnotation], classOf[JavaComplexAnnotation]], v112 = [FOO, BAR], v113 = [JavaSimpleAnnotation(v1 = 21, v10 = "world2", v11 = classOf[JavaComplexAnnotation], v12 = BAR, v2 = 22, v3 = '\027', v4 = 24, v5 = 25L, v6 = 26.0, v7 = 27.0, v8 = false)], v12 = FOO, v13 = JavaSimpleAnnotation(v1 = 11, v10 = "world1", v11 = classOf[JavaSimpleAnnotation], v12 = FOO, v2 = 12, v3 = '\r', v4 = 14, v5 = 15L, v6 = 16.0, v7 = 17.0, v8 = false), v2 = 2, v3 = '\03', v4 = 4, v5 = 5L, v6 = 6.0, v7 = 7.0, v8 = false)) diff --git a/test/files/run/reflection-java-annotations.scala b/test/files/run/reflection-java-annotations.scala new file mode 100644 index 0000000000..2e3fed48ce --- /dev/null +++ b/test/files/run/reflection-java-annotations.scala @@ -0,0 +1,7 @@ +object Test extends App { + import scala.reflect.runtime.universe._ + val sym = typeOf[JavaAnnottee].typeSymbol + sym.typeSignature + sym.annotations foreach (_.javaArgs) + println(sym.annotations) +}
\ No newline at end of file diff --git a/test/files/run/reflection-java-crtp.check b/test/files/run/reflection-java-crtp.check new file mode 100644 index 0000000000..3e5a77e93a --- /dev/null +++ b/test/files/run/reflection-java-crtp.check @@ -0,0 +1 @@ +(type E,type E,true) diff --git a/test/files/run/reflection-java-crtp.scala b/test/files/run/reflection-java-crtp.scala new file mode 100644 index 0000000000..260d3540dc --- /dev/null +++ b/test/files/run/reflection-java-crtp.scala @@ -0,0 +1,8 @@ +object Test extends App { + import scala.reflect.runtime.universe._ + val enum = typeOf[JavaSimpleEnumeration].baseClasses(1).asClass + // make sure that the E's in Enum<E extends Enum<E>> are represented by the same symbol + val e1 = enum.typeParams(0).asType + val TypeBounds(_, TypeRef(_, _, List(TypeRef(_, e2: TypeSymbol, _)))) = e1.typeSignature + println(e1, e2, e1 eq e2) +}
\ No newline at end of file diff --git a/test/files/run/reflection-magicsymbols-invoke.check b/test/files/run/reflection-magicsymbols-invoke.check index 674716adfe..f5258efeb7 100644 --- a/test/files/run/reflection-magicsymbols-invoke.check +++ b/test/files/run/reflection-magicsymbols-invoke.check @@ -1,124 +1,124 @@ ============ -Any
-it's important to print the list of Any's members
-if some of them change (possibly, adding and/or removing magic symbols), we must update this test
-method !=: (x$1: Any)Boolean
-method ##: ()Int
-method ==: (x$1: Any)Boolean
-method asInstanceOf: [T0]=> T0
-method equals: (x$1: Any)Boolean
-method getClass: ()java.lang.Class[_]
-method hashCode: ()Int
-method isInstanceOf: [T0]=> Boolean
-method toString: ()java.lang.String
-testing Any.!=: false
-testing Any.##: 50
-testing Any.==: true
-testing Any.asInstanceOf: class scala.ScalaReflectionException: Any.asInstanceOf requires a type argument, it cannot be invoked with mirrors
-testing Any.asInstanceOf: class scala.ScalaReflectionException: scala.Any.asInstanceOf[T0]: T0 takes 0 arguments
-testing Any.equals: true
-testing Any.getClass: class java.lang.String
-testing Any.hashCode: 50
-testing Any.isInstanceOf: class scala.ScalaReflectionException: Any.isInstanceOf requires a type argument, it cannot be invoked with mirrors
-testing Any.isInstanceOf: class scala.ScalaReflectionException: scala.Any.isInstanceOf[T0]: Boolean takes 0 arguments
-testing Any.toString: 2
+Any +it's important to print the list of Any's members +if some of them change (possibly, adding and/or removing magic symbols), we must update this test +method !=: (x$1: Any)Boolean +method ##: ()Int +method ==: (x$1: Any)Boolean +method asInstanceOf: [T0]=> T0 +method equals: (x$1: Any)Boolean +method getClass: ()java.lang.Class[_] +method hashCode: ()Int +method isInstanceOf: [T0]=> Boolean +method toString: ()java.lang.String +testing Any.!=: false +testing Any.##: 50 +testing Any.==: true +testing Any.asInstanceOf: class scala.ScalaReflectionException: Any.asInstanceOf requires a type argument, it cannot be invoked with mirrors +testing Any.asInstanceOf: class scala.ScalaReflectionException: scala.Any.asInstanceOf[T0]: T0 takes 0 arguments +testing Any.equals: true +testing Any.getClass: class java.lang.String +testing Any.hashCode: 50 +testing Any.isInstanceOf: class scala.ScalaReflectionException: Any.isInstanceOf requires a type argument, it cannot be invoked with mirrors +testing Any.isInstanceOf: class scala.ScalaReflectionException: scala.Any.isInstanceOf[T0]: Boolean takes 0 arguments +testing Any.toString: 2 ============ -AnyVal
-it's important to print the list of AnyVal's members
-if some of them change (possibly, adding and/or removing magic symbols), we must update this test
-constructor AnyVal: ()AnyVal
-method getClass: ()Class[_ <: AnyVal]
-testing AnyVal.<init>: class java.lang.InstantiationException: null
-testing AnyVal.getClass: class scala.ScalaReflectionException: expected a member of class Integer, you provided method scala.AnyVal.getClass
+AnyVal +it's important to print the list of AnyVal's members +if some of them change (possibly, adding and/or removing magic symbols), we must update this test +constructor AnyVal: ()AnyVal +method getClass: ()Class[_ <: AnyVal] +testing AnyVal.<init>: class java.lang.InstantiationException: null +testing AnyVal.getClass: class scala.ScalaReflectionException: expected a member of class Integer, you provided method scala.AnyVal.getClass ============ -AnyRef
-it's important to print the list of AnyRef's members
-if some of them change (possibly, adding and/or removing magic symbols), we must update this test
-constructor Object: ()java.lang.Object
-method !=: (x$1: Any)Boolean
-method !=: (x$1: AnyRef)Boolean
-method ##: ()Int
-method $asInstanceOf: [T0]()T0
-method $isInstanceOf: [T0]()Boolean
-method ==: (x$1: Any)Boolean
-method ==: (x$1: AnyRef)Boolean
-method asInstanceOf: [T0]=> T0
-method clone: ()java.lang.Object
-method eq: (x$1: AnyRef)Boolean
-method equals: (x$1: Any)Boolean
-method finalize: ()Unit
-method getClass: ()java.lang.Class[_]
-method hashCode: ()Int
-method isInstanceOf: [T0]=> Boolean
-method ne: (x$1: AnyRef)Boolean
-method notify: ()Unit
-method notifyAll: ()Unit
-method synchronized: [T0](x$1: T0)T0
-method toString: ()java.lang.String
-method wait: ()Unit
-method wait: (x$1: Long)Unit
-method wait: (x$1: Long, x$2: Int)Unit
-testing Object.!=: false
-testing Object.##: 50
-testing Object.$asInstanceOf: class scala.ScalaReflectionException: AnyRef.$asInstanceOf is an internal method, it cannot be invoked with mirrors
-testing Object.$asInstanceOf: class scala.ScalaReflectionException: java.lang.Object.$asInstanceOf[T0](): T0 takes 0 arguments
-testing Object.$isInstanceOf: class scala.ScalaReflectionException: AnyRef.$isInstanceOf is an internal method, it cannot be invoked with mirrors
-testing Object.$isInstanceOf: class scala.ScalaReflectionException: java.lang.Object.$isInstanceOf[T0](): Boolean takes 0 arguments
-testing Object.==: true
-testing Object.clone: class java.lang.CloneNotSupportedException: java.lang.String
-testing Object.eq: true
-testing Object.equals: true
-testing Object.finalize: ()
-testing Object.getClass: class java.lang.String
-testing Object.hashCode: 50
-testing Object.ne: false
-testing Object.notify: class java.lang.IllegalMonitorStateException: null
-testing Object.notifyAll: class java.lang.IllegalMonitorStateException: null
-testing Object.synchronized: 2
-testing Object.toString: 2
-TODO: also test AnyRef.wait overloads
+AnyRef +it's important to print the list of AnyRef's members +if some of them change (possibly, adding and/or removing magic symbols), we must update this test +constructor Object: ()java.lang.Object +method !=: (x$1: Any)Boolean +method !=: (x$1: AnyRef)Boolean +method ##: ()Int +method $asInstanceOf: [T0]()T0 +method $isInstanceOf: [T0]()Boolean +method ==: (x$1: Any)Boolean +method ==: (x$1: AnyRef)Boolean +method asInstanceOf: [T0]=> T0 +method clone: ()java.lang.Object +method eq: (x$1: AnyRef)Boolean +method equals: (x$1: Any)Boolean +method finalize: ()Unit +method getClass: ()java.lang.Class[_] +method hashCode: ()Int +method isInstanceOf: [T0]=> Boolean +method ne: (x$1: AnyRef)Boolean +method notify: ()Unit +method notifyAll: ()Unit +method synchronized: [T0](x$1: T0)T0 +method toString: ()java.lang.String +method wait: ()Unit +method wait: (x$1: Long)Unit +method wait: (x$1: Long, x$2: Int)Unit +testing Object.!=: false +testing Object.##: 50 +testing Object.$asInstanceOf: class scala.ScalaReflectionException: AnyRef.$asInstanceOf is an internal method, it cannot be invoked with mirrors +testing Object.$asInstanceOf: class scala.ScalaReflectionException: java.lang.Object.$asInstanceOf[T0](): T0 takes 0 arguments +testing Object.$isInstanceOf: class scala.ScalaReflectionException: AnyRef.$isInstanceOf is an internal method, it cannot be invoked with mirrors +testing Object.$isInstanceOf: class scala.ScalaReflectionException: java.lang.Object.$isInstanceOf[T0](): Boolean takes 0 arguments +testing Object.==: true +testing Object.clone: class java.lang.CloneNotSupportedException: java.lang.String +testing Object.eq: true +testing Object.equals: true +testing Object.finalize: () +testing Object.getClass: class java.lang.String +testing Object.hashCode: 50 +testing Object.ne: false +testing Object.notify: class java.lang.IllegalMonitorStateException: null +testing Object.notifyAll: class java.lang.IllegalMonitorStateException: null +testing Object.synchronized: 2 +testing Object.toString: 2 +TODO: also test AnyRef.wait overloads ============ -Array
-it's important to print the list of Array's members
-if some of them change (possibly, adding and/or removing magic symbols), we must update this test
-constructor Array: (_length: Int)Array[T]
-constructor Object: ()java.lang.Object
-method !=: (x$1: Any)Boolean
-method !=: (x$1: AnyRef)Boolean
-method ##: ()Int
-method $asInstanceOf: [T0]()T0
-method $isInstanceOf: [T0]()Boolean
-method ==: (x$1: Any)Boolean
-method ==: (x$1: AnyRef)Boolean
-method apply: (i: <?>)T
-method asInstanceOf: [T0]=> T0
-method clone: ()Array[T]
-method eq: (x$1: AnyRef)Boolean
-method equals: (x$1: Any)Boolean
-method finalize: ()Unit
-method getClass: ()java.lang.Class[_]
-method hashCode: ()Int
-method isInstanceOf: [T0]=> Boolean
-method length: => Int
-method ne: (x$1: AnyRef)Boolean
-method notify: ()Unit
-method notifyAll: ()Unit
-method synchronized: [T0](x$1: T0)T0
-method toString: ()java.lang.String
-method update: (i: <?>, x: <?>)Unit
-method wait: ()Unit
-method wait: (x$1: Long)Unit
-method wait: (x$1: Long, x$2: Int)Unit
-value _length: Int
-testing Array.length: 2
-testing Array.apply: 1
-testing Array.update: ()
-testing Array.clone: List(1, 2)
+Array +it's important to print the list of Array's members +if some of them change (possibly, adding and/or removing magic symbols), we must update this test +constructor Array: (_length: Int)Array[T] +constructor Object: ()java.lang.Object +method !=: (x$1: Any)Boolean +method !=: (x$1: AnyRef)Boolean +method ##: ()Int +method $asInstanceOf: [T0]()T0 +method $isInstanceOf: [T0]()Boolean +method ==: (x$1: Any)Boolean +method ==: (x$1: AnyRef)Boolean +method apply: (i: Int)T +method asInstanceOf: [T0]=> T0 +method clone: ()Array[T] +method eq: (x$1: AnyRef)Boolean +method equals: (x$1: Any)Boolean +method finalize: ()Unit +method getClass: ()java.lang.Class[_] +method hashCode: ()Int +method isInstanceOf: [T0]=> Boolean +method length: => Int +method ne: (x$1: AnyRef)Boolean +method notify: ()Unit +method notifyAll: ()Unit +method synchronized: [T0](x$1: T0)T0 +method toString: ()java.lang.String +method update: (i: Int, x: T)Unit +method wait: ()Unit +method wait: (x$1: Long)Unit +method wait: (x$1: Long, x$2: Int)Unit +value _length: Int +testing Array.length: 2 +testing Array.apply: 1 +testing Array.update: () +testing Array.clone: List(1, 2) ============ -Other
-testing String.+: 23
+Other +testing String.+: 23 ============ -CTM
-testing Predef.classOf: class scala.ScalaReflectionException: Predef.classOf is a compile-time function, it cannot be invoked with mirrors
-testing Predef.classOf: class scala.ScalaReflectionException: scala.Predef.classOf[T]: Class[T] takes 0 arguments
-testing Universe.reify: class scala.ScalaReflectionException: scala.reflect.base.Universe.reify is a macro, i.e. a compile-time function, it cannot be invoked with mirrors
+CTM +testing Predef.classOf: class scala.ScalaReflectionException: Predef.classOf is a compile-time function, it cannot be invoked with mirrors +testing Predef.classOf: class scala.ScalaReflectionException: scala.Predef.classOf[T]: Class[T] takes 0 arguments +testing Universe.reify: class scala.ScalaReflectionException: scala.reflect.api.Universe.reify is a macro, i.e. a compile-time function, it cannot be invoked with mirrors diff --git a/test/files/run/reflection-magicsymbols-invoke.scala b/test/files/run/reflection-magicsymbols-invoke.scala index 61ecc6458d..b38d1be7b2 100644 --- a/test/files/run/reflection-magicsymbols-invoke.scala +++ b/test/files/run/reflection-magicsymbols-invoke.scala @@ -90,5 +90,5 @@ object Test extends App { println("============\nCTM") test(PredefModule.moduleClass.typeSignature, Predef, "classOf") test(PredefModule.moduleClass.typeSignature, Predef, "classOf", typeOf[String]) - test(typeOf[scala.reflect.base.Universe], scala.reflect.runtime.universe, "reify", "2") + test(typeOf[scala.reflect.api.Universe], scala.reflect.runtime.universe, "reify", "2") }
\ No newline at end of file diff --git a/test/files/run/reflection-magicsymbols-repl.check b/test/files/run/reflection-magicsymbols-repl.check index d2ef4ad3cd..d3cd26f25f 100644 --- a/test/files/run/reflection-magicsymbols-repl.check +++ b/test/files/run/reflection-magicsymbols-repl.check @@ -1,39 +1,39 @@ -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> class A {
- def foo1(x: Int*) = ???
- def foo2(x: => Int) = ???
- def foo3(x: Any) = ???
- def foo4(x: AnyRef) = ???
- def foo5(x: AnyVal) = ???
- def foo6(x: Null) = ???
- def foo7(x: Nothing) = ???
- def foo8(x: Singleton) = ???
-}
-defined class A
-
-scala> def test(n: Int): Unit = {
- val sig = typeOf[A] member newTermName("foo" + n) typeSignature
- val x = sig.asInstanceOf[MethodType].params.head
- println(x.typeSignature)
-}
-warning: there were 1 feature warnings; re-run with -feature for details
-test: (n: Int)Unit
-
-scala> for (i <- 1 to 8) test(i)
-scala.Int*
-=> scala.Int
-scala.Any
-scala.AnyRef
-scala.AnyVal
-scala.Null
-scala.Nothing
-scala.Singleton
-
-scala>
+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> class A { + def foo1(x: Int*) = ??? + def foo2(x: => Int) = ??? + def foo3(x: Any) = ??? + def foo4(x: AnyRef) = ??? + def foo5(x: AnyVal) = ??? + def foo6(x: Null) = ??? + def foo7(x: Nothing) = ??? + def foo8(x: Singleton) = ??? +} +defined class A + +scala> def test(n: Int): Unit = { + val sig = typeOf[A] member newTermName("foo" + n) typeSignature + val x = sig.asInstanceOf[MethodType].params.head + println(x.typeSignature) +} +warning: there were 1 feature warnings; re-run with -feature for details +test: (n: Int)Unit + +scala> for (i <- 1 to 8) test(i) +scala.Int* +=> scala.Int +scala.Any +scala.AnyRef +scala.AnyVal +scala.Null +scala.Nothing +scala.Singleton + +scala> diff --git a/test/files/run/reflection-magicsymbols-vanilla.check b/test/files/run/reflection-magicsymbols-vanilla.check index 4f4e8d94a9..d3ff152896 100644 --- a/test/files/run/reflection-magicsymbols-vanilla.check +++ b/test/files/run/reflection-magicsymbols-vanilla.check @@ -1,8 +1,8 @@ -Int*
-=> Int
-Any
-AnyRef
-AnyVal
-Null
-Nothing
-Singleton
+Int* +=> Int +Any +AnyRef +AnyVal +Null +Nothing +Singleton diff --git a/test/files/run/reflection-mem-glbs.scala b/test/files/run/reflection-mem-glbs.scala new file mode 100644 index 0000000000..3f29a914bc --- /dev/null +++ b/test/files/run/reflection-mem-glbs.scala @@ -0,0 +1,13 @@ +import scala.tools.partest.MemoryTest + +trait A { type T <: A } +trait B { type T <: B } + +object Test extends MemoryTest { + override def maxDelta = 10 + override def calcsPerIter = 50000 + override def calc() { + import scala.reflect.runtime.universe._ + glb(List(typeOf[A], typeOf[B])) + } +}
\ No newline at end of file diff --git a/test/files/run/reflection-mem-tags.scala b/test/files/run/reflection-mem-tags.scala new file mode 100644 index 0000000000..8815e7dcd8 --- /dev/null +++ b/test/files/run/reflection-mem-tags.scala @@ -0,0 +1,17 @@ +import scala.tools.partest.MemoryTest + +trait A { type T <: A } +trait B { type T <: B } + +object Test extends MemoryTest { + override def maxDelta = 10 + override def calcsPerIter = 100000 + override def calc() { + import scala.reflect.runtime.universe._ + def foo = { + class A { def x = 2; def y: A = new A } + weakTypeOf[A { def z: Int }] + } + foo + } +}
\ No newline at end of file diff --git a/test/files/run/reflection-mem-typecheck.scala b/test/files/run/reflection-mem-typecheck.scala new file mode 100644 index 0000000000..a312c2c893 --- /dev/null +++ b/test/files/run/reflection-mem-typecheck.scala @@ -0,0 +1,26 @@ +import scala.tools.partest.MemoryTest + +trait A { type T <: A } +trait B { type T <: B } + +object Test extends MemoryTest { + lazy val tb = { + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox + cm.mkToolBox() + } + + override def maxDelta = 10 + override def calcsPerIter = 8 + override def calc() { + var snippet = """ + trait A { type T <: A } + trait B { type T <: B } + def foo[T](x: List[T]) = x + foo(List(new A {}, new B {})) + """.trim + snippet = snippet + "\n" + (List.fill(50)(snippet.split("\n").last) mkString "\n") + tb.typeCheck(tb.parse(snippet)) + } +}
\ No newline at end of file diff --git a/test/files/run/reflection-methodsymbol-params.check b/test/files/run/reflection-methodsymbol-params.check index 11f349d52b..554e72d553 100644 --- a/test/files/run/reflection-methodsymbol-params.check +++ b/test/files/run/reflection-methodsymbol-params.check @@ -1,8 +1,8 @@ -List()
-List(List())
-List(List(value x))
-List(List(value x), List(value y))
-List()
-List(List())
-List(List(value x))
-List(List(value x), List(value y))
+List() +List(List()) +List(List(value x)) +List(List(value x), List(value y)) +List() +List(List()) +List(List(value x)) +List(List(value x), List(value y)) diff --git a/test/files/run/reflection-methodsymbol-returntype.check b/test/files/run/reflection-methodsymbol-returntype.check index 0f30d1beaf..97ea02956d 100644 --- a/test/files/run/reflection-methodsymbol-returntype.check +++ b/test/files/run/reflection-methodsymbol-returntype.check @@ -1,8 +1,8 @@ -Int
-Int
-Int
-Int
-Int
-Int
-Int
-Int
+Int +Int +Int +Int +Int +Int +Int +Int diff --git a/test/files/run/reflection-methodsymbol-typeparams.check b/test/files/run/reflection-methodsymbol-typeparams.check index c888e09a17..f04188775c 100644 --- a/test/files/run/reflection-methodsymbol-typeparams.check +++ b/test/files/run/reflection-methodsymbol-typeparams.check @@ -1,8 +1,8 @@ -List()
-List()
-List()
-List()
-List(type T)
-List(type T)
-List(type T)
-List(type T)
+List() +List() +List() +List() +List(type T) +List(type T) +List(type T) +List(type T) diff --git a/test/files/run/reflection-modulemirror-inner-badpath.check b/test/files/run/reflection-modulemirror-inner-badpath.check index 1e990ec900..a8e7397c8f 100644 --- a/test/files/run/reflection-modulemirror-inner-badpath.check +++ b/test/files/run/reflection-modulemirror-inner-badpath.check @@ -1,2 +1,2 @@ -object R is an inner module, use reflectModule on an InstanceMirror to obtain its ModuleMirror
-()
+object R is an inner module, use reflectModule on an InstanceMirror to obtain its ModuleMirror +() diff --git a/test/files/run/reflection-modulemirror-inner-good.check b/test/files/run/reflection-modulemirror-inner-good.check index fe658e7087..331bae08fb 100644 --- a/test/files/run/reflection-modulemirror-inner-good.check +++ b/test/files/run/reflection-modulemirror-inner-good.check @@ -1 +1 @@ -R
+R diff --git a/test/files/run/reflection-modulemirror-nested-badpath.check b/test/files/run/reflection-modulemirror-nested-badpath.check index f7980b9986..3ef94e1ec6 100644 --- a/test/files/run/reflection-modulemirror-nested-badpath.check +++ b/test/files/run/reflection-modulemirror-nested-badpath.check @@ -1,2 +1,2 @@ -object R is a static module, use reflectModule on a RuntimeMirror to obtain its ModuleMirror
-()
+object R is a static module, use reflectModule on a RuntimeMirror to obtain its ModuleMirror +() diff --git a/test/files/run/reflection-modulemirror-nested-good.check b/test/files/run/reflection-modulemirror-nested-good.check index fe658e7087..331bae08fb 100644 --- a/test/files/run/reflection-modulemirror-nested-good.check +++ b/test/files/run/reflection-modulemirror-nested-good.check @@ -1 +1 @@ -R
+R diff --git a/test/files/run/reflection-modulemirror-toplevel-badpath.check b/test/files/run/reflection-modulemirror-toplevel-badpath.check index f7980b9986..3ef94e1ec6 100644 --- a/test/files/run/reflection-modulemirror-toplevel-badpath.check +++ b/test/files/run/reflection-modulemirror-toplevel-badpath.check @@ -1,2 +1,2 @@ -object R is a static module, use reflectModule on a RuntimeMirror to obtain its ModuleMirror
-()
+object R is a static module, use reflectModule on a RuntimeMirror to obtain its ModuleMirror +() diff --git a/test/files/run/reflection-repl-classes.check b/test/files/run/reflection-repl-classes.check index 1c7f86c90c..2dd96a93bf 100644 --- a/test/files/run/reflection-repl-classes.check +++ b/test/files/run/reflection-repl-classes.check @@ -1,35 +1,35 @@ -Type in expressions to have them evaluated.
-Type :help for more information.
-
-scala>
-
-scala> class A
-defined class A
-
-scala>
-
-scala> class B {
- def foo(x: A) = 1
-}
-defined class B
-
-scala>
-
-scala> object defs {
- val cm = reflect.runtime.currentMirror
- val u = cm.universe
- val im = cm.reflect(new B)
- val method = im.symbol.typeSignature.member(u.newTermName("foo")).asMethod
- val mm = im.reflectMethod(method)
-}
-defined module defs
-
-scala> import defs._
-import defs._
-
-scala>
-
-scala> mm(new A)
-res0: Any = 1
-
-scala>
+Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> class A +defined class A + +scala> + +scala> class B { + def foo(x: A) = 1 +} +defined class B + +scala> + +scala> object defs { + val cm = reflect.runtime.currentMirror + val u = cm.universe + val im = cm.reflect(new B) + val method = im.symbol.typeSignature.member(u.newTermName("foo")).asMethod + val mm = im.reflectMethod(method) +} +defined module defs + +scala> import defs._ +import defs._ + +scala> + +scala> mm(new A) +res0: Any = 1 + +scala> diff --git a/test/files/run/reflection-repl-elementary.check b/test/files/run/reflection-repl-elementary.check index 341dd10ab0..d9133f7e3e 100644 --- a/test/files/run/reflection-repl-elementary.check +++ b/test/files/run/reflection-repl-elementary.check @@ -1,9 +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 = scala.List[Nothing]
-
-scala>
+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 = scala.List[Nothing] + +scala> diff --git a/test/files/run/reflection-sorted-decls.check b/test/files/run/reflection-sorted-decls.check index 02168c4e5f..415e073149 100644 --- a/test/files/run/reflection-sorted-decls.check +++ b/test/files/run/reflection-sorted-decls.check @@ -1,3 +1,3 @@ -value a
-value b
-value c
+value a +value b +value c diff --git a/test/files/run/reflection-sorted-members.check b/test/files/run/reflection-sorted-members.check index bb85b5a13c..c148e19e69 100644 --- a/test/files/run/reflection-sorted-members.check +++ b/test/files/run/reflection-sorted-members.check @@ -1,4 +1,4 @@ -value a
-value b
-value c
-value x
+value a +value b +value c +value x diff --git a/test/files/run/reflection-valueclasses-derived.check b/test/files/run/reflection-valueclasses-derived.check index bfcfcade5e..3382d41556 100644 --- a/test/files/run/reflection-valueclasses-derived.check +++ b/test/files/run/reflection-valueclasses-derived.check @@ -1,3 +1,3 @@ -4
-class C
-C@2
+4 +class C +C@2 diff --git a/test/files/run/reflection-valueclasses-standard.check b/test/files/run/reflection-valueclasses-standard.check index 060ab55406..643c3d048c 100644 --- a/test/files/run/reflection-valueclasses-standard.check +++ b/test/files/run/reflection-valueclasses-standard.check @@ -1,27 +1,27 @@ -========byte========
-byte
-2
-========short========
-short
-2
-========int========
-int
-2
-========long========
-long
-2
-========float========
-float
-2.0
-========double========
-double
-2.0
-========char========
-char
-2
-========boolean========
-boolean
-true
-========void========
-void
-()
+========byte======== +byte +2 +========short======== +short +2 +========int======== +int +2 +========long======== +long +2 +========float======== +float +2.0 +========double======== +double +2.0 +========char======== +char +2 +========boolean======== +boolean +true +========void======== +void +() diff --git a/test/files/run/reify-aliases.check b/test/files/run/reify-aliases.check index 392dd59a1d..aa846b9bc6 100644 --- a/test/files/run/reify-aliases.check +++ b/test/files/run/reify-aliases.check @@ -1 +1 @@ -TypeRef(SingleType(ThisType(scala), scala.Predef), newTypeName("String"), List())
+TypeRef(SingleType(ThisType(scala), scala.Predef), newTypeName("String"), List()) diff --git a/test/files/run/reify-repl-fail-gracefully.check b/test/files/run/reify-repl-fail-gracefully.check index 5a97983e54..1b0f3f2162 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.runtime.universe._
-import scala.reflect.runtime.universe._
-
-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-staticXXX.check b/test/files/run/reify-staticXXX.check index 5762ec47d6..37102b29e1 100644 --- a/test/files/run/reify-staticXXX.check +++ b/test/files/run/reify-staticXXX.check @@ -1,24 +1,24 @@ -object
-object
-class
-class
-object > object
-object > object
-object > class
-object > class
-package > object
-package > object
-package > class
-package > class
-object
-object
-class
-class
-object > object
-object > object
-object > class
-object > class
-package > object
-package > object
-package > class
-package > class
+object +object +class +class +object > object +object > object +object > class +object > class +package > object +package > object +package > class +package > class +object +object +class +class +object > object +object > object +object > class +object > class +package > object +package > object +package > class +package > class diff --git a/test/files/run/reify_ann1a.check b/test/files/run/reify_ann1a.check index 9bbb0ab87a..244be27aa7 100644 --- a/test/files/run/reify_ann1a.check +++ b/test/files/run/reify_ann1a.check @@ -1,30 +1,30 @@ -{
- @new ann(immutable.this.List.apply("1a")) @new ann(immutable.this.List.apply("1b")) class C[@new ann(immutable.this.List.apply("2a")) @new ann(immutable.this.List.apply("2b")) T >: Nothing <: Any] extends AnyRef {
- @new ann(immutable.this.List.apply("3a")) @new ann(immutable.this.List.apply("3b")) <paramaccessor> private[this] val x: T @ann(immutable.this.List.apply("4a")) @ann(immutable.this.List.apply("4b")) = _;
- def <init>(@new ann(immutable.this.List.apply("3a")) @new ann(immutable.this.List.apply("3b")) x: T @ann(immutable.this.List.apply("4a")) @ann(immutable.this.List.apply("4b"))) = {
- super.<init>();
- ()
- };
- @new ann(immutable.this.List.apply("5a")) @new ann(immutable.this.List.apply("5b")) def f(x: Int @ann(immutable.this.List.apply("6a")) @ann(immutable.this.List.apply("6b"))) = {
- @new ann(immutable.this.List.apply("7a")) @new ann(immutable.this.List.apply("7b")) val r = x.$plus(3): @ann(immutable.this.List.apply("8a")): @ann(immutable.this.List.apply("8b"));
- val s = (4: Int @ann(immutable.this.List.apply("9a")) @ann(immutable.this.List.apply("9b")));
- r.$plus(s)
- }
- };
- ()
-}
-{
- @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 AnyRef {
- @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] = {
- 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")));
- r.+(s)
- }
- };
- ()
-}
+{ + @new ann(immutable.this.List.apply("1a")) @new ann(immutable.this.List.apply("1b")) class C[@new ann(immutable.this.List.apply("2a")) @new ann(immutable.this.List.apply("2b")) T >: Nothing <: Any] extends AnyRef { + @new ann(immutable.this.List.apply("3a")) @new ann(immutable.this.List.apply("3b")) <paramaccessor> private[this] val x: T @ann(immutable.this.List.apply("4a")) @ann(immutable.this.List.apply("4b")) = _; + def <init>(@new ann(immutable.this.List.apply("3a")) @new ann(immutable.this.List.apply("3b")) x: T @ann(immutable.this.List.apply("4a")) @ann(immutable.this.List.apply("4b"))) = { + super.<init>(); + () + }; + @new ann(immutable.this.List.apply("5a")) @new ann(immutable.this.List.apply("5b")) def f(x: Int @ann(immutable.this.List.apply("6a")) @ann(immutable.this.List.apply("6b"))) = { + @new ann(immutable.this.List.apply("7a")) @new ann(immutable.this.List.apply("7b")) val r = x.$plus(3): @ann(immutable.this.List.apply("8a")): @ann(immutable.this.List.apply("8b")); + val s = (4: Int @ann(immutable.this.List.apply("9a")) @ann(immutable.this.List.apply("9b"))); + r.$plus(s) + } + }; + () +} +{ + @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 AnyRef { + @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] = { + 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"))); + r.+(s) + } + }; + () +} diff --git a/test/files/run/reify_ann1a.scala b/test/files/run/reify_ann1a.scala index 754baef6b7..c23048e463 100644 --- a/test/files/run/reify_ann1a.scala +++ b/test/files/run/reify_ann1a.scala @@ -21,9 +21,8 @@ object Test extends App { // test 2: import and typecheck val toolbox = cm.mkToolBox() val ttree = toolbox.typeCheck(tree) - ttree.foreach(sub => if (sub.hasSymbol) sub.symbol.typeSignature) println(ttree.toString) // test 3: import and compile - toolbox.runExpr(tree) + toolbox.eval(tree) }
\ No newline at end of file diff --git a/test/files/run/reify_ann1b.check b/test/files/run/reify_ann1b.check index 4a51c02701..6a5f32a492 100644 --- a/test/files/run/reify_ann1b.check +++ b/test/files/run/reify_ann1b.check @@ -1,30 +1,30 @@ -{
- @new ann(bar = "1a") @new ann(bar = "1b") class C[@new ann(bar = "2a") @new ann(bar = "2b") T >: Nothing <: Any] extends AnyRef {
- @new ann(bar = "3a") @new ann(bar = "3b") <paramaccessor> private[this] val x: T @ann(bar = "4a") @ann(bar = "4b") = _;
- def <init>(@new ann(bar = "3a") @new ann(bar = "3b") x: T @ann(bar = "4a") @ann(bar = "4b")) = {
- super.<init>();
- ()
- };
- @new ann(bar = "5a") @new ann(bar = "5b") def f(x: Int @ann(bar = "6a") @ann(bar = "6b")) = {
- @new ann(bar = "7a") @new ann(bar = "7b") val r = x.$plus(3): @ann(bar = "8a"): @ann(bar = "8b");
- val s = (4: Int @ann(bar = "9a") @ann(bar = "9b"));
- r.$plus(s)
- }
- };
- ()
-}
-{
- @ann(bar = "1a") @ann(bar = "1b") class C[@ann(bar = "2a") @ann(bar = "2b") T] extends AnyRef {
- @ann(bar = "3a") @ann(bar = "3b") <paramaccessor> private[this] val x: T @ann(bar = "4b") @ann(bar = "4a") = _;
- def <init>(@ann(bar = "3a") @ann(bar = "3b") x: T @ann(bar = "4b") @ann(bar = "4a")): C[T] = {
- C.super.<init>();
- ()
- };
- @ann(bar = "5a") @ann(bar = "5b") def f(x: Int @ann(bar = "6b") @ann(bar = "6a")): Int = {
- @ann(bar = "7a") @ann(bar = "7b") val r: Int @ann(bar = "8b") @ann(bar = "8a") = ((x.+(3): Int @ann(bar = "8a")): Int @ann(bar = "8b") @ann(bar = "8a"));
- val s: Int @ann(bar = "9b") @ann(bar = "9a") = (4: Int @ann(bar = "9b") @ann(bar = "9a"));
- r.+(s)
- }
- };
- ()
-}
+{ + @new ann(bar = "1a") @new ann(bar = "1b") class C[@new ann(bar = "2a") @new ann(bar = "2b") T >: Nothing <: Any] extends AnyRef { + @new ann(bar = "3a") @new ann(bar = "3b") <paramaccessor> private[this] val x: T @ann(bar = "4a") @ann(bar = "4b") = _; + def <init>(@new ann(bar = "3a") @new ann(bar = "3b") x: T @ann(bar = "4a") @ann(bar = "4b")) = { + super.<init>(); + () + }; + @new ann(bar = "5a") @new ann(bar = "5b") def f(x: Int @ann(bar = "6a") @ann(bar = "6b")) = { + @new ann(bar = "7a") @new ann(bar = "7b") val r = x.$plus(3): @ann(bar = "8a"): @ann(bar = "8b"); + val s = (4: Int @ann(bar = "9a") @ann(bar = "9b")); + r.$plus(s) + } + }; + () +} +{ + @ann(bar = "1a") @ann(bar = "1b") class C[@ann(bar = "2a") @ann(bar = "2b") T] extends AnyRef { + @ann(bar = "3a") @ann(bar = "3b") <paramaccessor> private[this] val x: T @ann(bar = "4b") @ann(bar = "4a") = _; + def <init>(@ann(bar = "3a") @ann(bar = "3b") x: T @ann(bar = "4b") @ann(bar = "4a")): C[T] = { + C.super.<init>(); + () + }; + @ann(bar = "5a") @ann(bar = "5b") def f(x: Int @ann(bar = "6b") @ann(bar = "6a")): Int = { + @ann(bar = "7a") @ann(bar = "7b") val r: Int @ann(bar = "8b") @ann(bar = "8a") = ((x.+(3): Int @ann(bar = "8a")): Int @ann(bar = "8b") @ann(bar = "8a")); + val s: Int @ann(bar = "9b") @ann(bar = "9a") = (4: Int @ann(bar = "9b") @ann(bar = "9a")); + r.+(s) + } + }; + () +} diff --git a/test/files/run/reify_ann1b.scala b/test/files/run/reify_ann1b.scala index eb00b4cb10..29ce6021a2 100644 --- a/test/files/run/reify_ann1b.scala +++ b/test/files/run/reify_ann1b.scala @@ -21,9 +21,8 @@ object Test extends App { // test 2: import and typecheck val toolbox = cm.mkToolBox() val ttree = toolbox.typeCheck(tree) - ttree.foreach(sub => if (sub.hasSymbol) sub.symbol.typeSignature) println(ttree.toString) // test 3: import and compile - toolbox.runExpr(tree) + toolbox.eval(tree) }
\ No newline at end of file diff --git a/test/files/run/reify_ann2a.check b/test/files/run/reify_ann2a.check index 4d67bbf786..934af54802 100644 --- a/test/files/run/reify_ann2a.check +++ b/test/files/run/reify_ann2a.check @@ -1,44 +1,44 @@ -{
- class ann extends StaticAnnotation {
- <paramaccessor> private[this] val bar: List[String] = _;
- def <init>(bar: List[String]) = {
- super.<init>();
- ()
- }
- };
- @new ann(immutable.this.List.apply("1a")) @new ann(immutable.this.List.apply("1b")) class C[@new ann(immutable.this.List.apply("2a")) @new ann(immutable.this.List.apply("2b")) T >: Nothing <: Any] extends AnyRef {
- @new ann(immutable.this.List.apply("3a")) @new ann(immutable.this.List.apply("3b")) <paramaccessor> private[this] val x: T @ann(immutable.this.List.apply("4a")) @ann(immutable.this.List.apply("4b")) = _;
- def <init>(@new ann(immutable.this.List.apply("3a")) @new ann(immutable.this.List.apply("3b")) x: T @ann(immutable.this.List.apply("4a")) @ann(immutable.this.List.apply("4b"))) = {
- super.<init>();
- ()
- };
- @new ann(immutable.this.List.apply("5a")) @new ann(immutable.this.List.apply("5b")) def f(x: Int @ann(immutable.this.List.apply("6a")) @ann(immutable.this.List.apply("6b"))) = {
- @new ann(immutable.this.List.apply("7a")) @new ann(immutable.this.List.apply("7b")) val r = x.$plus(3): @ann(immutable.this.List.apply("8a")): @ann(immutable.this.List.apply("8b"));
- val s = (4: Int @ann(immutable.this.List.apply("9a")) @ann(immutable.this.List.apply("9b")));
- r.$plus(s)
- }
- };
- ()
-}
-{
- class ann extends scala.annotation.Annotation with scala.annotation.StaticAnnotation {
- <paramaccessor> private[this] val bar: List[String] = _;
- def <init>(bar: List[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 AnyRef {
- @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] = {
- 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")));
- r.+(s)
- }
- };
- ()
-}
+{ + class ann extends StaticAnnotation { + <paramaccessor> private[this] val bar: List[String] = _; + def <init>(bar: List[String]) = { + super.<init>(); + () + } + }; + @new ann(immutable.this.List.apply("1a")) @new ann(immutable.this.List.apply("1b")) class C[@new ann(immutable.this.List.apply("2a")) @new ann(immutable.this.List.apply("2b")) T >: Nothing <: Any] extends AnyRef { + @new ann(immutable.this.List.apply("3a")) @new ann(immutable.this.List.apply("3b")) <paramaccessor> private[this] val x: T @ann(immutable.this.List.apply("4a")) @ann(immutable.this.List.apply("4b")) = _; + def <init>(@new ann(immutable.this.List.apply("3a")) @new ann(immutable.this.List.apply("3b")) x: T @ann(immutable.this.List.apply("4a")) @ann(immutable.this.List.apply("4b"))) = { + super.<init>(); + () + }; + @new ann(immutable.this.List.apply("5a")) @new ann(immutable.this.List.apply("5b")) def f(x: Int @ann(immutable.this.List.apply("6a")) @ann(immutable.this.List.apply("6b"))) = { + @new ann(immutable.this.List.apply("7a")) @new ann(immutable.this.List.apply("7b")) val r = x.$plus(3): @ann(immutable.this.List.apply("8a")): @ann(immutable.this.List.apply("8b")); + val s = (4: Int @ann(immutable.this.List.apply("9a")) @ann(immutable.this.List.apply("9b"))); + r.$plus(s) + } + }; + () +} +{ + class ann extends scala.annotation.Annotation with scala.annotation.StaticAnnotation { + <paramaccessor> private[this] val bar: List[String] = _; + def <init>(bar: List[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 AnyRef { + @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] = { + 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"))); + r.+(s) + } + }; + () +} diff --git a/test/files/run/reify_ann2a.scala b/test/files/run/reify_ann2a.scala index 9f901d86bd..53423e12c3 100644 --- a/test/files/run/reify_ann2a.scala +++ b/test/files/run/reify_ann2a.scala @@ -21,9 +21,8 @@ object Test extends App { // test 2: import and typecheck val toolbox = cm.mkToolBox() val ttree = toolbox.typeCheck(tree) - ttree.foreach(sub => if (sub.hasSymbol) sub.symbol.typeSignature) println(ttree.toString) // test 3: import and compile - toolbox.runExpr(tree) + toolbox.eval(tree) }
\ No newline at end of file diff --git a/test/files/run/reify_ann3.check b/test/files/run/reify_ann3.check index 96b4cf9c4e..8caceb2696 100644 --- a/test/files/run/reify_ann3.check +++ b/test/files/run/reify_ann3.check @@ -1,21 +1,21 @@ -{
- class Tree[A >: Nothing <: Any, B >: Nothing <: Any] extends AnyRef {
- @new inline @getter() final <paramaccessor> val key: A = _;
- def <init>(key: A) = {
- super.<init>();
- ()
- }
- };
- ()
-}
-{
- class Tree[A, B] extends AnyRef {
- final <paramaccessor> private[this] val key: A = _;
- @inline @scala.annotation.meta.getter final <stable> <accessor> <paramaccessor> def key: A = Tree.this.key;
- def <init>(key: A): Tree[A,B] = {
- Tree.super.<init>();
- ()
- }
- };
- ()
-}
+{ + class Tree[A >: Nothing <: Any, B >: Nothing <: Any] extends AnyRef { + @new inline @getter() final <paramaccessor> val key: A = _; + def <init>(key: A) = { + super.<init>(); + () + } + }; + () +} +{ + class Tree[A, B] extends AnyRef { + final <paramaccessor> private[this] val key: A = _; + @inline @scala.annotation.meta.getter final <stable> <accessor> <paramaccessor> def key: A = Tree.this.key; + def <init>(key: A): Tree[A,B] = { + Tree.super.<init>(); + () + } + }; + () +} diff --git a/test/files/run/reify_ann3.scala b/test/files/run/reify_ann3.scala index cbf1e10063..4162fa532f 100644 --- a/test/files/run/reify_ann3.scala +++ b/test/files/run/reify_ann3.scala @@ -15,9 +15,8 @@ object Test extends App { // test 2: import and typecheck val toolbox = cm.mkToolBox() val ttree = toolbox.typeCheck(tree) - ttree.foreach(sub => if (sub.hasSymbol) sub.symbol.typeSignature) println(ttree.toString) // test 3: import and compile - toolbox.runExpr(tree) + toolbox.eval(tree) }
\ No newline at end of file diff --git a/test/files/run/reify_ann4.check b/test/files/run/reify_ann4.check index 6f853053d2..8bf5fe3242 100644 --- a/test/files/run/reify_ann4.check +++ b/test/files/run/reify_ann4.check @@ -1,32 +1,32 @@ -{
- class D extends StaticAnnotation {
- def <init>() = {
- super.<init>();
- ()
- }
- };
- class C extends AnyRef {
- def <init>() = {
- super.<init>();
- ()
- }
- };
- val c1 = new C @D();
- ()
-}
-{
- class D extends scala.annotation.Annotation with scala.annotation.StaticAnnotation {
- def <init>(): D = {
- D.super.<init>();
- ()
- }
- };
- class C extends AnyRef {
- def <init>(): C = {
- C.super.<init>();
- ()
- }
- };
- val c1: C = new C @D();
- ()
-}
+{ + class D extends StaticAnnotation { + def <init>() = { + super.<init>(); + () + } + }; + class C extends AnyRef { + def <init>() = { + super.<init>(); + () + } + }; + val c1 = new C @D(); + () +} +{ + class D extends scala.annotation.Annotation with scala.annotation.StaticAnnotation { + def <init>(): D = { + D.super.<init>(); + () + } + }; + class C extends AnyRef { + def <init>(): C = { + C.super.<init>(); + () + } + }; + val c1: C = new C @D(); + () +} diff --git a/test/files/run/reify_ann4.scala b/test/files/run/reify_ann4.scala index 58c8c2c521..0aedb77b5e 100644 --- a/test/files/run/reify_ann4.scala +++ b/test/files/run/reify_ann4.scala @@ -19,9 +19,8 @@ object Test extends App { // test 2: import and typecheck val toolbox = cm.mkToolBox() val ttree = toolbox.typeCheck(tree) - ttree.foreach(sub => if (sub.hasSymbol) sub.symbol.typeSignature) println(ttree.toString) // test 3: import and compile - toolbox.runExpr(tree) + toolbox.eval(tree) }
\ No newline at end of file diff --git a/test/files/run/reify_ann5.check b/test/files/run/reify_ann5.check index d443c601a0..1ec0457e54 100644 --- a/test/files/run/reify_ann5.check +++ b/test/files/run/reify_ann5.check @@ -1,22 +1,22 @@ -{
- class C extends AnyRef {
- @new inline @beanGetter() @new BeanProperty() <paramaccessor> val x: Int = _;
- def <init>(x: Int) = {
- super.<init>();
- ()
- }
- };
- ()
-}
-{
- class C extends AnyRef {
- @scala.beans.BeanProperty <paramaccessor> private[this] val x: Int = _;
- <stable> <accessor> <paramaccessor> def x: Int = C.this.x;
- def <init>(x: Int): C = {
- C.super.<init>();
- ()
- };
- @inline @scala.annotation.meta.beanGetter def getX(): Int = C.this.x
- };
- ()
-}
+{ + class C extends AnyRef { + @new inline @beanGetter() @new BeanProperty() <paramaccessor> val x: Int = _; + def <init>(x: Int) = { + super.<init>(); + () + } + }; + () +} +{ + class C extends AnyRef { + @scala.beans.BeanProperty <paramaccessor> private[this] val x: Int = _; + <stable> <accessor> <paramaccessor> def x: Int = C.this.x; + def <init>(x: Int): C = { + C.super.<init>(); + () + }; + @inline @scala.annotation.meta.beanGetter def getX(): Int = C.this.x + }; + () +} diff --git a/test/files/run/reify_ann5.scala b/test/files/run/reify_ann5.scala index 801db07960..d27be3b6d5 100644 --- a/test/files/run/reify_ann5.scala +++ b/test/files/run/reify_ann5.scala @@ -16,9 +16,8 @@ object Test extends App { // test 2: import and typecheck val toolbox = cm.mkToolBox() val ttree = toolbox.typeCheck(tree) - ttree.foreach(sub => if (sub.hasSymbol) sub.symbol.typeSignature) println(ttree.toString) // test 3: import and compile - toolbox.runExpr(tree) + toolbox.eval(tree) }
\ No newline at end of file diff --git a/test/files/run/reify_classfileann_a.check b/test/files/run/reify_classfileann_a.check index 6f17b26158..0c919020a8 100644 --- a/test/files/run/reify_classfileann_a.check +++ b/test/files/run/reify_classfileann_a.check @@ -1,18 +1,18 @@ -{
- @new ann(bar = "1", quux = Array("2", "3"), baz = new ann(bar = "4")) class C extends AnyRef {
- def <init>() = {
- super.<init>();
- ()
- }
- };
- ()
-}
-{
- @ann(bar = "1", quux = ["2", "3"], baz = ann(bar = "4")) class C extends AnyRef {
- def <init>(): C = {
- C.super.<init>();
- ()
- }
- };
- ()
-}
+{ + @new ann(bar = "1", quux = Array("2", "3"), baz = new ann(bar = "4")) class C extends AnyRef { + def <init>() = { + super.<init>(); + () + } + }; + () +} +{ + @ann(bar = "1", quux = ["2", "3"], baz = ann(bar = "4")) class C extends AnyRef { + def <init>(): C = { + C.super.<init>(); + () + } + }; + () +} diff --git a/test/files/run/reify_classfileann_a.scala b/test/files/run/reify_classfileann_a.scala index 0abb7b8154..1d51688e78 100644 --- a/test/files/run/reify_classfileann_a.scala +++ b/test/files/run/reify_classfileann_a.scala @@ -18,5 +18,5 @@ object Test extends App { println(ttree.toString) // test 3: import and compile - toolbox.runExpr(tree) + toolbox.eval(tree) }
\ No newline at end of file diff --git a/test/files/run/reify_classfileann_b.check b/test/files/run/reify_classfileann_b.check index 33270e0035..c204fa8dc0 100644 --- a/test/files/run/reify_classfileann_b.check +++ b/test/files/run/reify_classfileann_b.check @@ -1,20 +1,20 @@ -{
- class C extends AnyRef {
- def <init>() = {
- super.<init>();
- ()
- };
- def x: Int = 2: @ann(bar = "1",quux = Array("2", "3"),baz = new ann(bar = "4"))
- };
- ()
-}
-{
- class C extends AnyRef {
- def <init>(): C = {
- C.super.<init>();
- ()
- };
- def x: Int = (2: Int(2) @ann(bar = "1", quux = ["2", "3"], baz = ann(bar = "4")))
- };
- ()
-}
+{ + class C extends AnyRef { + def <init>() = { + super.<init>(); + () + }; + def x: Int = 2: @ann(bar = "1",quux = Array("2", "3"),baz = new ann(bar = "4")) + }; + () +} +{ + class C extends AnyRef { + def <init>(): C = { + C.super.<init>(); + () + }; + def x: Int = (2: Int(2) @ann(bar = "1", quux = ["2", "3"], baz = ann(bar = "4"))) + }; + () +} diff --git a/test/files/run/reify_classfileann_b.scala b/test/files/run/reify_classfileann_b.scala index 5ceb652a8b..ef19e9240b 100644 --- a/test/files/run/reify_classfileann_b.scala +++ b/test/files/run/reify_classfileann_b.scala @@ -22,5 +22,5 @@ object Test extends App { println(ttree.toString) // test 3: import and compile - toolbox.runExpr(tree) + toolbox.eval(tree) }
\ No newline at end of file diff --git a/test/files/run/reify_closure1.scala b/test/files/run/reify_closure1.scala index ce68975acc..af24a4b1e4 100644 --- a/test/files/run/reify_closure1.scala +++ b/test/files/run/reify_closure1.scala @@ -10,7 +10,7 @@ object Test extends App { }} val toolbox = cm.mkToolBox() - val dyn = toolbox.runExpr(fun.tree) + val dyn = toolbox.eval(fun.tree) dyn.asInstanceOf[Int => Int] } diff --git a/test/files/run/reify_closure2a.scala b/test/files/run/reify_closure2a.scala index cb53e7ffa8..7a2cdb5e17 100644 --- a/test/files/run/reify_closure2a.scala +++ b/test/files/run/reify_closure2a.scala @@ -10,7 +10,7 @@ object Test extends App { }} val toolbox = cm.mkToolBox() - val dyn = toolbox.runExpr(fun.tree) + val dyn = toolbox.eval(fun.tree) dyn.asInstanceOf[Int => Int] } diff --git a/test/files/run/reify_closure3a.scala b/test/files/run/reify_closure3a.scala index cf8c161afa..cb17c89501 100644 --- a/test/files/run/reify_closure3a.scala +++ b/test/files/run/reify_closure3a.scala @@ -12,7 +12,7 @@ object Test extends App { }} val toolbox = cm.mkToolBox() - val dyn = toolbox.runExpr(fun.tree) + val dyn = toolbox.eval(fun.tree) dyn.asInstanceOf[Int => Int] } diff --git a/test/files/run/reify_closure4a.scala b/test/files/run/reify_closure4a.scala index 1521295f16..23436e0763 100644 --- a/test/files/run/reify_closure4a.scala +++ b/test/files/run/reify_closure4a.scala @@ -12,7 +12,7 @@ object Test extends App { }} val toolbox = cm.mkToolBox() - val dyn = toolbox.runExpr(fun.tree) + val dyn = toolbox.eval(fun.tree) dyn.asInstanceOf[Int => Int] } diff --git a/test/files/run/reify_closure5a.scala b/test/files/run/reify_closure5a.scala index 84c2c08727..6b5089a4e5 100644 --- a/test/files/run/reify_closure5a.scala +++ b/test/files/run/reify_closure5a.scala @@ -10,7 +10,7 @@ object Test extends App { }} val toolbox = cm.mkToolBox() - val dyn = toolbox.runExpr(fun.tree) + val dyn = toolbox.eval(fun.tree) dyn.asInstanceOf[Int => Int] } diff --git a/test/files/run/reify_closure6.scala b/test/files/run/reify_closure6.scala index d007e80899..cba035132d 100644 --- a/test/files/run/reify_closure6.scala +++ b/test/files/run/reify_closure6.scala @@ -17,7 +17,7 @@ object Test extends App { }} val toolbox = cm.mkToolBox() - val dyn = toolbox.runExpr(fun.tree) + val dyn = toolbox.eval(fun.tree) dyn.asInstanceOf[Int => Int] } diff --git a/test/files/run/reify_closure7.scala b/test/files/run/reify_closure7.scala index 3d4956a724..2a7ce25e88 100644 --- a/test/files/run/reify_closure7.scala +++ b/test/files/run/reify_closure7.scala @@ -19,7 +19,7 @@ object Test extends App { if (clo == null) { val toolbox = cm.mkToolBox() - val dyn = toolbox.runExpr(fun.tree) + val dyn = toolbox.eval(fun.tree) clo = dyn.asInstanceOf[Int => Int] } diff --git a/test/files/run/reify_closure8a.scala b/test/files/run/reify_closure8a.scala index 8db3d38241..f303a7511c 100644 --- a/test/files/run/reify_closure8a.scala +++ b/test/files/run/reify_closure8a.scala @@ -9,7 +9,7 @@ object Test extends App { } val toolbox = cm.mkToolBox() - val dyn = toolbox.runExpr(new Foo(10).fun.tree) + val dyn = toolbox.eval(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 585e6d5740..5a7863ff15 100644 --- a/test/files/run/reify_closure8b.check +++ b/test/files/run/reify_closure8b.check @@ -1,3 +1,3 @@ -scala.tools.reflect.ToolBoxError: reflective compilation has failed:
-
-value y is not a member of Test.Foo
+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 9cdc0e997f..c693cb490e 100644 --- a/test/files/run/reify_closure8b.scala +++ b/test/files/run/reify_closure8b.scala @@ -11,7 +11,7 @@ object Test extends App { } try { - val dyn = cm.mkToolBox().runExpr(new Foo(10).fun.tree) + val dyn = cm.mkToolBox().eval(new Foo(10).fun.tree) val foo = dyn.asInstanceOf[Int] println(foo) } catch { diff --git a/test/files/run/reify_closures10.scala b/test/files/run/reify_closures10.scala index 2d9b833851..a2740c8362 100644 --- a/test/files/run/reify_closures10.scala +++ b/test/files/run/reify_closures10.scala @@ -9,5 +9,5 @@ object Test extends App { val code = reify{println(x + y); x + y} val toolbox = cm.mkToolBox() - println(toolbox.runExpr(code.tree)) + println(toolbox.eval(code.tree)) }
\ No newline at end of file diff --git a/test/files/run/reify_copypaste1.check b/test/files/run/reify_copypaste1.check index 49a25ea881..b204f9c454 100644 --- a/test/files/run/reify_copypaste1.check +++ b/test/files/run/reify_copypaste1.check @@ -1,2 +1,2 @@ -List(1, 2)
-
+List(1, 2) + diff --git a/test/files/run/reify_copypaste1.scala b/test/files/run/reify_copypaste1.scala index 7eaa4fa7b5..c597b7af19 100644 --- a/test/files/run/reify_copypaste1.scala +++ b/test/files/run/reify_copypaste1.scala @@ -11,9 +11,9 @@ object Test extends App { 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()) + toolBox.eval(Apply(reify, List(reifee))) + val Block(List(tpeCopypaste), exprCopypaste @ ModuleDef(_, _, Template(_, _, (_ :: stats) :+ expr))) = toolBox.parse(output.toString()) output.reset() - toolBox.runExpr(Block(stats, expr)) + toolBox.eval(Block(stats, expr)) stdout.println(output.toString) }
\ No newline at end of file diff --git a/test/files/run/reify_getter.scala b/test/files/run/reify_getter.scala index 26767603a0..cb04ddffde 100644 --- a/test/files/run/reify_getter.scala +++ b/test/files/run/reify_getter.scala @@ -13,6 +13,6 @@ object Test extends App { } val toolbox = cm.mkToolBox() - val evaluated = toolbox.runExpr(code.tree) + val evaluated = toolbox.eval(code.tree) println("evaluated = " + evaluated) }
\ 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 8ea92c511b..76f935ecd2 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 @@ -13,6 +13,6 @@ object Test extends App { }; val toolbox = cm.mkToolBox() - val evaluated = toolbox.runExpr(code.tree) + val evaluated = toolbox.eval(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 7ff4f84de0..e7c5cb71c1 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 @@ -11,6 +11,6 @@ object Test extends App { val code = reify{outer.eval.eval} val toolbox = cm.mkToolBox() - val evaluated = toolbox.runExpr(code.tree) + val evaluated = toolbox.eval(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 7f1f9d8478..770fcccd15 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 @@ -16,6 +16,6 @@ object Test extends App { } val toolbox = cm.mkToolBox() - val evaluated = toolbox.runExpr(code.tree) + val evaluated = toolbox.eval(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 65e0931b6e..32e7e9003b 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 @@ -13,6 +13,6 @@ object Test extends App { }; val toolbox = cm.mkToolBox() - val evaluated = toolbox.runExpr(code.tree) + val evaluated = toolbox.eval(code.tree) println("evaluated = " + evaluated) }
\ No newline at end of file diff --git a/test/files/run/reify_nested_inner_refers_to_global.check b/test/files/run/reify_nested_inner_refers_to_global.check index 7ff4c83d37..5ef4ff4d04 100644 --- a/test/files/run/reify_nested_inner_refers_to_global.check +++ b/test/files/run/reify_nested_inner_refers_to_global.check @@ -1 +1 @@ -evaluated = 2
+evaluated = 2 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 f45c1daed9..877222f5bf 100644 --- a/test/files/run/reify_nested_inner_refers_to_global.scala +++ b/test/files/run/reify_nested_inner_refers_to_global.scala @@ -12,6 +12,6 @@ object Test extends App { } val toolbox = cm.mkToolBox() - val evaluated = toolbox.runExpr(code.tree) + val evaluated = toolbox.eval(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 4a3d8bb02b..703474e07e 100644 --- a/test/files/run/reify_nested_inner_refers_to_local.scala +++ b/test/files/run/reify_nested_inner_refers_to_local.scala @@ -12,6 +12,6 @@ object Test extends App { }; val toolbox = cm.mkToolBox() - val evaluated = toolbox.runExpr(code.tree) + val evaluated = toolbox.eval(code.tree) println("evaluated = " + evaluated) }
\ No newline at end of file diff --git a/test/files/run/reify_nested_outer_refers_to_global.check b/test/files/run/reify_nested_outer_refers_to_global.check index 7ff4c83d37..5ef4ff4d04 100644 --- a/test/files/run/reify_nested_outer_refers_to_global.check +++ b/test/files/run/reify_nested_outer_refers_to_global.check @@ -1 +1 @@ -evaluated = 2
+evaluated = 2 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 b628975e59..e40c569ce6 100644 --- a/test/files/run/reify_nested_outer_refers_to_global.scala +++ b/test/files/run/reify_nested_outer_refers_to_global.scala @@ -14,6 +14,6 @@ object Test extends App { } val toolbox = cm.mkToolBox() - val evaluated = toolbox.runExpr(code.tree) + val evaluated = toolbox.eval(code.tree) println("evaluated = " + evaluated) }
\ No newline at end of file diff --git a/test/files/run/reify_nested_outer_refers_to_local.check b/test/files/run/reify_nested_outer_refers_to_local.check index 7ff4c83d37..5ef4ff4d04 100644 --- a/test/files/run/reify_nested_outer_refers_to_local.check +++ b/test/files/run/reify_nested_outer_refers_to_local.check @@ -1 +1 @@ -evaluated = 2
+evaluated = 2 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 80564fa9a2..12147c51da 100644 --- a/test/files/run/reify_nested_outer_refers_to_local.scala +++ b/test/files/run/reify_nested_outer_refers_to_local.scala @@ -14,6 +14,6 @@ object Test extends App { }; val toolbox = cm.mkToolBox() - val evaluated = toolbox.runExpr(code.tree) + val evaluated = toolbox.eval(code.tree) println("evaluated = " + evaluated) }
\ No newline at end of file diff --git a/test/files/run/reify_newimpl_11.check b/test/files/run/reify_newimpl_11.check index 21bd28667e..2f5cb581e6 100644 --- a/test/files/run/reify_newimpl_11.check +++ b/test/files/run/reify_newimpl_11.check @@ -1,2 +1,2 @@ -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
+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_13.check b/test/files/run/reify_newimpl_13.check index e28732bd6a..d518cd7b84 100644 --- a/test/files/run/reify_newimpl_13.check +++ b/test/files/run/reify_newimpl_13.check @@ -1,2 +1,2 @@ -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
+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_18.check b/test/files/run/reify_newimpl_18.check index a7029974a4..c23af69b08 100644 --- a/test/files/run/reify_newimpl_18.check +++ b/test/files/run/reify_newimpl_18.check @@ -1 +1 @@ -List(2)
+List(2) diff --git a/test/files/run/reify_newimpl_19.check b/test/files/run/reify_newimpl_19.check index 1d96992869..8b8652f92c 100644 --- a/test/files/run/reify_newimpl_19.check +++ b/test/files/run/reify_newimpl_19.check @@ -1,2 +1,2 @@ -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
+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_20.check b/test/files/run/reify_newimpl_20.check index a7029974a4..c23af69b08 100644 --- a/test/files/run/reify_newimpl_20.check +++ b/test/files/run/reify_newimpl_20.check @@ -1 +1 @@ -List(2)
+List(2) diff --git a/test/files/run/reify_newimpl_21.check b/test/files/run/reify_newimpl_21.check index a7029974a4..c23af69b08 100644 --- a/test/files/run/reify_newimpl_21.check +++ b/test/files/run/reify_newimpl_21.check @@ -1 +1 @@ -List(2)
+List(2) diff --git a/test/files/run/reify_newimpl_22.check b/test/files/run/reify_newimpl_22.check index ebcf42f52f..dcb3e2889b 100644 --- a/test/files/run/reify_newimpl_22.check +++ b/test/files/run/reify_newimpl_22.check @@ -1,29 +1,29 @@ -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> 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
- val code = reify {
- x
- }
- println(code.eval)
-}
-<console>:15: free term: Ident(newTermName("x")) defined by res0 in <console>:14:21
- val code = reify {
- ^
-2
-
-scala>
-
-scala>
+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> 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 + val code = reify { + x + } + println(code.eval) +} +<console>:15: free term: Ident(newTermName("x")) defined by res0 in <console>:14:21 + val code = reify { + ^ +2 + +scala> + +scala> diff --git a/test/files/run/reify_newimpl_23.check b/test/files/run/reify_newimpl_23.check index c8ed424c86..882124657e 100644 --- a/test/files/run/reify_newimpl_23.check +++ b/test/files/run/reify_newimpl_23.check @@ -1,28 +1,28 @@ -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> 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 {
- List[T]()
- }
- println(code.eval)
-}
-<console>:13: free type: Ident(newTypeName("T")) defined by foo in <console>:12:16
- val code = reify {
- ^
-foo: [T]=> Unit
-
-scala>
-
-scala>
+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> 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 { + List[T]() + } + println(code.eval) +} +<console>:13: free type: Ident(newTypeName("T")) defined by foo in <console>:12:16 + val code = reify { + ^ +foo: [T]=> Unit + +scala> + +scala> diff --git a/test/files/run/reify_newimpl_25.check b/test/files/run/reify_newimpl_25.check index a688a98fbc..d1028b94c7 100644 --- a/test/files/run/reify_newimpl_25.check +++ b/test/files/run/reify_newimpl_25.check @@ -1,19 +1,19 @@ -Type in expressions to have them evaluated.
-Type :help for more information.
-
-scala>
-
-scala> {
- import scala.reflect.runtime.universe._
- val x = "2"
- val tt = implicitly[TypeTag[x.type]]
- println(tt)
-}
-<console>:11: free term: Ident(newTermName("x")) defined by res0 in <console>:10:21
- val tt = implicitly[TypeTag[x.type]]
- ^
-TypeTag[x.type]
-
-scala>
-
-scala>
+Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> { + import scala.reflect.runtime.universe._ + val x = "2" + val tt = implicitly[TypeTag[x.type]] + println(tt) +} +<console>:11: free term: Ident(newTermName("x")) defined by res0 in <console>:10:21 + val tt = implicitly[TypeTag[x.type]] + ^ +TypeTag[x.type] + +scala> + +scala> diff --git a/test/files/run/reify_newimpl_26.check b/test/files/run/reify_newimpl_26.check index 5996f3b322..347f6365aa 100644 --- a/test/files/run/reify_newimpl_26.check +++ b/test/files/run/reify_newimpl_26.check @@ -1,21 +1,21 @@ -Type in expressions to have them evaluated.
-Type :help for more information.
-
-scala>
-
-scala> def foo[T]{
- import scala.reflect.runtime.universe._
- val tt = implicitly[WeakTypeTag[List[T]]]
- println(tt)
-}
-<console>:9: free type: Ident(newTypeName("T")) defined by foo in <console>:7:16
- val tt = implicitly[WeakTypeTag[List[T]]]
- ^
-foo: [T]=> Unit
-
-scala> foo[Int]
-WeakTypeTag[scala.List[T]]
-
-scala>
-
-scala>
+Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> def foo[T]{ + import scala.reflect.runtime.universe._ + val tt = implicitly[WeakTypeTag[List[T]]] + println(tt) +} +<console>:9: free type: Ident(newTypeName("T")) defined by foo in <console>:7:16 + val tt = implicitly[WeakTypeTag[List[T]]] + ^ +foo: [T]=> Unit + +scala> foo[Int] +WeakTypeTag[scala.List[T]] + +scala> + +scala> diff --git a/test/files/run/reify_newimpl_27.check b/test/files/run/reify_newimpl_27.check index a7029974a4..c23af69b08 100644 --- a/test/files/run/reify_newimpl_27.check +++ b/test/files/run/reify_newimpl_27.check @@ -1 +1 @@ -List(2)
+List(2) diff --git a/test/files/run/reify_newimpl_29.check b/test/files/run/reify_newimpl_29.check index a7029974a4..c23af69b08 100644 --- a/test/files/run/reify_newimpl_29.check +++ b/test/files/run/reify_newimpl_29.check @@ -1 +1 @@ -List(2)
+List(2) diff --git a/test/files/run/reify_newimpl_30.check b/test/files/run/reify_newimpl_30.check index a7029974a4..c23af69b08 100644 --- a/test/files/run/reify_newimpl_30.check +++ b/test/files/run/reify_newimpl_30.check @@ -1 +1 @@ -List(2)
+List(2) diff --git a/test/files/run/reify_newimpl_31.check b/test/files/run/reify_newimpl_31.check index a7029974a4..c23af69b08 100644 --- a/test/files/run/reify_newimpl_31.check +++ b/test/files/run/reify_newimpl_31.check @@ -1 +1 @@ -List(2)
+List(2) diff --git a/test/files/run/reify_newimpl_33.check b/test/files/run/reify_newimpl_33.check index a7029974a4..c23af69b08 100644 --- a/test/files/run/reify_newimpl_33.check +++ b/test/files/run/reify_newimpl_33.check @@ -1 +1 @@ -List(2)
+List(2) diff --git a/test/files/run/reify_newimpl_35.check b/test/files/run/reify_newimpl_35.check index f8306003b5..5545e6e005 100644 --- a/test/files/run/reify_newimpl_35.check +++ b/test/files/run/reify_newimpl_35.check @@ -1,17 +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>
+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_36.check b/test/files/run/reify_newimpl_36.check index 2f562a182f..d81cc0710e 100644 --- a/test/files/run/reify_newimpl_36.check +++ b/test/files/run/reify_newimpl_36.check @@ -1 +1 @@ -42
+42 diff --git a/test/files/run/reify_newimpl_37.check b/test/files/run/reify_newimpl_37.check index 2f562a182f..d81cc0710e 100644 --- a/test/files/run/reify_newimpl_37.check +++ b/test/files/run/reify_newimpl_37.check @@ -1 +1 @@ -42
+42 diff --git a/test/files/run/reify_newimpl_38.check b/test/files/run/reify_newimpl_38.check index 2f562a182f..d81cc0710e 100644 --- a/test/files/run/reify_newimpl_38.check +++ b/test/files/run/reify_newimpl_38.check @@ -1 +1 @@ -42
+42 diff --git a/test/files/run/reify_newimpl_39.check b/test/files/run/reify_newimpl_39.check index 2f562a182f..d81cc0710e 100644 --- a/test/files/run/reify_newimpl_39.check +++ b/test/files/run/reify_newimpl_39.check @@ -1 +1 @@ -42
+42 diff --git a/test/files/run/reify_newimpl_40.check b/test/files/run/reify_newimpl_40.check index 94c5a65fe0..cc0001ab3b 100644 --- a/test/files/run/reify_newimpl_40.check +++ b/test/files/run/reify_newimpl_40.check @@ -1 +1 @@ -74088
+74088 diff --git a/test/files/run/reify_newimpl_45.scala b/test/files/run/reify_newimpl_45.scala index cbae0839b2..2a6c68d441 100644 --- a/test/files/run/reify_newimpl_45.scala +++ b/test/files/run/reify_newimpl_45.scala @@ -9,7 +9,7 @@ object Test extends App { println(code.tree.freeTypes) val T = code.tree.freeTypes(0) val tree = code.tree.substituteSymbols(List(T), List(definitions.StringClass)) - cm.mkToolBox().runExpr(tree) + cm.mkToolBox().eval(tree) } new C[String] diff --git a/test/files/run/reify_printf.scala b/test/files/run/reify_printf.scala index 07e99781e3..272856b962 100644 --- a/test/files/run/reify_printf.scala +++ b/test/files/run/reify_printf.scala @@ -14,7 +14,7 @@ object Test extends App { val toolbox = cm.mkToolBox() val tree = tree_printf(reify("hello %s").tree, reify("world").tree) - val evaluated = toolbox.runExpr(tree) + val evaluated = toolbox.eval(tree) assert(output.toString() == "hello world", output.toString() +" == hello world") /* diff --git a/test/files/run/reify_typerefs_1a.scala b/test/files/run/reify_typerefs_1a.scala index 53033e210c..2e961f171d 100644 --- a/test/files/run/reify_typerefs_1a.scala +++ b/test/files/run/reify_typerefs_1a.scala @@ -13,6 +13,6 @@ object Test extends App { }; val toolbox = cm.mkToolBox() - val evaluated = toolbox.runExpr(code.tree) + val evaluated = toolbox.eval(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 12604454ed..88bb864820 100644 --- a/test/files/run/reify_typerefs_1b.scala +++ b/test/files/run/reify_typerefs_1b.scala @@ -13,6 +13,6 @@ object Test extends App { }; val toolbox = cm.mkToolBox() - val evaluated = toolbox.runExpr(code.tree) + val evaluated = toolbox.eval(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 ffc3dfc942..3a1db1d80f 100644 --- a/test/files/run/reify_typerefs_2a.scala +++ b/test/files/run/reify_typerefs_2a.scala @@ -15,6 +15,6 @@ object Test extends App { }; val toolbox = cm.mkToolBox() - val evaluated = toolbox.runExpr(code.tree) + val evaluated = toolbox.eval(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 f5d1633d79..50082aa8d2 100644 --- a/test/files/run/reify_typerefs_2b.scala +++ b/test/files/run/reify_typerefs_2b.scala @@ -15,6 +15,6 @@ object Test extends App { }; val toolbox = cm.mkToolBox() - val evaluated = toolbox.runExpr(code.tree) + val evaluated = toolbox.eval(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 67b2c2d8aa..682d6f01ac 100644 --- a/test/files/run/reify_typerefs_3a.scala +++ b/test/files/run/reify_typerefs_3a.scala @@ -15,6 +15,6 @@ object Test extends App { }; val toolbox = cm.mkToolBox() - val evaluated = toolbox.runExpr(code.tree) + val evaluated = toolbox.eval(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 41a0a667e2..c85072f55f 100644 --- a/test/files/run/reify_typerefs_3b.scala +++ b/test/files/run/reify_typerefs_3b.scala @@ -15,6 +15,6 @@ object Test extends App { }; val toolbox = cm.mkToolBox() - val evaluated = toolbox.runExpr(code.tree) + val evaluated = toolbox.eval(code.tree) println("evaluated = " + evaluated) }
\ No newline at end of file diff --git a/test/files/run/repl-power.check b/test/files/run/repl-power.check index c509434116..9d63ecde94 100644 --- a/test/files/run/repl-power.check +++ b/test/files/run/repl-power.check @@ -1,32 +1,32 @@ -Type in expressions to have them evaluated.
-Type :help for more information.
-
-scala> :power
-** Power User mode enabled - BEEP WHIR GYVE **
-** :phase has been set to 'typer'. **
-** scala.tools.nsc._ has been imported **
-** global._, definitions._ also imported **
-** Try :help, :vals, power.<tab> **
-
-scala> // guarding against "error: reference to global is ambiguous"
-
-scala> global.emptyValDef // "it is imported twice in the same scope by ..."
-res0: $r.global.emptyValDef.type = private val _ = _
-
-scala> val tp = ArrayClass[scala.util.Random] // magic with tags
-tp: $r.global.Type = Array[scala.util.Random]
-
-scala> tp.memberType(Array_apply) // evidence
-res1: $r.global.Type = (i: Int)scala.util.Random
-
-scala> val m = LIT(10) MATCH (CASE(LIT(5)) ==> FALSE, DEFAULT ==> TRUE) // treedsl
-m: $r.treedsl.global.Match =
-10 match {
- case 5 => false
- case _ => true
-}
-
-scala> typed(m).tpe // typed is in scope
-res2: $r.treedsl.global.Type = Boolean
-
-scala>
+Type in expressions to have them evaluated. +Type :help for more information. + +scala> :power +** Power User mode enabled - BEEP WHIR GYVE ** +** :phase has been set to 'typer'. ** +** scala.tools.nsc._ has been imported ** +** global._, definitions._ also imported ** +** Try :help, :vals, power.<tab> ** + +scala> // guarding against "error: reference to global is ambiguous" + +scala> global.emptyValDef // "it is imported twice in the same scope by ..." +res0: $r.global.emptyValDef.type = private val _ = _ + +scala> val tp = ArrayClass[scala.util.Random] // magic with tags +tp: $r.global.Type = Array[scala.util.Random] + +scala> tp.memberType(Array_apply) // evidence +res1: $r.global.Type = (i: Int)scala.util.Random + +scala> val m = LIT(10) MATCH (CASE(LIT(5)) ==> FALSE, DEFAULT ==> TRUE) // treedsl +m: $r.treedsl.global.Match = +10 match { + case 5 => false + case _ => true +} + +scala> typed(m).tpe // typed is in scope +res2: $r.treedsl.global.Type = Boolean + +scala> diff --git a/test/files/run/runtimeEval2.check b/test/files/run/runtimeEval2.check index 78c6baefdd..0cfbf08886 100644 --- a/test/files/run/runtimeEval2.check +++ b/test/files/run/runtimeEval2.check @@ -1 +1 @@ -2
+2 diff --git a/test/files/run/shortClass.check b/test/files/run/shortClass.check new file mode 100644 index 0000000000..fbdb725cca --- /dev/null +++ b/test/files/run/shortClass.check @@ -0,0 +1,10 @@ +bippity.bop.Foo +bippity.bop.Foo$Bar +bippity.bop.Foo$Bar$ +Test$$anon$1 +Test$$anon$2 +Foo +Bar +Bar$ +Foo with DingDongBippy +Bar with DingDongBippy diff --git a/test/files/run/shortClass.scala b/test/files/run/shortClass.scala new file mode 100644 index 0000000000..b7bb016896 --- /dev/null +++ b/test/files/run/shortClass.scala @@ -0,0 +1,24 @@ +import scala.reflect.internal.util._ + +package bippity { + trait DingDongBippy + + package bop { + class Foo { + class Bar + object Bar + } + } +} + +object Test { + import bippity._ + import bop._ + + def main(args: Array[String]): Unit = { + val f = new Foo + val instances = List(f, new f.Bar, f.Bar, new Foo with DingDongBippy, new f.Bar with DingDongBippy) + instances map (_.getClass.getName) foreach println + instances map shortClassOfInstance foreach println + } +} diff --git a/test/files/run/showraw_mods.check b/test/files/run/showraw_mods.check index 6fc3ffe051..7fca027614 100644 --- a/test/files/run/showraw_mods.check +++ b/test/files/run/showraw_mods.check @@ -1 +1 @@ -Block(List(ClassDef(Modifiers(ABSTRACT | DEFAULTPARAM/TRAIT), newTypeName("C"), List(), Template(List(Ident(newTypeName("AnyRef"))), emptyValDef, List(DefDef(Modifiers(), newTermName("$init$"), List(), List(List()), TypeTree(), Block(List(), Literal(Constant(())))), ValDef(Modifiers(PRIVATE | LOCAL), newTermName("x"), TypeTree(), Literal(Constant(2))), ValDef(Modifiers(MUTABLE), newTermName("y"), TypeTree(), Select(This(newTypeName("C")), newTermName("x"))), ValDef(Modifiers(LAZY), newTermName("z"), TypeTree(), Select(This(newTypeName("C")), newTermName("y"))))))), Literal(Constant(())))
+Block(List(ClassDef(Modifiers(ABSTRACT | DEFAULTPARAM/TRAIT), newTypeName("C"), List(), Template(List(Ident(newTypeName("AnyRef"))), emptyValDef, List(DefDef(Modifiers(), newTermName("$init$"), List(), List(List()), TypeTree(), Block(List(), Literal(Constant(())))), ValDef(Modifiers(PRIVATE | LOCAL), newTermName("x"), TypeTree(), Literal(Constant(2))), ValDef(Modifiers(MUTABLE), newTermName("y"), TypeTree(), Select(This(newTypeName("C")), newTermName("x"))), ValDef(Modifiers(LAZY), newTermName("z"), TypeTree(), Select(This(newTypeName("C")), newTermName("y"))))))), Literal(Constant(()))) diff --git a/test/files/run/showraw_nosymbol.check b/test/files/run/showraw_nosymbol.check new file mode 100644 index 0000000000..c54fe74717 --- /dev/null +++ b/test/files/run/showraw_nosymbol.check @@ -0,0 +1 @@ +NoSymbol diff --git a/test/files/run/showraw_nosymbol.scala b/test/files/run/showraw_nosymbol.scala new file mode 100644 index 0000000000..fbdc1591c9 --- /dev/null +++ b/test/files/run/showraw_nosymbol.scala @@ -0,0 +1,5 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + println(showRaw(NoSymbol)) +}
\ No newline at end of file diff --git a/test/files/run/showraw_tree.check b/test/files/run/showraw_tree.check index d3a1fddf48..dca272684e 100644 --- a/test/files/run/showraw_tree.check +++ b/test/files/run/showraw_tree.check @@ -1,2 +1,2 @@ -Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap), List(Ident(newTypeName("String")), Ident(newTypeName("String"))))), nme.CONSTRUCTOR), List())
-Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap), List(Ident(newTypeName("String")), Ident(newTypeName("String"))))), nme.CONSTRUCTOR), List())
+Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap), List(Ident(newTypeName("String")), Ident(newTypeName("String"))))), nme.CONSTRUCTOR), List()) +Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap), List(Ident(newTypeName("String")), Ident(newTypeName("String"))))), nme.CONSTRUCTOR), List()) diff --git a/test/files/run/showraw_tree_ids.check b/test/files/run/showraw_tree_ids.check index 0c189130cf..d25599c7fc 100644 --- a/test/files/run/showraw_tree_ids.check +++ b/test/files/run/showraw_tree_ids.check @@ -1,2 +1,2 @@ -Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap#<id>), List(Ident(newTypeName("String")#<id>), Ident(newTypeName("String")#<id>)))), nme.CONSTRUCTOR), List())
-Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap#<id>), List(Ident(newTypeName("String")#<id>), Ident(newTypeName("String")#<id>)))), nme.CONSTRUCTOR), List())
+Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap#<id>), List(Ident(newTypeName("String")#<id>), Ident(newTypeName("String")#<id>)))), nme.CONSTRUCTOR), List()) +Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap#<id>), List(Ident(newTypeName("String")#<id>), Ident(newTypeName("String")#<id>)))), nme.CONSTRUCTOR), List()) diff --git a/test/files/run/showraw_tree_kinds.check b/test/files/run/showraw_tree_kinds.check index 7b4ab456b0..d0d4cd0058 100644 --- a/test/files/run/showraw_tree_kinds.check +++ b/test/files/run/showraw_tree_kinds.check @@ -1,2 +1,2 @@ -Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap#CLS), List(Ident(newTypeName("String")#TPE), Ident(newTypeName("String")#TPE)))), nme.CONSTRUCTOR), List())
-Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap#CLS), List(Ident(newTypeName("String")#TPE), Ident(newTypeName("String")#TPE)))), nme.CONSTRUCTOR), List())
+Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap#CLS), List(Ident(newTypeName("String")#TPE), Ident(newTypeName("String")#TPE)))), nme.CONSTRUCTOR), List()) +Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap#CLS), List(Ident(newTypeName("String")#TPE), Ident(newTypeName("String")#TPE)))), nme.CONSTRUCTOR), List()) diff --git a/test/files/run/showraw_tree_types_ids.check b/test/files/run/showraw_tree_types_ids.check index 39e68dc881..92ee45a1e6 100644 --- a/test/files/run/showraw_tree_types_ids.check +++ b/test/files/run/showraw_tree_types_ids.check @@ -1,10 +1,10 @@ -Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap#<id>), List(TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>)), TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>)))))), nme.CONSTRUCTOR#<id>), List())
-[1] TypeRef(ThisType(scala.collection.immutable#<id>), scala.collection.immutable.HashMap#<id>, List(TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()), TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List())))
-[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable#<id>), scala.collection.immutable.HashMap#<id>, List(TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()), TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()))))
-[3] TypeRef(ThisType(scala.collection.immutable#<id>), scala.collection.immutable.HashMap#<id>, List())
-[4] TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List())
-Apply[5](Select[6](New[5](TypeTree[5]().setOriginal(AppliedTypeTree(Ident[7](scala.collection.mutable.HashMap#<id>), List(TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>)), TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>)))))), nme.CONSTRUCTOR#<id>), List())
-[4] TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List())
-[5] TypeRef(ThisType(scala.collection.mutable#<id>), scala.collection.mutable.HashMap#<id>, List(TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()), TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List())))
-[6] MethodType(List(), TypeRef(ThisType(scala.collection.mutable#<id>), scala.collection.mutable.HashMap#<id>, List(TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()), TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()))))
-[7] TypeRef(ThisType(scala.collection.mutable#<id>), scala.collection.mutable.HashMap#<id>, List())
+Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap#<id>), List(TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>)), TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>)))))), nme.CONSTRUCTOR#<id>), List()) +[1] TypeRef(ThisType(scala.collection.immutable#<id>), scala.collection.immutable.HashMap#<id>, List(TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()), TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()))) +[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable#<id>), scala.collection.immutable.HashMap#<id>, List(TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()), TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List())))) +[3] TypeRef(ThisType(scala.collection.immutable#<id>), scala.collection.immutable.HashMap#<id>, List()) +[4] TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()) +Apply[5](Select[6](New[5](TypeTree[5]().setOriginal(AppliedTypeTree(Ident[7](scala.collection.mutable.HashMap#<id>), List(TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>)), TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>)))))), nme.CONSTRUCTOR#<id>), List()) +[4] TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()) +[5] TypeRef(ThisType(scala.collection.mutable#<id>), scala.collection.mutable.HashMap#<id>, List(TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()), TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()))) +[6] MethodType(List(), TypeRef(ThisType(scala.collection.mutable#<id>), scala.collection.mutable.HashMap#<id>, List(TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()), TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List())))) +[7] TypeRef(ThisType(scala.collection.mutable#<id>), scala.collection.mutable.HashMap#<id>, List()) diff --git a/test/files/run/showraw_tree_types_typed.check b/test/files/run/showraw_tree_types_typed.check index 0a41f5185c..c6c20409dc 100644 --- a/test/files/run/showraw_tree_types_typed.check +++ b/test/files/run/showraw_tree_types_typed.check @@ -1,10 +1,10 @@ -Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap), List(TypeTree[4]().setOriginal(Ident[4](newTypeName("String"))), TypeTree[4]().setOriginal(Ident[4](newTypeName("String"))))))), nme.CONSTRUCTOR), List())
-[1] TypeRef(ThisType(scala.collection.immutable), scala.collection.immutable.HashMap, List(TypeRef(ThisType(scala.Predef), newTypeName("String"), List()), TypeRef(ThisType(scala.Predef), newTypeName("String"), List())))
-[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable), scala.collection.immutable.HashMap, List(TypeRef(ThisType(scala.Predef), newTypeName("String"), List()), TypeRef(ThisType(scala.Predef), newTypeName("String"), List()))))
-[3] TypeRef(ThisType(scala.collection.immutable), scala.collection.immutable.HashMap, List())
-[4] TypeRef(ThisType(scala.Predef), newTypeName("String"), List())
-Apply[5](Select[6](New[5](TypeTree[5]().setOriginal(AppliedTypeTree(Ident[7](scala.collection.mutable.HashMap), List(TypeTree[4]().setOriginal(Ident[4](newTypeName("String"))), TypeTree[4]().setOriginal(Ident[4](newTypeName("String"))))))), nme.CONSTRUCTOR), List())
-[4] TypeRef(ThisType(scala.Predef), newTypeName("String"), List())
-[5] TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List(TypeRef(ThisType(scala.Predef), newTypeName("String"), List()), TypeRef(ThisType(scala.Predef), newTypeName("String"), List())))
-[6] MethodType(List(), TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List(TypeRef(ThisType(scala.Predef), newTypeName("String"), List()), TypeRef(ThisType(scala.Predef), newTypeName("String"), List()))))
-[7] TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List())
+Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap), List(TypeTree[4]().setOriginal(Ident[4](newTypeName("String"))), TypeTree[4]().setOriginal(Ident[4](newTypeName("String"))))))), nme.CONSTRUCTOR), List()) +[1] TypeRef(ThisType(scala.collection.immutable), scala.collection.immutable.HashMap, List(TypeRef(ThisType(scala.Predef), newTypeName("String"), List()), TypeRef(ThisType(scala.Predef), newTypeName("String"), List()))) +[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable), scala.collection.immutable.HashMap, List(TypeRef(ThisType(scala.Predef), newTypeName("String"), List()), TypeRef(ThisType(scala.Predef), newTypeName("String"), List())))) +[3] TypeRef(ThisType(scala.collection.immutable), scala.collection.immutable.HashMap, List()) +[4] TypeRef(ThisType(scala.Predef), newTypeName("String"), List()) +Apply[5](Select[6](New[5](TypeTree[5]().setOriginal(AppliedTypeTree(Ident[7](scala.collection.mutable.HashMap), List(TypeTree[4]().setOriginal(Ident[4](newTypeName("String"))), TypeTree[4]().setOriginal(Ident[4](newTypeName("String"))))))), nme.CONSTRUCTOR), List()) +[4] TypeRef(ThisType(scala.Predef), newTypeName("String"), List()) +[5] TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List(TypeRef(ThisType(scala.Predef), newTypeName("String"), List()), TypeRef(ThisType(scala.Predef), newTypeName("String"), List()))) +[6] MethodType(List(), TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List(TypeRef(ThisType(scala.Predef), newTypeName("String"), List()), TypeRef(ThisType(scala.Predef), newTypeName("String"), List())))) +[7] TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List()) diff --git a/test/files/run/showraw_tree_types_untyped.check b/test/files/run/showraw_tree_types_untyped.check index d3a1fddf48..dca272684e 100644 --- a/test/files/run/showraw_tree_types_untyped.check +++ b/test/files/run/showraw_tree_types_untyped.check @@ -1,2 +1,2 @@ -Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap), List(Ident(newTypeName("String")), Ident(newTypeName("String"))))), nme.CONSTRUCTOR), List())
-Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap), List(Ident(newTypeName("String")), Ident(newTypeName("String"))))), nme.CONSTRUCTOR), List())
+Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap), List(Ident(newTypeName("String")), Ident(newTypeName("String"))))), nme.CONSTRUCTOR), List()) +Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap), List(Ident(newTypeName("String")), Ident(newTypeName("String"))))), nme.CONSTRUCTOR), List()) diff --git a/test/files/run/showraw_tree_ultimate.check b/test/files/run/showraw_tree_ultimate.check index 400b736704..46ccd4df8f 100644 --- a/test/files/run/showraw_tree_ultimate.check +++ b/test/files/run/showraw_tree_ultimate.check @@ -1,10 +1,10 @@ -Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap#<id>#CLS), List(TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>#TPE)), TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>#TPE)))))), nme.CONSTRUCTOR#<id>#PCTOR), List())
-[1] TypeRef(ThisType(scala.collection.immutable#<id>#PK), scala.collection.immutable.HashMap#<id>#CLS, List(TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()), TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List())))
-[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable#<id>#PK), scala.collection.immutable.HashMap#<id>#CLS, List(TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()), TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()))))
-[3] TypeRef(ThisType(scala.collection.immutable#<id>#PK), scala.collection.immutable.HashMap#<id>#CLS, List())
-[4] TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List())
-Apply[5](Select[6](New[5](TypeTree[5]().setOriginal(AppliedTypeTree(Ident[7](scala.collection.mutable.HashMap#<id>#CLS), List(TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>#TPE)), TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>#TPE)))))), nme.CONSTRUCTOR#<id>#CTOR), List())
-[4] TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List())
-[5] TypeRef(ThisType(scala.collection.mutable#<id>#PK), scala.collection.mutable.HashMap#<id>#CLS, List(TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()), TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List())))
-[6] MethodType(List(), TypeRef(ThisType(scala.collection.mutable#<id>#PK), scala.collection.mutable.HashMap#<id>#CLS, List(TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()), TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()))))
-[7] TypeRef(ThisType(scala.collection.mutable#<id>#PK), scala.collection.mutable.HashMap#<id>#CLS, List())
+Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap#<id>#CLS), List(TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>#TPE)), TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>#TPE)))))), nme.CONSTRUCTOR#<id>#PCTOR), List()) +[1] TypeRef(ThisType(scala.collection.immutable#<id>#PK), scala.collection.immutable.HashMap#<id>#CLS, List(TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()), TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()))) +[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable#<id>#PK), scala.collection.immutable.HashMap#<id>#CLS, List(TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()), TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List())))) +[3] TypeRef(ThisType(scala.collection.immutable#<id>#PK), scala.collection.immutable.HashMap#<id>#CLS, List()) +[4] TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()) +Apply[5](Select[6](New[5](TypeTree[5]().setOriginal(AppliedTypeTree(Ident[7](scala.collection.mutable.HashMap#<id>#CLS), List(TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>#TPE)), TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>#TPE)))))), nme.CONSTRUCTOR#<id>#CTOR), List()) +[4] TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()) +[5] TypeRef(ThisType(scala.collection.mutable#<id>#PK), scala.collection.mutable.HashMap#<id>#CLS, List(TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()), TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()))) +[6] MethodType(List(), TypeRef(ThisType(scala.collection.mutable#<id>#PK), scala.collection.mutable.HashMap#<id>#CLS, List(TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()), TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List())))) +[7] TypeRef(ThisType(scala.collection.mutable#<id>#PK), scala.collection.mutable.HashMap#<id>#CLS, List()) diff --git a/test/files/run/static-annot-repl.check b/test/files/run/static-annot-repl.check deleted file mode 100644 index 3a1532b823..0000000000 --- a/test/files/run/static-annot-repl.check +++ /dev/null @@ -1,38 +0,0 @@ -Type in expressions to have them evaluated. -Type :help for more information. - -scala> - -scala> import annotation.static -import annotation.static - -scala> @static var x1 = 42 -x1: Int = 42 - -scala> @static val x2 = 43 -x2: Int = 43 - -scala> @static def x3 = 44 -<console>:8: error: The @static annotation is not allowed on method definitions. - @static def x3 = 44 - ^ - -scala> x1 -res0: Int = 42 - -scala> x2 -res1: Int = 43 - -scala> x3 -<console>:9: error: not found: value x3 - x3 - ^ - -scala> class Test { - @static def x = 42 -} -<console>:9: error: The @static annotation is not allowed on method definitions. - @static def x = 42 - ^ - -scala>
\ No newline at end of file diff --git a/test/files/run/static-annot-repl.scala b/test/files/run/static-annot-repl.scala deleted file mode 100644 index 1d2e9b2d7e..0000000000 --- a/test/files/run/static-annot-repl.scala +++ /dev/null @@ -1,22 +0,0 @@ - - - -import scala.tools.partest.ReplTest - - - -object Test extends ReplTest { - def code = """ -import annotation.static -@static var x1 = 42 -@static val x2 = 43 -@static def x3 = 44 -x1 -x2 -x3 -class Test { - @static def x = 42 -} -""" - -} diff --git a/test/files/run/static-annot/field.scala b/test/files/run/static-annot/field.scala deleted file mode 100644 index 8408a51800..0000000000 --- a/test/files/run/static-annot/field.scala +++ /dev/null @@ -1,252 +0,0 @@ - - - -import java.lang.reflect.Modifier -import annotation.static -import reflect._ - - - -/* TEST 1 */ - -/* A @static-annotated field in the companion object should yield - * a static field in its companion class. - */ -object Foo { - @static val bar = 17 -} - - -class Foo - - -trait Check { - def checkStatic(cls: Class[_]) { - cls.getDeclaredFields.find(_.getName == "bar") match { - case Some(f) => - assert(Modifier.isStatic(f.getModifiers), "no static modifier") - case None => - assert(false, "no static field bar in class") - } - } - - def test(): Unit -} - - -object Test1 extends Check { - def test() { - checkStatic(classOf[Foo]) - assert(Foo.bar == 17, "Companion object field should be 17.") - } -} - - -/* TEST 2 */ - -class Foo2 - - -/** The order of declaring the class and its companion is inverted now. */ -object Foo2 { - @static val bar = 199 -} - - -object Test2 extends Check { - def test() { - checkStatic(Class.forName("Foo3")) - assert(Foo3.bar == 1984, "Companion object field should be 1984.") - } -} - - -/* TEST 3 */ - -/** The case where there is no explicit companion class */ -object Foo3 { - @static val bar = 1984 -} - - -object Test3 extends Check { - def test() { - checkStatic(Class.forName("Foo3")) - assert(Foo3.bar == 1984, "Companion object field should be 1984.") - } -} - - -/* TEST 4 */ - -/** We want to be able to generate atomic reference field updaters on the companion object - * so that they are created only once per class declaration, but we want them to actually - * be initialize __in the static initializer of the class itself__. - * This is extremely important, because otherwise the creation of the ARFU fails, since it uses - * trickery to detect the caller and compare it to the owner of the field being modified. - * Previously, this used to be circumvented through the use of Java base classes. A pain. - */ -class ArfuTarget { - @volatile var strfield = ArfuTarget.STR - - def CAS(ov: String, nv: String): Boolean = { - ArfuTarget.arfu.compareAndSet(this, ov, nv) - } -} - - -object ArfuTarget { - @static val arfu = java.util.concurrent.atomic.AtomicReferenceFieldUpdater.newUpdater(classOf[ArfuTarget], classOf[String], "strfield") - val STR = "Some string" -} - - -object Test4 extends Check { - def checkArfu() { - val at = new ArfuTarget - assert(at.strfield == ArfuTarget.STR) - at.CAS(ArfuTarget.STR, null) - assert(at.strfield == null) - } - - def test() { - checkArfu() - } -} - - -/* TEST 5 */ - -/** Although our main use-case is to use final static fields, we should be able to use non-final too. - * Here we set the static field of the class by using the setters in the companion object. - * It is legal to do so using the reference to `Foo` directly (in which case the callsites - * are rewritten to access the static field directly), or through an interface `Var` (in - * which case the getter and the setter for `field` access the static field in `Var`). - */ -trait Var { - var field: Int -} - -object VarHolder extends Var { - @static var field = 1 -} - - -object Test5 extends Check { - def test() { - assert(VarHolder.field == 1) - VarHolder.field = 2 - assert(VarHolder.field == 2) - val vh: Var = VarHolder - vh.field = 3 - assert(vh.field == 3) - } -} - - -/* TEST 6 */ - -/** Here we test flattening the static ctor body and changing the owners of local definitions. */ -object Foo6 { - var companionField = 101 - @static val staticField = { - val intermediate = companionField + 1 - intermediate * 2 - } -} - - -object Test6 extends Check { - def test() { - assert(Foo6.staticField == 204) - } -} - - - -/* TEST 7 */ - -/** Here we test objects nested in top-level objects */ -object Foo7 { - object AndHisFriend { - @static val bar = "string" - } - class AndHisFriend - - object AndHisLonelyFriend { - @static val bar = "another" - } -} - - -object Test7 extends Check { - def test() { - checkStatic(classOf[Foo7.AndHisFriend]) - assert(Foo7.AndHisFriend.bar == "string") - - checkStatic(Class.forName("Foo7$AndHisLonelyFriend")) - assert(Foo7.AndHisLonelyFriend.bar == "another") - } -} - - - -/* TEST 8 */ - -object Foo8 { - @static val field = 7 - - val function: () => Int = () => { - field + 1 - } - - val anon = new Runnable { - def run() { - assert(field == 7, "runnable asserting field is 7") - } - } - - @static var mutable = 10 - - val mutation: () => Unit = () => { - mutable += 1 - } -} - -object Test8 { - def test() { - assert(Foo8.function() == 8, "function must return 8") - Foo8.anon.run() - assert(Foo8.mutable == 10, "mutable is 10") - Foo8.mutation() - assert(Foo8.mutable == 11, "mutable is 11") - Foo8.mutation() - assert(Foo8.mutable == 12, "mutable is 12") - } -} - - - - -/* main */ - -object Test { - - def main(args: Array[String]) { - Test1.test() - Test2.test() - Test3.test() - Test4.test() - Test5.test() - Test6.test() - Test7.test() - Test8.test() - } - -} - - - - - - diff --git a/test/files/run/t1195-new.check b/test/files/run/t1195-new.check index 4dd1661d1b..e0c9ac07ff 100644 --- a/test/files/run/t1195-new.check +++ b/test/files/run/t1195-new.check @@ -1,6 +1,6 @@ -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
+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-old.check b/test/files/run/t1195-old.check index eb60eceb17..d023bc91f7 100644 --- a/test/files/run/t1195-old.check +++ b/test/files/run/t1195-old.check @@ -1,6 +1,6 @@ -_ <: scala.runtime.AbstractFunction1[Int, _ <: Object with scala.Product with scala.Serializable] with scala.Serializable with java.lang.Object
-_ <: Object with scala.Product with scala.Serializable
-Object with scala.Product with scala.Serializable
-_ <: scala.runtime.AbstractFunction1[Int, _ <: Object with scala.Product with scala.Serializable] with scala.Serializable with java.lang.Object
-_ <: Object with scala.Product with scala.Serializable
-Object with scala.Product with scala.Serializable
+_ <: scala.runtime.AbstractFunction1[Int, _ <: Object with scala.Product with scala.Serializable] with scala.Serializable with java.lang.Object +_ <: Object with scala.Product with scala.Serializable +Object with scala.Product with scala.Serializable +_ <: scala.runtime.AbstractFunction1[Int, _ <: Object with scala.Product with scala.Serializable] with scala.Serializable with java.lang.Object +_ <: Object with scala.Product with scala.Serializable +Object with scala.Product with scala.Serializable diff --git a/test/files/run/t2296a.check b/test/files/run/t2296a.check deleted file mode 100644 index f75aec9d81..0000000000 --- a/test/files/run/t2296a.check +++ /dev/null @@ -1,2 +0,0 @@ -J.foo() -J.foo() diff --git a/test/files/run/t2296a/J.java b/test/files/run/t2296a/J.java deleted file mode 100644 index 78ff3e9804..0000000000 --- a/test/files/run/t2296a/J.java +++ /dev/null @@ -1,7 +0,0 @@ -package j; - -public class J { - protected void foo() { - System.out.println("J.foo()"); - } -}
\ No newline at end of file diff --git a/test/files/run/t2296a/S.scala b/test/files/run/t2296a/S.scala deleted file mode 100644 index 532d038a42..0000000000 --- a/test/files/run/t2296a/S.scala +++ /dev/null @@ -1,18 +0,0 @@ -package s { - import j.J - - trait S extends J { - def bar() { - foo() - } - } - - class SC extends J with S -} - -object Test { - def main(args : Array[String]) { - (new s.SC).bar() - (new s.S { }).bar() - } -}
\ No newline at end of file diff --git a/test/files/run/t2296b.check b/test/files/run/t2296b.check deleted file mode 100644 index f75aec9d81..0000000000 --- a/test/files/run/t2296b.check +++ /dev/null @@ -1,2 +0,0 @@ -J.foo() -J.foo() diff --git a/test/files/run/t2296b/J_1.java b/test/files/run/t2296b/J_1.java deleted file mode 100644 index 4c91d47073..0000000000 --- a/test/files/run/t2296b/J_1.java +++ /dev/null @@ -1,7 +0,0 @@ -package j; - -public class J_1 { - protected void foo() { - System.out.println("J.foo()"); - } -}
\ No newline at end of file diff --git a/test/files/run/t2296b/S_2.scala b/test/files/run/t2296b/S_2.scala deleted file mode 100644 index 6cdb0cfaba..0000000000 --- a/test/files/run/t2296b/S_2.scala +++ /dev/null @@ -1,18 +0,0 @@ -package s { - import j.J_1 - - trait S extends J_1 { - def bar() { - foo() - } - } - - class SC extends J_1 with S -} - -object Test { - def main(args : Array[String]) { - (new s.SC).bar() - (new s.S { }).bar() - } -} diff --git a/test/files/run/t2386-new.check b/test/files/run/t2386-new.check index 98e226f946..8ed0ffd7d8 100644 --- a/test/files/run/t2386-new.check +++ b/test/files/run/t2386-new.check @@ -1,2 +1,2 @@ -a(0) = Array(1, 2)
-a(1) = Array("a", "b")
+a(0) = Array(1, 2) +a(1) = Array("a", "b") diff --git a/test/files/run/t3507-new.check b/test/files/run/t3507-new.check index b02c40fc26..208e093004 100644 --- a/test/files/run/t3507-new.check +++ b/test/files/run/t3507-new.check @@ -1 +1 @@ -_1.b.c.type
+_1.b.c.type diff --git a/test/files/run/t4110-new.check b/test/files/run/t4110-new.check index 5cbfb27f3e..c0f646c5f6 100644 --- a/test/files/run/t4110-new.check +++ b/test/files/run/t4110-new.check @@ -1,2 +1,2 @@ -Test.A with Test.B
-Test.A with Test.B
+Test.A with Test.B +Test.A with Test.B diff --git a/test/files/run/t4216.check b/test/files/run/t4216.check index 6f2684f42d..091e55a0c7 100644 --- a/test/files/run/t4216.check +++ b/test/files/run/t4216.check @@ -1,37 +1,37 @@ -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>
+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/t4729.check b/test/files/run/t4729.check new file mode 100644 index 0000000000..9a2aa56d99 --- /dev/null +++ b/test/files/run/t4729.check @@ -0,0 +1,4 @@ +WrappedArray(1, 2) +WrappedArray(1, 2) +WrappedArray(1, 2) +WrappedArray(1, 2) diff --git a/test/files/run/t4729/J_1.java b/test/files/run/t4729/J_1.java new file mode 100644 index 0000000000..2ffb5a88d1 --- /dev/null +++ b/test/files/run/t4729/J_1.java @@ -0,0 +1,4 @@ +// Java Interface: +public interface J_1 { + public void method(String... s); +} diff --git a/test/files/run/t4729/S_2.scala b/test/files/run/t4729/S_2.scala new file mode 100644 index 0000000000..e34e3d34d4 --- /dev/null +++ b/test/files/run/t4729/S_2.scala @@ -0,0 +1,29 @@ + // Scala class: +class ScalaVarArgs extends J_1 { + // -- no problem on overriding it using ordinary class + def method(s: String*) { println(s) } +} + +object Test { + def main(args: Array[String]) { + //[1] Ok - no problem using inferred type + val varArgs = new J_1 { + def method(s: String*) { println(s) } + } + varArgs.method("1", "2") + + //[2] Ok -- no problem when explicit set its type after construction + val b: J_1 = varArgs + b.method("1", "2") + + //[3] Ok -- no problem on calling its method + (new ScalaVarArgs).method("1", "2") + (new ScalaVarArgs: J_1).method("1", "2") + + //[4] Not Ok -- error when assigning anonymous class to a explictly typed val + // Compiler error: object creation impossible, since method method in trait VarArgs of type (s: <repeated...>[java.lang.String])Unit is not defined + val tagged: J_1 = new J_1 { + def method(s: String*) { println(s) } + } + } +} diff --git a/test/files/run/t4835.check b/test/files/run/t4835.check index 531c3d7bb6..0987722d5f 100644 --- a/test/files/run/t4835.check +++ b/test/files/run/t4835.check @@ -1,7 +1,7 @@ --1 0 1 2 3 4 5 6 7 8 9
--1 1 3 5 7 9 11 13 15 17 19
-1 1
-2 1 2
-2 1 A 2
-3 1 2 3
-3 1 A 2 B 3
+-1 0 1 2 3 4 5 6 7 8 9 +-1 1 3 5 7 9 11 13 15 17 19 +1 1 +2 1 2 +2 1 A 2 +3 1 2 3 +3 1 A 2 B 3 diff --git a/test/files/run/t4835.scala b/test/files/run/t4835.scala index 50d161be40..c964e42e7c 100644 --- a/test/files/run/t4835.scala +++ b/test/files/run/t4835.scala @@ -1,38 +1,38 @@ -/*
- * Test case for SI-4835. This tests confirm that the fix
- * doesn't break laziness. To test memory consumption,
- * I need to confirm that OutOfMemoryError doesn't occur.
- * I could create such tests. However, such tests consume
- * too much time and memory.
- */
-object Test {
- private final val INFINITE = -1
- def testStreamIterator(num: Int, stream: Stream[Int]): Unit = {
- val iter = stream.iterator
- print(num)
- // if num == -1, then steram is infinite sequence
- if (num == INFINITE) {
- for(i <- 0 until 10) {
- print(" " + iter.next())
- }
- } else {
- while(iter.hasNext) {
- print(" " + iter.next())
- }
- }
- println()
- }
-
- def main(args: Array[String]): Unit = {
- import Stream.{from, cons, empty}
- testStreamIterator(INFINITE, from(0))
- testStreamIterator(INFINITE, from(0).filter(_ % 2 == 1))
- testStreamIterator(1, Stream(1))
- testStreamIterator(2, Stream(1, 2))
- //Stream with side effect
- testStreamIterator(2, cons(1, cons({ print(" A"); 2}, empty)))
- testStreamIterator(3, Stream(1, 2, 3))
- //Stream with side effect
- testStreamIterator(3, cons(1, cons({ print(" A"); 2}, cons({ print(" B"); 3}, Stream.empty))))
- }
-}
+/* + * Test case for SI-4835. This tests confirm that the fix + * doesn't break laziness. To test memory consumption, + * I need to confirm that OutOfMemoryError doesn't occur. + * I could create such tests. However, such tests consume + * too much time and memory. + */ +object Test { + private final val INFINITE = -1 + def testStreamIterator(num: Int, stream: Stream[Int]): Unit = { + val iter = stream.iterator + print(num) + // if num == -1, then steram is infinite sequence + if (num == INFINITE) { + for(i <- 0 until 10) { + print(" " + iter.next()) + } + } else { + while(iter.hasNext) { + print(" " + iter.next()) + } + } + println() + } + + def main(args: Array[String]): Unit = { + import Stream.{from, cons, empty} + testStreamIterator(INFINITE, from(0)) + testStreamIterator(INFINITE, from(0).filter(_ % 2 == 1)) + testStreamIterator(1, Stream(1)) + testStreamIterator(2, Stream(1, 2)) + //Stream with side effect + testStreamIterator(2, cons(1, cons({ print(" A"); 2}, empty))) + testStreamIterator(3, Stream(1, 2, 3)) + //Stream with side effect + testStreamIterator(3, cons(1, cons({ print(" A"); 2}, cons({ print(" B"); 3}, Stream.empty)))) + } +} diff --git a/test/files/run/t4935.check b/test/files/run/t4935.check index ef0493b275..ce01362503 100644 --- a/test/files/run/t4935.check +++ b/test/files/run/t4935.check @@ -1 +1 @@ -hello
+hello diff --git a/test/files/run/t4935.flags b/test/files/run/t4935.flags index ac14fe5dbd..49d036a887 100644 --- a/test/files/run/t4935.flags +++ b/test/files/run/t4935.flags @@ -1 +1 @@ --optimize
+-optimize diff --git a/test/files/run/t4935.scala b/test/files/run/t4935.scala index 18631e2041..5940355b9b 100644 --- a/test/files/run/t4935.scala +++ b/test/files/run/t4935.scala @@ -1,9 +1,9 @@ -object Test extends App {
- for (i <- 0 to 1) {
- val a = Foo
- }
-}
-
-object Foo {
- println("hello")
-}
+object Test extends App { + for (i <- 0 to 1) { + val a = Foo + } +} + +object Foo { + println("hello") +} diff --git a/test/files/run/t5224.check b/test/files/run/t5224.check index ffeb7b43ce..e15c1c90eb 100644 --- a/test/files/run/t5224.check +++ b/test/files/run/t5224.check @@ -1,9 +1,9 @@ -{
- @new Foo(bar = "qwe") class C extends AnyRef {
- def <init>() = {
- super.<init>();
- ()
- }
- };
- ()
-}
+{ + @new Foo(bar = "qwe") class C extends AnyRef { + def <init>() = { + super.<init>(); + () + } + }; + () +} diff --git a/test/files/run/t5225_1.check b/test/files/run/t5225_1.check index 40db2468b1..1a47aacfd0 100644 --- a/test/files/run/t5225_1.check +++ b/test/files/run/t5225_1.check @@ -1,4 +1,4 @@ -{
- @new transient() @new volatile() var x = 2;
- ()
-}
+{ + @new transient() @new volatile() var x = 2; + () +} diff --git a/test/files/run/t5225_2.check b/test/files/run/t5225_2.check index 8cd2ddc1a4..8ed54a14bb 100644 --- a/test/files/run/t5225_2.check +++ b/test/files/run/t5225_2.check @@ -1,4 +1,4 @@ -{
- def foo(@new cloneable() x: Int) = "";
- ()
-}
+{ + def foo(@new cloneable() x: Int) = ""; + () +} diff --git a/test/files/run/t5229_2.scala b/test/files/run/t5229_2.scala index 75d7204911..f059b09772 100644 --- a/test/files/run/t5229_2.scala +++ b/test/files/run/t5229_2.scala @@ -13,6 +13,6 @@ object Test extends App { }; val toolbox = cm.mkToolBox() - val evaluated = toolbox.runExpr(code.tree) + val evaluated = toolbox.eval(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 5cd67766b4..f6a7817c0b 100644 --- a/test/files/run/t5230.scala +++ b/test/files/run/t5230.scala @@ -13,6 +13,6 @@ object Test extends App { }; val toolbox = cm.mkToolBox() - val evaluated = toolbox.runExpr(code.tree) + val evaluated = toolbox.eval(code.tree) println("evaluated = " + evaluated) }
\ No newline at end of file diff --git a/test/files/run/t5256c.check b/test/files/run/t5256c.check index 16bfc6c9d0..7fcd0eb722 100644 --- a/test/files/run/t5256c.check +++ b/test/files/run/t5256c.check @@ -1,6 +1,6 @@ -class A$1
-Test.A$1
+class A$1 +Test.A$1 java.lang.Object { def foo(): Nothing def <init>(): A$1 -}
+} diff --git a/test/files/run/t5256g.check b/test/files/run/t5256g.check index 5aac899694..c9c8d6e63d 100644 --- a/test/files/run/t5256g.check +++ b/test/files/run/t5256g.check @@ -1,3 +1,3 @@ -anonymous class $anon$1
-Test.$anon$1
-A with B{def <init>(): A with B}
+anonymous class $anon$1 +Test.$anon$1 +A with B{def <init>(): A with B} diff --git a/test/files/run/t5256h.check b/test/files/run/t5256h.check index 2a6b292486..1b23a71a4c 100644 --- a/test/files/run/t5256h.check +++ b/test/files/run/t5256h.check @@ -1,7 +1,7 @@ -anonymous class $anon$1
-Test.$anon$1
+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/t5266_1.scala b/test/files/run/t5266_1.scala index ee7ea6d335..7bf73ac988 100644 --- a/test/files/run/t5266_1.scala +++ b/test/files/run/t5266_1.scala @@ -10,6 +10,6 @@ object Test extends App { }; val toolbox = cm.mkToolBox() - val evaluated = toolbox.runExpr(code.tree) + val evaluated = toolbox.eval(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 ca16f656ee..9b33910d00 100644 --- a/test/files/run/t5266_2.scala +++ b/test/files/run/t5266_2.scala @@ -11,6 +11,6 @@ object Test extends App { }; val toolbox = cm.mkToolBox() - val evaluated = toolbox.runExpr(code.tree) + val evaluated = toolbox.eval(code.tree) println("evaluated = " + evaluated) }
\ No newline at end of file diff --git a/test/files/run/t5271_1.check b/test/files/run/t5271_1.check index 5245173228..544b4d2762 100644 --- a/test/files/run/t5271_1.check +++ b/test/files/run/t5271_1.check @@ -1,12 +1,12 @@ -{
- case class C extends Product with Serializable {
- <caseaccessor> <paramaccessor> val foo: Int = _;
- <caseaccessor> <paramaccessor> val bar: Int = _;
- def <init>(foo: Int, bar: Int) = {
- super.<init>();
- ()
- }
- };
- ()
-}
-()
+{ + case class C extends Product with Serializable { + <caseaccessor> <paramaccessor> val foo: Int = _; + <caseaccessor> <paramaccessor> val bar: Int = _; + def <init>(foo: Int, bar: Int) = { + super.<init>(); + () + } + }; + () +} +() diff --git a/test/files/run/t5271_2.check b/test/files/run/t5271_2.check index 0765b3a6a4..585331be65 100644 --- a/test/files/run/t5271_2.check +++ b/test/files/run/t5271_2.check @@ -1,14 +1,14 @@ -{
- case class C extends Product with Serializable {
- <caseaccessor> <paramaccessor> val foo: Int = _;
- <caseaccessor> <paramaccessor> val bar: Int = _;
- def <init>(foo: Int, bar: Int) = {
- super.<init>();
- ()
- }
- };
- val c = C.apply(2, 2);
- scala.this.Predef.println(c.foo.$times(c.bar))
-}
-4
-()
+{ + case class C extends Product with Serializable { + <caseaccessor> <paramaccessor> val foo: Int = _; + <caseaccessor> <paramaccessor> val bar: Int = _; + def <init>(foo: Int, bar: Int) = { + super.<init>(); + () + } + }; + val c = C.apply(2, 2); + scala.this.Predef.println(c.foo.$times(c.bar)) +} +4 +() diff --git a/test/files/run/t5271_3.check b/test/files/run/t5271_3.check index 3cfedbacd7..b02acd21f9 100644 --- a/test/files/run/t5271_3.check +++ b/test/files/run/t5271_3.check @@ -1,21 +1,21 @@ -{
- object C extends AnyRef {
- def <init>() = {
- super.<init>();
- ()
- };
- def qwe = 4
- };
- case class C extends Product with Serializable {
- <caseaccessor> <paramaccessor> val foo: Int = _;
- <caseaccessor> <paramaccessor> val bar: Int = _;
- def <init>(foo: Int, bar: Int) = {
- super.<init>();
- ()
- }
- };
- val c = C.apply(2, 2);
- scala.this.Predef.println(c.foo.$times(c.bar).$eq$eq(C.qwe))
-}
-true
-()
+{ + object C extends AnyRef { + def <init>() = { + super.<init>(); + () + }; + def qwe = 4 + }; + case class C extends Product with Serializable { + <caseaccessor> <paramaccessor> val foo: Int = _; + <caseaccessor> <paramaccessor> val bar: Int = _; + def <init>(foo: Int, bar: Int) = { + super.<init>(); + () + } + }; + val c = C.apply(2, 2); + scala.this.Predef.println(c.foo.$times(c.bar).$eq$eq(C.qwe)) +} +true +() diff --git a/test/files/run/t5334_1.scala b/test/files/run/t5334_1.scala index 2b6418990a..3aeb7e4437 100644 --- a/test/files/run/t5334_1.scala +++ b/test/files/run/t5334_1.scala @@ -11,5 +11,5 @@ object Test extends App { }; val toolbox = cm.mkToolBox() - println(toolbox.runExpr(code.tree)) + println(toolbox.eval(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 815f78f951..64ee1e0acd 100644 --- a/test/files/run/t5334_2.scala +++ b/test/files/run/t5334_2.scala @@ -11,5 +11,5 @@ object Test extends App { }; val toolbox = cm.mkToolBox() - println(toolbox.runExpr(code.tree)) + println(toolbox.eval(code.tree)) }
\ No newline at end of file diff --git a/test/files/run/t5418a.check b/test/files/run/t5418a.check new file mode 100644 index 0000000000..527022936d --- /dev/null +++ b/test/files/run/t5418a.check @@ -0,0 +1 @@ +Expr[Class[_ <: java.lang.Object]](new Object().getClass()) diff --git a/test/files/run/t5418a.scala b/test/files/run/t5418a.scala new file mode 100644 index 0000000000..90bc542be6 --- /dev/null +++ b/test/files/run/t5418a.scala @@ -0,0 +1,3 @@ +object Test extends App { + println(scala.reflect.runtime.universe.reify(new Object().getClass)) +}
\ No newline at end of file diff --git a/test/files/run/t5418b.check b/test/files/run/t5418b.check new file mode 100644 index 0000000000..48d82a2aae --- /dev/null +++ b/test/files/run/t5418b.check @@ -0,0 +1,2 @@ +new Object().getClass() +TypeRef(ThisType(java.lang), java.lang.Class, List(TypeRef(NoPrefix, newTypeName("?0"), List()))) diff --git a/test/files/run/t5418b.scala b/test/files/run/t5418b.scala new file mode 100644 index 0000000000..08e8bb163b --- /dev/null +++ b/test/files/run/t5418b.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends App { + val tb = cm.mkToolBox() + val untyped = reify(new Object().getClass).tree + val typed = tb.typeCheck(untyped) + println(typed) + println(showRaw(typed.tpe)) +}
\ No newline at end of file diff --git a/test/files/run/t5419.check b/test/files/run/t5419.check index 50751b168e..a9c0f262e3 100644 --- a/test/files/run/t5419.check +++ b/test/files/run/t5419.check @@ -1 +1 @@ -5: @Foo.asInstanceOf[Int]
+5: @Foo.asInstanceOf[Int] diff --git a/test/files/run/t5423.scala b/test/files/run/t5423.scala index 9b8ba090fa..c1632126b2 100644 --- a/test/files/run/t5423.scala +++ b/test/files/run/t5423.scala @@ -7,5 +7,5 @@ final class table extends annotation.StaticAnnotation object Test extends App { val s = cm.classSymbol(classOf[A]) - println(s.getAnnotations) + println(s.annotations) }
\ No newline at end of file diff --git a/test/files/run/t5604.check b/test/files/run/t5604.check new file mode 100644 index 0000000000..53a2fc8894 --- /dev/null +++ b/test/files/run/t5604.check @@ -0,0 +1,8 @@ +long +double +long +double +long +double +long +double diff --git a/test/files/run/t5604.scala b/test/files/run/t5604.scala new file mode 100644 index 0000000000..a06c8aab3e --- /dev/null +++ b/test/files/run/t5604.scala @@ -0,0 +1,50 @@ +// a.scala +// Fri Jan 13 11:31:47 PST 2012 + +package foo { + object regular extends Duh { + def buh(n: Long) = println("long") + def buh(n: Double) = println("double") + } + class regular { + import regular._ + + duh(33L) + duh(3.0d) + foo.regular.duh(33L) + foo.regular.duh(3.0d) + buh(66L) + buh(6.0d) + foo.regular.buh(66L) + foo.regular.buh(6.0d) + } + + trait Duh { + def duh(n: Long) = println("long") + def duh(n: Double) = println("double") + } + package object bar extends Duh { + def buh(n: Long) = println("long") + def buh(n: Double) = println("double") + } + package bar { + object Main { + def main(args:Array[String]) { + duh(33L) + duh(3.0d) + foo.bar.duh(33L) + foo.bar.duh(3.0d) + buh(66L) + buh(6.0d) + foo.bar.buh(66L) + foo.bar.buh(6.0d) + } + } + } +} + +object Test { + def main(args: Array[String]): Unit = { + foo.bar.Main.main(null) + } +} diff --git a/test/files/run/t5680.check b/test/files/run/t5680.check index 9fec3b6505..0d825ab7d0 100644 --- a/test/files/run/t5680.check +++ b/test/files/run/t5680.check @@ -1,3 +1,3 @@ -[Lscala.runtime.BoxedUnit
-()
-()
+[Lscala.runtime.BoxedUnit +() +() diff --git a/test/files/run/t5704.check b/test/files/run/t5704.check index 0f6c84d2ec..102e3209c6 100644 --- a/test/files/run/t5704.check +++ b/test/files/run/t5704.check @@ -1 +1 @@ -String
+String diff --git a/test/files/run/t5713.check b/test/files/run/t5713.check index d3e9348123..1419eb9d79 100644 --- a/test/files/run/t5713.check +++ b/test/files/run/t5713.check @@ -1 +1 @@ -err
+err diff --git a/test/files/run/t576.scala b/test/files/run/t576.scala index dc09d8dc98..756a241572 100644 --- a/test/files/run/t576.scala +++ b/test/files/run/t576.scala @@ -12,7 +12,7 @@ object Dingus { object Test { val x1 = new A val x2 = new A - + val x3 = new { self => override def equals(other : Any) = other match { case that: self.type => true @@ -20,7 +20,7 @@ object Test { } } val x4 = new { self => - def f(x: Any) = x match { + def f(x: Any): Int = x match { case _: x1.type => 1 case _: x2.type => 2 case _: x3.type => 3 @@ -35,11 +35,11 @@ object Test { assert(x1 != x2) assert(x1 != ()) assert(x2 != x1) - + assert(x3 == x3) assert(x3 != x2) assert(x2 != x3) - + List(x1, x2, x3, x4, Dingus) map x4.f foreach println } -}
\ No newline at end of file +} diff --git a/test/files/run/t5770.check b/test/files/run/t5770.check new file mode 100644 index 0000000000..f00c965d83 --- /dev/null +++ b/test/files/run/t5770.check @@ -0,0 +1,10 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 diff --git a/test/files/run/t5770.scala b/test/files/run/t5770.scala new file mode 100644 index 0000000000..b6c9236844 --- /dev/null +++ b/test/files/run/t5770.scala @@ -0,0 +1,25 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect._ + +object Test extends App { + var i = 0 + val action = reify { i += 1; println(i) }.tree + + val tb1 = cm.mkToolBox() + tb1.eval(action) + tb1.eval(action) + tb1.eval(action) + tb1.frontEnd.reset() + tb1.eval(action) + tb1.eval(action) + + val tb2 = cm.mkToolBox() + tb2.eval(action) + tb2.frontEnd.reset() + tb2.eval(action) + tb2.eval(action) + tb2.frontEnd.reset() + tb2.eval(action) + tb2.eval(action) +} diff --git a/test/files/run/t5816.check b/test/files/run/t5816.check index 920b64a50d..8e58ace9b4 100644 --- a/test/files/run/t5816.check +++ b/test/files/run/t5816.check @@ -1 +1 @@ -5.+(Test.this.y)
+5.+(Test.this.y) diff --git a/test/files/run/t5881.check b/test/files/run/t5881.check index 8e596e9323..f4aeec680a 100644 --- a/test/files/run/t5881.check +++ b/test/files/run/t5881.check @@ -1,2 +1,2 @@ -scala.collection.immutable.List
-scala.collection.immutable.List
+scala.collection.immutable.List +scala.collection.immutable.List diff --git a/test/files/run/t5942.check b/test/files/run/t5942.check new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/files/run/t5942.check diff --git a/test/files/run/t5942.scala b/test/files/run/t5942.scala new file mode 100644 index 0000000000..44a8be93f6 --- /dev/null +++ b/test/files/run/t5942.scala @@ -0,0 +1,10 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect._ + +object Test extends App { + val tb = cm.mkToolBox() + tb.parse("def x = {}") + try { tb.parse("def x = {") } catch { case _ => } + tb.parse("def x = {}") +} diff --git a/test/files/run/t5943a1.check b/test/files/run/t5943a1.check new file mode 100644 index 0000000000..9f4d160af8 --- /dev/null +++ b/test/files/run/t5943a1.check @@ -0,0 +1 @@ +scala.this.Predef.intWrapper(1).to(3).map[Int, scala.collection.immutable.IndexedSeq[Int]](((x$1: Int) => x$1.+(1)))(immutable.this.IndexedSeq.canBuildFrom[Int]) diff --git a/test/files/run/t5943a1.scala b/test/files/run/t5943a1.scala new file mode 100644 index 0000000000..00f4afa808 --- /dev/null +++ b/test/files/run/t5943a1.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends App { + val tb = cm.mkToolBox() + val expr = tb.parse("1 to 3 map (_+1)") + println(tb.typeCheck(expr)) +}
\ No newline at end of file diff --git a/test/files/run/t5943a2.check b/test/files/run/t5943a2.check new file mode 100644 index 0000000000..29ad79c3ce --- /dev/null +++ b/test/files/run/t5943a2.check @@ -0,0 +1 @@ +Vector(2, 3, 4) diff --git a/test/files/run/t5943a2.scala b/test/files/run/t5943a2.scala new file mode 100644 index 0000000000..fda800852d --- /dev/null +++ b/test/files/run/t5943a2.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends App { + val tb = cm.mkToolBox() + val expr = tb.parse("1 to 3 map (_+1)") + println(tb.eval(expr)) +}
\ No newline at end of file diff --git a/test/files/run/t6086-repl.check b/test/files/run/t6086-repl.check index f868aa18d0..97f20bd66b 100644 --- a/test/files/run/t6086-repl.check +++ b/test/files/run/t6086-repl.check @@ -1,12 +1,12 @@ -Type in expressions to have them evaluated.
-Type :help for more information.
-
-scala>
-
-scala> case class X(s: String)
-defined class X
-
-scala> scala.reflect.runtime.universe.typeOf[X]
-res0: reflect.runtime.universe.Type = X
-
-scala>
+Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> case class X(s: String) +defined class X + +scala> scala.reflect.runtime.universe.typeOf[X] +res0: reflect.runtime.universe.Type = X + +scala> diff --git a/test/files/run/t6086-vanilla.check b/test/files/run/t6086-vanilla.check index fd66be08d0..62d8fe9f6d 100644 --- a/test/files/run/t6086-vanilla.check +++ b/test/files/run/t6086-vanilla.check @@ -1 +1 @@ -X
+X diff --git a/test/files/run/t6188.check b/test/files/run/t6188.check index 1af3932ecd..5d64afc47b 100644 --- a/test/files/run/t6188.check +++ b/test/files/run/t6188.check @@ -1 +1 @@ -Failure(java.lang.Exception: this is an exception)
+Failure(java.lang.Exception: this is an exception) diff --git a/test/files/run/t6199-mirror.check b/test/files/run/t6199-mirror.check index ec969b5b93..6a452c185a 100644 --- a/test/files/run/t6199-mirror.check +++ b/test/files/run/t6199-mirror.check @@ -1 +1 @@ -()
+() diff --git a/test/files/run/t6199-toolbox.check b/test/files/run/t6199-toolbox.check index ec969b5b93..6a452c185a 100644 --- a/test/files/run/t6199-toolbox.check +++ b/test/files/run/t6199-toolbox.check @@ -1 +1 @@ -()
+() diff --git a/test/files/run/t6199-toolbox.scala b/test/files/run/t6199-toolbox.scala index 14670f8e21..89015f5878 100644 --- a/test/files/run/t6199-toolbox.scala +++ b/test/files/run/t6199-toolbox.scala @@ -4,5 +4,5 @@ import scala.tools.reflect.ToolBox object Test extends App { val tb = cm.mkToolBox() - println(tb.runExpr(Literal(Constant(())))) + println(tb.eval(Literal(Constant(())))) }
\ No newline at end of file diff --git a/test/files/run/t6236.check b/test/files/run/t6236.check deleted file mode 100644 index a0a2e88d0a..0000000000 --- a/test/files/run/t6236.check +++ /dev/null @@ -1,2 +0,0 @@ -353 -353
\ No newline at end of file diff --git a/test/files/run/t6236/file_1.scala b/test/files/run/t6236/file_1.scala deleted file mode 100644 index 92d22799fc..0000000000 --- a/test/files/run/t6236/file_1.scala +++ /dev/null @@ -1,9 +0,0 @@ - - -package p { - object y { - object x { - @scala.annotation.static val foo: Int = 353 - } - } -} diff --git a/test/files/run/t6236/file_2.scala b/test/files/run/t6236/file_2.scala deleted file mode 100644 index 51823004ca..0000000000 --- a/test/files/run/t6236/file_2.scala +++ /dev/null @@ -1,10 +0,0 @@ - - - -object Test { - def main(args: Array[String]): Unit = { - println(p.y.x.foo) - println(p.y.x.foo) - } -} - diff --git a/test/files/run/t6260.check b/test/files/run/t6260.check new file mode 100644 index 0000000000..54f98a10f0 --- /dev/null +++ b/test/files/run/t6260.check @@ -0,0 +1 @@ +Box(abcabc) diff --git a/test/files/run/t6260.scala b/test/files/run/t6260.scala new file mode 100644 index 0000000000..cfe9e1e640 --- /dev/null +++ b/test/files/run/t6260.scala @@ -0,0 +1,12 @@ +class Box[X <: CharSequence](val x: X) extends AnyVal { + def map[Y <: CharSequence](f: X => Y): Box[Y] = + ((bx: Box[X]) => new Box(f(bx.x)))(this) + override def toString = s"Box($x)" +} + +object Test { + def main(args: Array[String]) { + val g = (x: String) => x + x + println(new Box("abc") map g) + } +} diff --git a/test/files/run/t6277.check b/test/files/run/t6277.check new file mode 100644 index 0000000000..f32a5804e2 --- /dev/null +++ b/test/files/run/t6277.check @@ -0,0 +1 @@ +true
\ No newline at end of file diff --git a/test/files/run/t6277.scala b/test/files/run/t6277.scala new file mode 100644 index 0000000000..41feee8a8a --- /dev/null +++ b/test/files/run/t6277.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + locally { + val sym = typeOf[List[_]].typeSymbol.asClass + val q = sym.isSealed + println(q) + } +}
\ No newline at end of file diff --git a/test/files/run/t6287.check b/test/files/run/t6287.check new file mode 100644 index 0000000000..a86ecbee42 --- /dev/null +++ b/test/files/run/t6287.check @@ -0,0 +1,3 @@ +Vector(2, 3, 4) +Vector(2, 3, 4) +Vector(2, 3, 4) diff --git a/test/files/run/t6287.scala b/test/files/run/t6287.scala new file mode 100644 index 0000000000..0c75d1081b --- /dev/null +++ b/test/files/run/t6287.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect._ + +object Test extends App { + val tb = cm.mkToolBox() + val t1 = tb.parse("1 to 3 map (_+1)") + println(tb.eval(t1)) + println(tb.eval(t1)) + println(tb.eval(t1)) +}
\ No newline at end of file diff --git a/test/files/run/t6318_derived.check b/test/files/run/t6318_derived.check index ad43b6579b..926f2a4ba2 100644 --- a/test/files/run/t6318_derived.check +++ b/test/files/run/t6318_derived.check @@ -1,3 +1,3 @@ -Some(X)
-true
-Some(X)
+Some(X) +true +Some(X) diff --git a/test/files/run/t6318_primitives.check b/test/files/run/t6318_primitives.check index bb474c3bdc..b330f91276 100644 --- a/test/files/run/t6318_primitives.check +++ b/test/files/run/t6318_primitives.check @@ -1,36 +1,36 @@ -true
-Some(1)
-false
-None
-true
-Some(1)
-false
-None
-true
-Some()
-false
-None
-true
-Some(1)
-false
-None
-true
-Some(1)
-false
-None
-true
-Some(1.0)
-false
-None
-true
-Some(1.0)
-false
-None
-true
-Some(true)
-false
-None
-true
-Some(())
-false
-None
+true +Some(1) +false +None +true +Some(1) +false +None +true +Some() +false +None +true +Some(1) +false +None +true +Some(1) +false +None +true +Some(1.0) +false +None +true +Some(1.0) +false +None +true +Some(true) +false +None +true +Some(()) +false +None diff --git a/test/files/run/t6323b.check b/test/files/run/t6323b.check index 80b6176178..d6b1d1fd90 100644 --- a/test/files/run/t6323b.check +++ b/test/files/run/t6323b.check @@ -1 +1 @@ -cannot reflect value a, because it's a member of a weak type Test
+cannot reflect value a, because it's a member of a weak type Test diff --git a/test/files/run/t6329_repl.check b/test/files/run/t6329_repl.check new file mode 100644 index 0000000000..8663184bde --- /dev/null +++ b/test/files/run/t6329_repl.check @@ -0,0 +1,13 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> classManifest[List[_]] +warning: there were 1 deprecation warnings; re-run with -deprecation for details +res0: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List[Any] + +scala> scala.reflect.classTag[List[_]] +res1: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List + +scala> diff --git a/test/files/run/t6329_repl.scala b/test/files/run/t6329_repl.scala new file mode 100644 index 0000000000..add6d64962 --- /dev/null +++ b/test/files/run/t6329_repl.scala @@ -0,0 +1,8 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + def code = """ + |classManifest[List[_]] + |scala.reflect.classTag[List[_]] + |""".stripMargin +} diff --git a/test/files/run/t6329_repl_bug.check b/test/files/run/t6329_repl_bug.check new file mode 100644 index 0000000000..8663184bde --- /dev/null +++ b/test/files/run/t6329_repl_bug.check @@ -0,0 +1,13 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> classManifest[List[_]] +warning: there were 1 deprecation warnings; re-run with -deprecation for details +res0: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List[Any] + +scala> scala.reflect.classTag[List[_]] +res1: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List + +scala> diff --git a/test/files/run/t6329_repl_bug.pending b/test/files/run/t6329_repl_bug.pending new file mode 100644 index 0000000000..9997d1771e --- /dev/null +++ b/test/files/run/t6329_repl_bug.pending @@ -0,0 +1,10 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + def code = """ + |import scala.reflect.runtime.universe._ + |import scala.reflect.runtime._ + |classManifest[List[_]] + |scala.reflect.classTag[List[_]] + |""".stripMargin +} diff --git a/test/files/run/t6329_vanilla.check b/test/files/run/t6329_vanilla.check new file mode 100644 index 0000000000..8282afaeba --- /dev/null +++ b/test/files/run/t6329_vanilla.check @@ -0,0 +1,2 @@ +scala.collection.immutable.List[Any] +scala.collection.immutable.List diff --git a/test/files/run/t6329_vanilla.scala b/test/files/run/t6329_vanilla.scala new file mode 100644 index 0000000000..a31cd5c72e --- /dev/null +++ b/test/files/run/t6329_vanilla.scala @@ -0,0 +1,4 @@ +object Test extends App { + println(classManifest[List[_]]) + println(scala.reflect.classTag[List[_]]) +}
\ No newline at end of file diff --git a/test/files/run/t6329_vanilla_bug.check b/test/files/run/t6329_vanilla_bug.check new file mode 100644 index 0000000000..8282afaeba --- /dev/null +++ b/test/files/run/t6329_vanilla_bug.check @@ -0,0 +1,2 @@ +scala.collection.immutable.List[Any] +scala.collection.immutable.List diff --git a/test/files/run/t6329_vanilla_bug.pending b/test/files/run/t6329_vanilla_bug.pending new file mode 100644 index 0000000000..404f90bf6e --- /dev/null +++ b/test/files/run/t6329_vanilla_bug.pending @@ -0,0 +1,7 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime._ + +object Test extends App { + println(classManifest[List[_]]) + println(scala.reflect.classTag[List[_]]) +}
\ No newline at end of file diff --git a/test/files/run/t6337a.scala b/test/files/run/t6337a.scala new file mode 100644 index 0000000000..f5490f5cf0 --- /dev/null +++ b/test/files/run/t6337a.scala @@ -0,0 +1,16 @@ +object Test { + def main(args: Array[String]) { + val x = X(XX(3)) + assert(x.q.x.x + 9 == 13) + } +} +trait Q extends Any { + def x: Int + def inc: XX +} +case class X(val x: Q) extends AnyVal { + def q = X(x.inc) +} +case class XX(val x: Int) extends AnyVal with Q { + def inc = XX(x + 1) +} diff --git a/test/files/run/t6344.check b/test/files/run/t6344.check new file mode 100644 index 0000000000..5ac04d0320 --- /dev/null +++ b/test/files/run/t6344.check @@ -0,0 +1,132 @@ +C0 +public int C0.v1(int) +public <A> int C0.v1(int) +public int C0.v3() +public <A> int C0.v3() +public int C0.v4(int,scala.collection.immutable.List) +public <A> int C0.v4(int,scala.collection.immutable.List<Val<A>>) +public scala.collection.immutable.List C0.v2() +public <A> scala.collection.immutable.List<Val<A>> C0.v2() + +C1 +public java.lang.Object C1.v1(java.lang.Object) +public <A> java.lang.Object C1.v1(java.lang.Object) +public java.lang.Object C1.v3() +public <A> java.lang.Object C1.v3() +public java.lang.Object C1.v4(java.lang.Object,scala.collection.immutable.List) +public <A> java.lang.Object C1.v4(java.lang.Object,scala.collection.immutable.List<java.lang.Object>) +public scala.collection.immutable.List C1.v2() +public <A> scala.collection.immutable.List<java.lang.Object> C1.v2() + +C2 +public java.lang.String C2.v1(java.lang.String) +public <A> java.lang.String C2.v1(java.lang.String) +public java.lang.String C2.v3() +public <A> java.lang.String C2.v3() +public java.lang.String C2.v4(java.lang.String,scala.collection.immutable.List) +public <A> java.lang.String C2.v4(java.lang.String,scala.collection.immutable.List<java.lang.String>) +public scala.collection.immutable.List C2.v2() +public <A> scala.collection.immutable.List<java.lang.String> C2.v2() + +C3 +public java.lang.Object C3.v1(java.lang.Object) +public A C3.v1(A) +public java.lang.Object C3.v3() +public A C3.v3() +public java.lang.Object C3.v4(java.lang.Object,scala.collection.immutable.List) +public A C3.v4(A,scala.collection.immutable.List<A>) +public java.lang.Object C3.x() +public A C3.x() +public scala.collection.immutable.List C3.v2() +public scala.collection.immutable.List<A> C3.v2() + +C4 +public java.lang.Integer C4.v1(java.lang.Integer) +public int C4.v1(int) +public java.lang.Integer C4.v3() +public int C4.v3() +public java.lang.Integer C4.v4(java.lang.Integer,scala.collection.immutable.List) +public int C4.v4(int,scala.collection.immutable.List<ValA<java.lang.Object>>) +public scala.collection.immutable.List C4.v2() +public scala.collection.immutable.List<ValA<java.lang.Object>> C4.v2() + +C4B +public java.lang.String C4B.v1(java.lang.String) +public java.lang.String C4B.v1(java.lang.String) +public java.lang.String C4B.v3() +public java.lang.String C4B.v3() +public java.lang.String C4B.v4(java.lang.String,scala.collection.immutable.List) +public java.lang.String C4B.v4(java.lang.String,scala.collection.immutable.List<java.lang.String>) +public scala.collection.immutable.List C4B.v2() +public scala.collection.immutable.List<java.lang.String> C4B.v2() + +C5 +public double C5.f2(int,java.lang.Object,java.lang.String,double) +public double C5.f2(int,java.lang.Object,java.lang.String,double) +public int C5.f3(java.lang.Integer) +public int C5.f3(int) +public int C5.f4(java.lang.Integer) +public int C5.f4(int) +public int C5.f5(java.lang.Integer) +public int C5.f5(int) +public java.lang.Object C5.f1(int,java.lang.Object,java.lang.String,java.lang.Object) +public <A> A C5.f1(int,java.lang.Object,java.lang.String,A) + +C6 +public java.lang.Object C6.f1(int,java.lang.Object,java.lang.String,java.lang.Object) +public A C6.f1(int,java.lang.Object,java.lang.String,A) + +C7 +public java.lang.Integer C7.f1(int,java.lang.Object,java.lang.String,java.lang.Integer) +public int C7.f1(int,java.lang.Object,java.lang.String,int) +public java.lang.Object C7.f1(int,java.lang.Object,java.lang.String,java.lang.Object) +public java.lang.Object C7.f1(int,java.lang.Object,java.lang.String,java.lang.Object) + +Gen +public abstract Gen Gen.plus(Gen,Gen) +public abstract Gen<A> Gen.plus(Gen<A>,Gen<A>) +public abstract java.lang.Object Gen.x() +public abstract A Gen.x() + +ValueInt +public Gen ValueInt.plus(Gen,Gen) +public Gen<java.lang.Object> ValueInt.plus(Gen<java.lang.Object>,Gen<java.lang.Object>) +public boolean ValueInt.equals(java.lang.Object) +public boolean ValueInt.equals(java.lang.Object) +public int ValueInt.hashCode() +public int ValueInt.hashCode() +public int ValueInt.iplus(int,int) +public int ValueInt.iplus(int,int) +public int ValueInt.x() +public int ValueInt.x() +public java.lang.Object ValueInt.x() +public java.lang.Object ValueInt.x() +public static Gen ValueInt.extension$plus(int,Gen,Gen) +public static Gen<java.lang.Object> ValueInt.extension$plus(int,Gen<java.lang.Object>,Gen<java.lang.Object>) +public static boolean ValueInt.extension$equals(int,java.lang.Object) +public static boolean ValueInt.extension$equals(int,java.lang.Object) +public static int ValueInt.extension$hashCode(int) +public static int ValueInt.extension$hashCode(int) +public static int ValueInt.extension$iplus(int,int,int) +public static int ValueInt.extension$iplus(int,int,int) + +RefInt +public Gen RefInt.plus(Gen,Gen) +public Gen<java.lang.Object> RefInt.plus(Gen<java.lang.Object>,Gen<java.lang.Object>) +public RefInt RefInt.rplus(RefInt,RefInt) +public RefInt RefInt.rplus(RefInt,RefInt) +public int RefInt.x() +public int RefInt.x() +public java.lang.Object RefInt.x() +public java.lang.Object RefInt.x() + +RefInteger +public Gen RefInteger.plus(Gen,Gen) +public Gen<java.lang.Integer> RefInteger.plus(Gen<java.lang.Integer>,Gen<java.lang.Integer>) +public RefInteger RefInteger.bplus(RefInteger,RefInteger) +public RefInteger RefInteger.bplus(RefInteger,RefInteger) +public java.lang.Integer RefInteger.x() +public java.lang.Integer RefInteger.x() +public java.lang.Object RefInteger.x() +public java.lang.Object RefInteger.x() + diff --git a/test/files/run/t6344.scala b/test/files/run/t6344.scala new file mode 100644 index 0000000000..6f82e4ba51 --- /dev/null +++ b/test/files/run/t6344.scala @@ -0,0 +1,106 @@ +import scala.reflect.{ClassTag, classTag} +import java.lang.Integer + +trait Gen[A] extends Any { + def x: A + def plus(x1: Gen[A], x2: Gen[A]): Gen[A] +} +class ValueInt(val x: Int) extends AnyVal with Gen[Int] { + // Gen<java.lang.Object> ValueInt.extension$plus(int,Gen<java.lang.Object>,Gen<java.lang.Object>) + def plus(x1: Gen[Int], x2: Gen[Int]): Gen[Int] = new ValueInt(x + x1.x + x2.x) + // int ValueInt.extension$iplus(int,int,int) + def iplus(x1: ValueInt, x2: ValueInt): ValueInt = new ValueInt(x + x1.x + x2.x) +} +class RefInt(val x: Int) extends AnyRef with Gen[Int] { + def plus(x1: Gen[Int], x2: Gen[Int]): Gen[Int] = new RefInt(x + x1.x + x2.x) + def rplus(x1: RefInt, x2: RefInt): RefInt = new RefInt(x + x1.x + x2.x) +} +class RefInteger(val x: java.lang.Integer) extends AnyRef with Gen[Integer] { + def plus(x1: Gen[Integer], x2: Gen[Integer]): Gen[Integer] = new RefInteger(x + x1.x + x2.x) + def bplus(x1: RefInteger, x2: RefInteger): RefInteger = new RefInteger(x + x1.x + x2.x) +} + +class Val[Q](val value: Int) extends AnyVal +class ValAny[Q](val value: Any) extends AnyVal +class ValStr[Q](val value: String) extends AnyVal +class ValA[Q](val value: Q) extends AnyVal { + def f: Q = ??? +} +class ValB[Q, Q0 <: Q](val value: Q) extends AnyVal { + def f: Q0 = ??? +} + +class C0 { + def v1[A](in: Val[A]) = in + def v2[A]: List[Val[A]] = Nil + def v3[A]: Val[A] = new Val[A](0) + def v4[A <: String](x: Val[A], ys: List[Val[A]]) = ys.head +} +class C1 { + def v1[A](in: ValAny[A]) = in + def v2[A]: List[ValAny[A]] = Nil + def v3[A]: ValAny[A] = new ValAny[A]("") + def v4[A <: String](x: ValAny[A], ys: List[ValAny[A]]) = ys.head +} +class C2 { + def v1[A](in: ValStr[A]) = in + def v2[A]: List[ValStr[A]] = Nil + def v3[A]: ValStr[A] = new ValStr[A]("") + def v4[A <: String](x: ValStr[A], ys: List[ValStr[A]]) = ys.head +} +class C3[A](val x: A) { + def v1(in: ValA[A]) = in + def v2: List[ValA[A]] = Nil + def v3: ValA[A] = new ValA[A](x) + def v4(x: ValA[A], ys: List[ValA[A]]) = ys.head +} +class C4 { + def v1(in: ValA[Int]) = in + def v2: List[ValA[Int]] = Nil + def v3: ValA[Int] = new ValA(1) + def v4(x: ValA[Int], ys: List[ValA[Int]]) = ys.head +} +class C4B { + def v1(in: ValA[String]) = in + def v2: List[ValA[String]] = Nil + def v3: ValA[String] = new ValA("") + def v4(x: ValA[String], ys: List[ValA[String]]) = ys.head +} +class C5 { + def f1[A](x1: Val[A], x2: ValAny[A], x3: ValStr[A], x4: ValA[A]) = x4 + def f2(x1: Int, x2: Any, x3: String, x4: Double) = x4 + def f3(x: ValA[Int]) = x.f + def f4(x: ValB[Int, Int]) = x.f + def f5(x: ValB[Int, _ <: Int]) = x.f +} +class C6[A] { + def f1(x1: Val[A], x2: ValAny[A], x3: ValStr[A], x4: ValA[A]) = x4 +} +class C7 extends C6[Int] { + override def f1(x1: Val[Int], x2: ValAny[Int], x3: ValStr[Int], x4: ValA[Int]) = + super.f1(x1, x2, x3, x4) +} + +object Test { + def show[A: ClassTag] = { + println(classTag[A].runtimeClass.getName) + classTag[A].runtimeClass.getDeclaredMethods.toList.sortBy(_.toString).flatMap(m => List(m.toString, m.toGenericString)) foreach println + println("") + } + + def main(args: Array[String]): Unit = { + show[C0] + show[C1] + show[C2] + show[C3[_]] + show[C4] + show[C4B] + show[C5] + show[C6[_]] + show[C7] + show[Gen[_]] + show[ValueInt] + show[RefInt] + show[RefInteger] + } +} diff --git a/test/files/run/t6353.check b/test/files/run/t6353.check new file mode 100644 index 0000000000..5676bed245 --- /dev/null +++ b/test/files/run/t6353.check @@ -0,0 +1 @@ +applyDynamic(apply)(9) diff --git a/test/files/run/t6353.scala b/test/files/run/t6353.scala new file mode 100644 index 0000000000..112241a3c4 --- /dev/null +++ b/test/files/run/t6353.scala @@ -0,0 +1,12 @@ +import language.dynamics + +object Test extends App { + val x = new X(3) + val y = x(9) + class X(i: Int) extends Dynamic { + def applyDynamic(name: String)(in: Int): Int = { + println(s"applyDynamic($name)($in)") + i + in + } + } +} diff --git a/test/files/run/t6380.check b/test/files/run/t6380.check new file mode 100644 index 0000000000..912525ed66 --- /dev/null +++ b/test/files/run/t6380.check @@ -0,0 +1,7 @@ +List(class java.lang.Exception) +List(class java.lang.Throwable) +List(class java.lang.RuntimeException) +List(class java.lang.IllegalArgumentException, class java.util.NoSuchElementException) +List(class java.lang.IndexOutOfBoundsException, class java.lang.IndexOutOfBoundsException) +List(class java.lang.IllegalStateException, class java.lang.IllegalStateException) +List(class java.lang.NullPointerException, class java.lang.NullPointerException) diff --git a/test/files/run/t6380.scala b/test/files/run/t6380.scala new file mode 100644 index 0000000000..0e264d9175 --- /dev/null +++ b/test/files/run/t6380.scala @@ -0,0 +1,20 @@ +object Test extends App { + classOf[Foo].getDeclaredMethods().sortBy(_.getName).map(_.getExceptionTypes.sortBy(_.getName).toList).toList.foreach(println) +} + +class Foo { + @throws[Exception] + def bar1 = ??? + @throws[Throwable]("always") + def bar2 = ??? + @throws(classOf[RuntimeException]) + def bar3 = ??? + @throws[IllegalArgumentException] @throws[NoSuchElementException] + def bar4 = ??? + @throws(classOf[IndexOutOfBoundsException]) @throws(classOf[IndexOutOfBoundsException]) + def bar5 = ??? + @throws[IllegalStateException]("Cause") @throws[IllegalStateException] + def bar6 = ??? + @throws[NullPointerException]("Cause A") @throws[NullPointerException]("Cause B") + def bar7 = ??? +}
\ No newline at end of file diff --git a/test/files/run/t6381.check b/test/files/run/t6381.check new file mode 100644 index 0000000000..b51cfd0398 --- /dev/null +++ b/test/files/run/t6381.check @@ -0,0 +1,17 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> import language.experimental.macros +import language.experimental.macros + +scala> def pos_impl(c: reflect.macros.Context): c.Expr[String] = + c.literal(c.enclosingPosition.getClass.toString) +pos_impl: (c: scala.reflect.macros.Context)c.Expr[String] + +scala> def pos = macro pos_impl +pos: String + +scala> pos +res0: String = class scala.reflect.internal.util.RangePosition + +scala> diff --git a/test/files/run/t6381.scala b/test/files/run/t6381.scala new file mode 100644 index 0000000000..859ec3cb30 --- /dev/null +++ b/test/files/run/t6381.scala @@ -0,0 +1,13 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + def code = """ + |import language.experimental.macros + |def pos_impl(c: reflect.macros.Context): c.Expr[String] = + | c.literal(c.enclosingPosition.getClass.toString) + |def pos = macro pos_impl + |pos + |""".stripMargin.trim + + override def extraSettings: String = "-Yrangepos" +} diff --git a/test/files/run/t6392a.check b/test/files/run/t6392a.check new file mode 100644 index 0000000000..6a452c185a --- /dev/null +++ b/test/files/run/t6392a.check @@ -0,0 +1 @@ +() diff --git a/test/files/run/t6392a.scala b/test/files/run/t6392a.scala new file mode 100644 index 0000000000..3a4f9fd0a5 --- /dev/null +++ b/test/files/run/t6392a.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends App { + val tb = cm.mkToolBox() + val c = tb.parse("object C") + println(tb.eval(c)) +}
\ No newline at end of file diff --git a/test/files/run/t6392b.check b/test/files/run/t6392b.check new file mode 100644 index 0000000000..e9c7ecaa34 --- /dev/null +++ b/test/files/run/t6392b.check @@ -0,0 +1 @@ +ModuleDef(Modifiers(), newTermName("C"), Template(List(Select(Ident(scala#PK), newTypeName("AnyRef")#TPE)), emptyValDef, List(DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(newTypeName("C")), tpnme.EMPTY), nme.CONSTRUCTOR#PCTOR), List())), Literal(Constant(()))))))) diff --git a/test/files/run/t6392b.scala b/test/files/run/t6392b.scala new file mode 100644 index 0000000000..f69a5aaf45 --- /dev/null +++ b/test/files/run/t6392b.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends App { + val tb = cm.mkToolBox() + val c = tb.parse("object C") + println(showRaw(tb.typeCheck(c), printKinds = true)) +}
\ No newline at end of file diff --git a/test/files/run/t6394a.check b/test/files/run/t6394a.check new file mode 100644 index 0000000000..2a02d41ce2 --- /dev/null +++ b/test/files/run/t6394a.check @@ -0,0 +1 @@ +TEST diff --git a/test/files/run/t6394a.flags b/test/files/run/t6394a.flags new file mode 100644 index 0000000000..cd66464f2f --- /dev/null +++ b/test/files/run/t6394a.flags @@ -0,0 +1 @@ +-language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/t6394a/Macros_1.scala b/test/files/run/t6394a/Macros_1.scala new file mode 100644 index 0000000000..3d39d3e40a --- /dev/null +++ b/test/files/run/t6394a/Macros_1.scala @@ -0,0 +1,12 @@ +import scala.reflect.macros.Context + +object Macros { + def impl(c:Context): c.Expr[Any] = { + import c.universe._ + + val selfTree = This(c.enclosingClass.symbol.asModule.moduleClass) + c.Expr[AnyRef](selfTree) + } + + def foo: Any = macro impl +}
\ No newline at end of file diff --git a/test/files/run/t6394a/Test_2.scala b/test/files/run/t6394a/Test_2.scala new file mode 100644 index 0000000000..75e84f0e38 --- /dev/null +++ b/test/files/run/t6394a/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + println(Macros.foo) + override def toString = "TEST" +}
\ No newline at end of file diff --git a/test/files/run/t6394b.check b/test/files/run/t6394b.check new file mode 100644 index 0000000000..2a02d41ce2 --- /dev/null +++ b/test/files/run/t6394b.check @@ -0,0 +1 @@ +TEST diff --git a/test/files/run/t6394b.flags b/test/files/run/t6394b.flags new file mode 100644 index 0000000000..cd66464f2f --- /dev/null +++ b/test/files/run/t6394b.flags @@ -0,0 +1 @@ +-language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/t6394b/Macros_1.scala b/test/files/run/t6394b/Macros_1.scala new file mode 100644 index 0000000000..5d93e1cda8 --- /dev/null +++ b/test/files/run/t6394b/Macros_1.scala @@ -0,0 +1,12 @@ +import scala.reflect.macros.Context + +object Macros { + def impl(c:Context): c.Expr[Any] = { + import c.universe._ + + val selfTree = This(tpnme.EMPTY) + c.Expr[AnyRef](selfTree) + } + + def foo: Any = macro impl +}
\ No newline at end of file diff --git a/test/files/run/t6394b/Test_2.scala b/test/files/run/t6394b/Test_2.scala new file mode 100644 index 0000000000..75e84f0e38 --- /dev/null +++ b/test/files/run/t6394b/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + println(Macros.foo) + override def toString = "TEST" +}
\ No newline at end of file diff --git a/test/files/run/t6410.check b/test/files/run/t6410.check new file mode 100644 index 0000000000..051fe4995a --- /dev/null +++ b/test/files/run/t6410.check @@ -0,0 +1,2 @@ +ParMap(0 -> 4, 1 -> 5) +ParMap(0 -> 4, 1 -> 5)
\ No newline at end of file diff --git a/test/files/run/t6410.scala b/test/files/run/t6410.scala new file mode 100644 index 0000000000..2a001b47ab --- /dev/null +++ b/test/files/run/t6410.scala @@ -0,0 +1,9 @@ + + + +object Test extends App { + val x = collection.parallel.mutable.ParArray.range(1,10) groupBy { _ % 2 } mapValues { _.size } + println(x) + val y = collection.parallel.immutable.ParVector.range(1,10) groupBy { _ % 2 } mapValues { _.size } + println(y) +}
\ No newline at end of file diff --git a/test/files/run/t6467.scala b/test/files/run/t6467.scala new file mode 100644 index 0000000000..dc93b69fdc --- /dev/null +++ b/test/files/run/t6467.scala @@ -0,0 +1,20 @@ + + + + +import collection._ + + + +object Test extends App { + + def compare(s1: String, s2: String) { + assert(s1 == s2, s1 + "\nvs.\n" + s2) + } + + compare(List(1, 2, 3, 4).aggregate(new java.lang.StringBuffer)(_ append _, _ append _).toString, "1234") + compare(List(1, 2, 3, 4).par.aggregate(new java.lang.StringBuffer)(_ append _, _ append _).toString, "1234") + compare(Seq(0 until 100: _*).aggregate(new java.lang.StringBuffer)(_ append _, _ append _).toString, (0 until 100).mkString) + compare(Seq(0 until 100: _*).par.aggregate(new java.lang.StringBuffer)(_ append _, _ append _).toString, (0 until 100).mkString) + +}
\ No newline at end of file diff --git a/test/files/run/test-cpp.check b/test/files/run/test-cpp.check index a7163edb5f..bfea438c60 100644 --- a/test/files/run/test-cpp.check +++ b/test/files/run/test-cpp.check @@ -1,65 +1,65 @@ -37c37
-< locals: value args, value x, value y
----
-> locals: value args
-42,43d41
-< 52 CONSTANT(2)
-< 52 STORE_LOCAL(value x)
-45,46d42
-< 53 LOAD_LOCAL(value x)
-< 53 STORE_LOCAL(value y)
-49c45
-< 54 LOAD_LOCAL(value y)
----
-> 54 CONSTANT(2)
-92c88
-< locals: value args, value x, value y
----
-> locals: value args, value x
-101,102d96
-< 82 LOAD_LOCAL(value x)
-< 82 STORE_LOCAL(value y)
-105c99
-< 83 LOAD_LOCAL(value y)
----
-> 83 LOAD_LOCAL(value x)
-135c129
-< locals: value args, value x, value y
----
-> locals: value args
-140,141d133
-< 66 THIS(TestAliasChainDerefThis)
-< 66 STORE_LOCAL(value x)
-143,144d134
-< 67 LOAD_LOCAL(value x)
-< 67 STORE_LOCAL(value y)
-147c137
-< 68 LOAD_LOCAL(value y)
----
-> 68 THIS(Object)
-176c166
-< locals: value x, value y
----
-> locals: value x
-181,182d170
-< 29 LOAD_LOCAL(value x)
-< 29 STORE_LOCAL(value y)
-185c173
-< 30 LOAD_LOCAL(value y)
----
-> 30 LOAD_LOCAL(value x)
-223,224d210
-< 97 LOAD_LOCAL(variable x)
-< 97 STORE_LOCAL(variable y)
-227c213
-< 98 LOAD_LOCAL(variable y)
----
-> 98 LOAD_LOCAL(variable x)
-233,234d218
-< 101 LOAD_LOCAL(variable y)
-< 101 STORE_LOCAL(variable x)
-236c220
-< 102 LOAD_LOCAL(variable x)
----
-> 102 LOAD_LOCAL(variable y)
-
+37c37 +< locals: value args, value x, value y +--- +> locals: value args +42,43d41 +< 52 CONSTANT(2) +< 52 STORE_LOCAL(value x) +45,46d42 +< 53 LOAD_LOCAL(value x) +< 53 STORE_LOCAL(value y) +49c45 +< 54 LOAD_LOCAL(value y) +--- +> 54 CONSTANT(2) +92c88 +< locals: value args, value x, value y +--- +> locals: value args, value x +101,102d96 +< 82 LOAD_LOCAL(value x) +< 82 STORE_LOCAL(value y) +105c99 +< 83 LOAD_LOCAL(value y) +--- +> 83 LOAD_LOCAL(value x) +135c129 +< locals: value args, value x, value y +--- +> locals: value args +140,141d133 +< 66 THIS(TestAliasChainDerefThis) +< 66 STORE_LOCAL(value x) +143,144d134 +< 67 LOAD_LOCAL(value x) +< 67 STORE_LOCAL(value y) +147c137 +< 68 LOAD_LOCAL(value y) +--- +> 68 THIS(Object) +176c166 +< locals: value x, value y +--- +> locals: value x +181,182d170 +< 29 LOAD_LOCAL(value x) +< 29 STORE_LOCAL(value y) +185c173 +< 30 LOAD_LOCAL(value y) +--- +> 30 LOAD_LOCAL(value x) +223,224d210 +< 97 LOAD_LOCAL(variable x) +< 97 STORE_LOCAL(variable y) +227c213 +< 98 LOAD_LOCAL(variable y) +--- +> 98 LOAD_LOCAL(variable x) +233,234d218 +< 101 LOAD_LOCAL(variable y) +< 101 STORE_LOCAL(variable x) +236c220 +< 102 LOAD_LOCAL(variable x) +--- +> 102 LOAD_LOCAL(variable y) + diff --git a/test/files/run/toolbox_console_reporter.check b/test/files/run/toolbox_console_reporter.check index e69de29bb2..1395c68740 100644 --- a/test/files/run/toolbox_console_reporter.check +++ b/test/files/run/toolbox_console_reporter.check @@ -0,0 +1,8 @@ +hello +============compiler console============= +warning: method foo in object Utils is deprecated: test + +========================================= +============compiler messages============ +Info(NoPosition,method foo in object Utils is deprecated: test,WARNING) +========================================= diff --git a/test/files/run/toolbox_console_reporter.scala b/test/files/run/toolbox_console_reporter.scala index c5b788550e..d672ccb9cb 100644 --- a/test/files/run/toolbox_console_reporter.scala +++ b/test/files/run/toolbox_console_reporter.scala @@ -1,16 +1,29 @@ import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.{ToolBox, mkConsoleFrontEnd} object Test extends App { - // todo. cannot test this unfortunately, because ConsoleFrontEnd grabs Console.out too early - // todo. and isn't affected by Console.setOut employed by partest to intercept output + val oldErr = Console.err; + val baos = new java.io.ByteArrayOutputStream(); + Console.setErr(new java.io.PrintStream(baos)); + try { + val toolbox = cm.mkToolBox(frontEnd = mkConsoleFrontEnd(), options = "-deprecation") + toolbox.eval(reify{ + object Utils { + @deprecated("test", "2.10.0") + def foo { println("hello") } + } - //val toolbox = mkToolBox(frontEnd = mkConsoleFrontEnd(), options = "-deprecation") - //toolbox.runExpr(reify{ - // object Utils { - // @deprecated("test", "2.10.0") - // def foo { println("hello") } - // } - // - // Utils.foo - //}) + Utils.foo + }.tree) + println("============compiler console=============") + println(baos.toString); + println("=========================================") + println("============compiler messages============") + toolbox.frontEnd.infos.foreach(println(_)) + println("=========================================") + } finally { + Console.setErr(oldErr); + } }
\ No newline at end of file diff --git a/test/files/run/toolbox_default_reporter_is_silent.check b/test/files/run/toolbox_default_reporter_is_silent.check index ef0493b275..ce01362503 100644 --- a/test/files/run/toolbox_default_reporter_is_silent.check +++ b/test/files/run/toolbox_default_reporter_is_silent.check @@ -1 +1 @@ -hello
+hello diff --git a/test/files/run/toolbox_default_reporter_is_silent.scala b/test/files/run/toolbox_default_reporter_is_silent.scala index 5f3269b6fa..4bd7a646b0 100644 --- a/test/files/run/toolbox_default_reporter_is_silent.scala +++ b/test/files/run/toolbox_default_reporter_is_silent.scala @@ -5,7 +5,7 @@ import scala.tools.reflect.ToolBox object Test extends App { val toolbox = cm.mkToolBox() - toolbox.runExpr(reify{ + toolbox.eval(reify{ object Utils { @deprecated("test", "2.10.0") def foo { println("hello") } diff --git a/test/files/run/toolbox_silent_reporter.scala b/test/files/run/toolbox_silent_reporter.scala index 915734e6ad..03b1d6defa 100644 --- a/test/files/run/toolbox_silent_reporter.scala +++ b/test/files/run/toolbox_silent_reporter.scala @@ -1,11 +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.{ToolBox, mkSilentFrontEnd} object Test extends App { - val toolbox = cm.mkToolBox(options = "-deprecation") - toolbox.runExpr(reify{ + val toolbox = cm.mkToolBox(options = "-deprecation", frontEnd = mkSilentFrontEnd()) + toolbox.eval(reify{ object Utils { @deprecated("test", "2.10.0") def foo { println("hello") } diff --git a/test/files/run/toolbox_typecheck_implicitsdisabled.check b/test/files/run/toolbox_typecheck_implicitsdisabled.check index e2f2dbe4b9..db64e118ca 100644 --- a/test/files/run/toolbox_typecheck_implicitsdisabled.check +++ b/test/files/run/toolbox_typecheck_implicitsdisabled.check @@ -1,5 +1,5 @@ -{
- import scala.Predef._;
- scala.Predef.any2ArrowAssoc[Int](1).->[Int](2)
-}
-scala.tools.reflect.ToolBoxError: reflective typecheck has failed: value -> is not a member of Int
+{ + import scala.Predef._; + scala.Predef.any2ArrowAssoc[Int](1).->[Int](2) +} +scala.tools.reflect.ToolBoxError: reflective typecheck has failed: value -> is not a member of Int diff --git a/test/files/run/toolbox_typecheck_inferimplicitvalue.check b/test/files/run/toolbox_typecheck_inferimplicitvalue.check index 23ba536aff..ec17b4203b 100644 --- a/test/files/run/toolbox_typecheck_inferimplicitvalue.check +++ b/test/files/run/toolbox_typecheck_inferimplicitvalue.check @@ -1 +1 @@ -C.MC
+C.MC diff --git a/test/files/run/toolbox_typecheck_macrosdisabled.check b/test/files/run/toolbox_typecheck_macrosdisabled.check index 4d253f31fc..688f37927c 100644 --- a/test/files/run/toolbox_typecheck_macrosdisabled.check +++ b/test/files/run/toolbox_typecheck_macrosdisabled.check @@ -16,7 +16,7 @@ $treecreator1.super.<init>(); () }; - def apply[U <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Tree = { + def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Tree = { val $u: U = $m$untyped.universe; val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; $u.Literal.apply($u.Constant.apply(2)) @@ -29,7 +29,7 @@ $typecreator2.super.<init>(); () }; - def apply[U <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Type = { + def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Type = { val $u: U = $m$untyped.universe; val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; $u.ConstantType.apply($u.Constant.apply(2)) diff --git a/test/files/run/toolbox_typecheck_macrosdisabled2.check b/test/files/run/toolbox_typecheck_macrosdisabled2.check index 149c3def12..f5c9b6eeab 100644 --- a/test/files/run/toolbox_typecheck_macrosdisabled2.check +++ b/test/files/run/toolbox_typecheck_macrosdisabled2.check @@ -16,7 +16,7 @@ $treecreator1.super.<init>(); () }; - def apply[U <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Tree = { + def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Tree = { val $u: U = $m$untyped.universe; val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; $u.Apply.apply($u.Select.apply($u.Select.apply($u.build.Ident($m.staticPackage("scala")), $u.newTermName("Array")), $u.newTermName("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2)))) @@ -29,7 +29,7 @@ $typecreator2.super.<init>(); () }; - def apply[U <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Type = { + def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Type = { val $u: U = $m$untyped.universe; val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; $u.TypeRef.apply($u.ThisType.apply($m.staticPackage("scala").asModule.moduleClass), $m.staticClass("scala.Array"), scala.collection.immutable.List.apply[$u.Type]($m.staticClass("scala.Int").asType.toTypeConstructor)) diff --git a/test/files/run/typetags_core.check b/test/files/run/typetags_core.check index 8d20e099c4..980b4719bf 100644 --- a/test/files/run/typetags_core.check +++ b/test/files/run/typetags_core.check @@ -1,30 +1,30 @@ -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[AnyVal]
-true
-TypeTag[AnyRef]
-true
-TypeTag[java.lang.Object]
-true
-TypeTag[Null]
-true
-TypeTag[Nothing]
+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[AnyVal] +true +TypeTag[AnyRef] +true +TypeTag[java.lang.Object] +true +TypeTag[Null] +true +TypeTag[Nothing] diff --git a/test/files/run/typetags_serialize.check b/test/files/run/typetags_serialize.check index 1b898250fb..f79436ea5d 100644 --- a/test/files/run/typetags_serialize.check +++ b/test/files/run/typetags_serialize.check @@ -1,2 +1,2 @@ -java.io.NotSerializableException: scala.reflect.base.TypeTags$PredefTypeCreator
-java.io.NotSerializableException: Test$$typecreator1$1
+java.io.NotSerializableException: scala.reflect.api.TypeTags$PredefTypeCreator +java.io.NotSerializableException: Test$$typecreator1$1 diff --git a/test/files/run/typetags_serialize.scala b/test/files/run/typetags_serialize.scala index 3917b69a93..3c842e6cc9 100644 --- a/test/files/run/typetags_serialize.scala +++ b/test/files/run/typetags_serialize.scala @@ -1,5 +1,6 @@ import java.io._ import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} import scala.reflect.runtime.{currentMirror => cm} object Test extends App { @@ -13,7 +14,7 @@ object Test extends App { val fin = new ByteArrayInputStream(fout.toByteArray) val in = new ObjectInputStream(fin) - val retag = in.readObject().asInstanceOf[scala.reflect.basis.TypeTag[_]].in(cm) + val retag = in.readObject().asInstanceOf[ru.TypeTag[_]].in(cm) in.close() fin.close() diff --git a/test/files/run/typetags_without_scala_reflect_manifest_lookup.check b/test/files/run/typetags_without_scala_reflect_manifest_lookup.check new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/files/run/typetags_without_scala_reflect_manifest_lookup.check diff --git a/test/files/run/typetags_without_scala_reflect_manifest_lookup.scala b/test/files/run/typetags_without_scala_reflect_manifest_lookup.scala new file mode 100644 index 0000000000..6fd3d2dc2b --- /dev/null +++ b/test/files/run/typetags_without_scala_reflect_manifest_lookup.scala @@ -0,0 +1,29 @@ +import scala.tools.partest._ +import scala.tools.nsc.Settings + +object Test extends DirectTest { + override def extraSettings = "-cp " + sys.props("partest.lib") + " -d \"" + testOutput.path + "\"" + + def code = """ + object Test extends App { + // manifest lookup also involves type tag lookup + // because we support manifest <-> typetag convertability + // + // however when scala-reflect.jar (the home of type tags) is not on the classpath + // we need to omit the type tag lookup, because we lack the necessary symbols + // to do implicit search and tag materialization + // (such missing symbols are e.g. ApiUniverseClass and TypeTagsClass) + // + // the test case you're looking at checks exactly this + // we establish a classpath that only includes scala-library.jar + // and then force scalac to perform implicit search for a manifest + // if type tag lookup is not disabled, the compiler will crash + // if it is disabled, then the compilation will succeed + // http://groups.google.com/group/scala-internals/browse_thread/thread/166ce4b71b7c46bb + def foo[T: Manifest] = () + foo[List[Int]] + } + """ + + def show = compile() +}
\ No newline at end of file diff --git a/test/files/run/typetags_without_scala_reflect_typetag_lookup.check b/test/files/run/typetags_without_scala_reflect_typetag_lookup.check new file mode 100644 index 0000000000..53df68cfc2 --- /dev/null +++ b/test/files/run/typetags_without_scala_reflect_typetag_lookup.check @@ -0,0 +1,3 @@ +newSource1:9: error: could not find implicit value for evidence parameter of type reflect.runtime.package.universe.TypeTag[Int] + Library.foo[Int] + ^ diff --git a/test/files/run/typetags_without_scala_reflect_typetag_lookup.scala b/test/files/run/typetags_without_scala_reflect_typetag_lookup.scala new file mode 100644 index 0000000000..e51ecdb180 --- /dev/null +++ b/test/files/run/typetags_without_scala_reflect_typetag_lookup.scala @@ -0,0 +1,45 @@ +import scala.tools.partest._ + +object Test extends DirectTest { + def code = ??? + + def library = """ + import scala.reflect.runtime.universe._ + + object Library { + def foo[T: TypeTag] = () + } + """ + def compileLibrary() = { + val classpath = List(sys.props("partest.lib"), sys.props("partest.reflect")) mkString sys.props("path.separator") + compileString(newCompiler("-cp", classpath, "-d", testOutput.path))(library) + } + + def app = """ + object Test extends App { + // tries to materialize a type tag not having scala-reflect.jar on the classpath + // even though it's easy to materialize a type tag of Int, this line will fail + // because materialization involves classes from scala-reflect.jar + // + // in this test we make sure that the compiler doesn't crash + // but just displays several missing class file errors and an unavailable implicit message + Library.foo[Int] + } + """ + def compileApp() = { + val classpath = List(sys.props("partest.lib"), testOutput.path) mkString sys.props("path.separator") + compileString(newCompiler("-cp", classpath, "-d", testOutput.path))(app) + } + + def show(): Unit = { + val prevErr = System.err + val baos = new java.io.ByteArrayOutputStream(); + System.setErr(new java.io.PrintStream(baos)); + compileLibrary(); + compileApp(); + // we should get bad symbolic reference errors, because we're trying to call a method that can't be unpickled + // but we don't know the number of these errors and their order, so I just ignore them all + baos.toString.split("\n") filter (!_.startsWith("error: bad symbolic reference")) foreach println + System.setErr(prevErr) + } +}
\ No newline at end of file diff --git a/test/files/run/typetags_without_scala_reflect_typetag_manifest_interop.check b/test/files/run/typetags_without_scala_reflect_typetag_manifest_interop.check new file mode 100644 index 0000000000..729c0715df --- /dev/null +++ b/test/files/run/typetags_without_scala_reflect_typetag_manifest_interop.check @@ -0,0 +1,3 @@ +newSource1:9: error: No Manifest available for App.this.T. + manifest[T] + ^ diff --git a/test/files/run/typetags_without_scala_reflect_typetag_manifest_interop.scala b/test/files/run/typetags_without_scala_reflect_typetag_manifest_interop.scala new file mode 100644 index 0000000000..e984127583 --- /dev/null +++ b/test/files/run/typetags_without_scala_reflect_typetag_manifest_interop.scala @@ -0,0 +1,46 @@ +import scala.tools.partest._ + +object Test extends DirectTest { + def code = ??? + + def library = """ + import scala.reflect.runtime.universe._ + + trait Library { + type T + implicit val tt: TypeTag[T] + } + """ + def compileLibrary() = { + val classpath = List(sys.props("partest.lib"), sys.props("partest.reflect")) mkString sys.props("path.separator") + compileString(newCompiler("-cp", classpath, "-d", testOutput.path))(library) + } + + def app = """ + trait App extends Library { + // tries to create a manifest from a type tag without having scala-reflect.jar on the classpath + // even though it's possible to convert a type tag into a manifest, this will fail + // because conversion requires classes from scala-reflect.jar + // + // in this test we make sure that the compiler doesn't crash + // but just displays several missing class file errors and an unavailable implicit message + manifest[T] + } + """ + def compileApp() = { + val classpath = List(sys.props("partest.lib"), testOutput.path) mkString sys.props("path.separator") + compileString(newCompiler("-cp", classpath, "-d", testOutput.path))(app) + } + + def show(): Unit = { + val prevErr = System.err + val baos = new java.io.ByteArrayOutputStream(); + System.setErr(new java.io.PrintStream(baos)); + compileLibrary(); + compileApp(); + // we should get bad symbolic reference errors, because we're trying to use an implicit that can't be unpickled + // but we don't know the number of these errors and their order, so I just ignore them all + baos.toString.split("\n") filter (!_.startsWith("error: bad symbolic reference")) foreach println + System.setErr(prevErr) + } +}
\ No newline at end of file diff --git a/test/files/run/valueclasses-classmanifest-basic.check b/test/files/run/valueclasses-classmanifest-basic.check index 554c75e074..bc56c4d894 100644 --- a/test/files/run/valueclasses-classmanifest-basic.check +++ b/test/files/run/valueclasses-classmanifest-basic.check @@ -1 +1 @@ -Foo
+Foo diff --git a/test/files/run/valueclasses-classmanifest-existential.check b/test/files/run/valueclasses-classmanifest-existential.check index e9fc6e27ea..4577aacc0e 100644 --- a/test/files/run/valueclasses-classmanifest-existential.check +++ b/test/files/run/valueclasses-classmanifest-existential.check @@ -1 +1 @@ -Foo[<?>]
+Foo[<?>] diff --git a/test/files/run/valueclasses-classmanifest-generic.check b/test/files/run/valueclasses-classmanifest-generic.check index 1418c5cff9..c6be42d550 100644 --- a/test/files/run/valueclasses-classmanifest-generic.check +++ b/test/files/run/valueclasses-classmanifest-generic.check @@ -1 +1 @@ -Foo[java.lang.String]
+Foo[java.lang.String] diff --git a/test/files/run/valueclasses-classtag-basic.check b/test/files/run/valueclasses-classtag-basic.check index 554c75e074..bc56c4d894 100644 --- a/test/files/run/valueclasses-classtag-basic.check +++ b/test/files/run/valueclasses-classtag-basic.check @@ -1 +1 @@ -Foo
+Foo diff --git a/test/files/run/valueclasses-classtag-existential.check b/test/files/run/valueclasses-classtag-existential.check index 15ac02630f..9e2b9e1da7 100644 --- a/test/files/run/valueclasses-classtag-existential.check +++ b/test/files/run/valueclasses-classtag-existential.check @@ -1 +1 @@ -Object
+Object diff --git a/test/files/run/valueclasses-classtag-generic.check b/test/files/run/valueclasses-classtag-generic.check index 554c75e074..bc56c4d894 100644 --- a/test/files/run/valueclasses-classtag-generic.check +++ b/test/files/run/valueclasses-classtag-generic.check @@ -1 +1 @@ -Foo
+Foo diff --git a/test/files/run/valueclasses-manifest-basic.check b/test/files/run/valueclasses-manifest-basic.check index 554c75e074..bc56c4d894 100644 --- a/test/files/run/valueclasses-manifest-basic.check +++ b/test/files/run/valueclasses-manifest-basic.check @@ -1 +1 @@ -Foo
+Foo diff --git a/test/files/run/valueclasses-manifest-existential.check b/test/files/run/valueclasses-manifest-existential.check index fdce051039..f91a575ea7 100644 --- a/test/files/run/valueclasses-manifest-existential.check +++ b/test/files/run/valueclasses-manifest-existential.check @@ -1 +1 @@ -Foo[_ <: Any]
+Foo[_ <: Any] diff --git a/test/files/run/valueclasses-manifest-generic.check b/test/files/run/valueclasses-manifest-generic.check index 1418c5cff9..c6be42d550 100644 --- a/test/files/run/valueclasses-manifest-generic.check +++ b/test/files/run/valueclasses-manifest-generic.check @@ -1 +1 @@ -Foo[java.lang.String]
+Foo[java.lang.String] diff --git a/test/files/run/valueclasses-pavlov.check b/test/files/run/valueclasses-pavlov.check new file mode 100644 index 0000000000..b112e5507e --- /dev/null +++ b/test/files/run/valueclasses-pavlov.check @@ -0,0 +1,2 @@ +box1: ok +box2: ok diff --git a/test/files/run/valueclasses-pavlov.scala b/test/files/run/valueclasses-pavlov.scala new file mode 100644 index 0000000000..e73897f653 --- /dev/null +++ b/test/files/run/valueclasses-pavlov.scala @@ -0,0 +1,26 @@ +trait Foo extends Any { + def box1(x: Box1): String + def box2(x: Box2): String +} + +class Box1(val value: String) extends AnyVal + +class Box2(val value: String) extends AnyVal with Foo { + def box1(x: Box1) = "box1: ok" + def box2(x: Box2) = "box2: ok" +} + +class C(x: String) { + def this() = this("") +} + +object Test { + + def main(args: Array[String]) { + val b1 = new Box1("") + val b2 = new Box2("") + val f: Foo = b2 + println(f.box1(b1)) + println(f.box2(b2)) + } +} diff --git a/test/files/run/valueclasses-typetag-basic.check b/test/files/run/valueclasses-typetag-basic.check index 554c75e074..bc56c4d894 100644 --- a/test/files/run/valueclasses-typetag-basic.check +++ b/test/files/run/valueclasses-typetag-basic.check @@ -1 +1 @@ -Foo
+Foo diff --git a/test/files/run/valueclasses-typetag-existential.check b/test/files/run/valueclasses-typetag-existential.check index 0efa24a45f..d166a13fdc 100644 --- a/test/files/run/valueclasses-typetag-existential.check +++ b/test/files/run/valueclasses-typetag-existential.check @@ -1 +1 @@ -Foo[_]
+Foo[_] diff --git a/test/files/run/valueclasses-typetag-generic.check b/test/files/run/valueclasses-typetag-generic.check index fce2e64f79..534d1b37c4 100644 --- a/test/files/run/valueclasses-typetag-generic.check +++ b/test/files/run/valueclasses-typetag-generic.check @@ -1 +1 @@ -Foo[String]
+Foo[String] diff --git a/test/files/run/virtpatmat_typetag.check b/test/files/run/virtpatmat_typetag.check index eaa9f3361f..cac9d9a4d6 100644 --- a/test/files/run/virtpatmat_typetag.check +++ b/test/files/run/virtpatmat_typetag.check @@ -1,10 +1,10 @@ -1 is not a Int; it's a class java.lang.Integer
-1 is a java.lang.Integer
-1 is not a java.lang.String; it's a class java.lang.Integer
-true is a Any
-woele is a java.lang.String
-1 is not a Int; it's a class java.lang.Integer
-1 is a java.lang.Integer
-1 is not a java.lang.String; it's a class java.lang.Integer
-true is a Any
-woele is a java.lang.String
+1 is not a Int; it's a class java.lang.Integer +1 is a java.lang.Integer +1 is not a java.lang.String; it's a class java.lang.Integer +true is a Any +woele is a java.lang.String +1 is not a Int; it's a class java.lang.Integer +1 is a java.lang.Integer +1 is not a java.lang.String; it's a class java.lang.Integer +true is a Any +woele is a java.lang.String |