diff options
Diffstat (limited to 'test')
352 files changed, 3486 insertions, 949 deletions
diff --git a/test/ant/test-basic/build.xml b/test/ant/test-basic/build.xml new file mode 100644 index 0000000000..acc210806f --- /dev/null +++ b/test/ant/test-basic/build.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<project name="test-simple" default="compile"> + <description>Super simple test for Scala</description> + + <target name="init"> + <!-- Define project CLASSPATH. --> + <property name="base.dir" value="../../.."/> + <property name="pack.dir" value="${base.dir}/build/pack/"/> + <property name="build.dir" value="classes"/> + <property name="src.dir" value="src"/> + <property name="jvmargs" value=""/> + <path id="scala.classpath"> + <fileset dir="${pack.dir}/lib/"> <include name="*.jar" /> </fileset> + </path> + + <!-- Define scala compiler, scaladoc, etc command --> + <taskdef resource="scala/tools/ant/antlib.xml"> + <classpath refid="scala.classpath" /> + </taskdef> + </target> + + <target name="compile" depends="init"> + <mkdir dir="${build.dir}"/> + + <scalac srcdir="${src.dir}" destdir="${build.dir}" + classpathref="scala.classpath" fork="true" target="jvm-1.5" + deprecation="no" addparams="-no-specialization" + jvmargs="${jvmargs} -XX:+UseConcMarkSweepGC"> + <include name="**/*.scala"/> + </scalac> + </target> +</project> diff --git a/test/ant/test-basic/src/test-1.scala b/test/ant/test-basic/src/test-1.scala new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/ant/test-basic/src/test-1.scala diff --git a/test/files/buildmanager/t2650_3/t2650_3.check b/test/files/buildmanager/t2650_3/t2650_3.check index c109800d9c..5c6326d59f 100644 --- a/test/files/buildmanager/t2650_3/t2650_3.check +++ b/test/files/buildmanager/t2650_3/t2650_3.check @@ -10,6 +10,5 @@ B.scala:2: error: type mismatch; found : a.T (which expands to) Long required: Int - possible cause: missing arguments for method or constructor def x(a: A): Int = a.x ^ diff --git a/test/files/buildmanager/t2650_4/t2650_4.check b/test/files/buildmanager/t2650_4/t2650_4.check index 89536776bd..a4aeaddfbb 100644 --- a/test/files/buildmanager/t2650_4/t2650_4.check +++ b/test/files/buildmanager/t2650_4/t2650_4.check @@ -10,6 +10,5 @@ B.scala:2: error: type mismatch; found : a.T2 (which expands to) Long required: Int - possible cause: missing arguments for method or constructor def x(a: A): Int = a.x ^ diff --git a/test/files/jvm/duration-java.check b/test/files/jvm/duration-java.check new file mode 100644 index 0000000000..49d06fbe93 --- /dev/null +++ b/test/files/jvm/duration-java.check @@ -0,0 +1,364 @@ + 0.0 nanoseconds => 0 days + 1.0 nanoseconds => 1 nanosecond + 7.0 nanoseconds => 7 nanoseconds + 10.0 nanoseconds => 10 nanoseconds + 12.0 nanoseconds => 12 nanoseconds + 24.0 nanoseconds => 24 nanoseconds + 30.0 nanoseconds => 30 nanoseconds + 49.0 nanoseconds => 49 nanoseconds + 60.0 nanoseconds => 60 nanoseconds + 70.0 nanoseconds => 70 nanoseconds + 84.0 nanoseconds => 84 nanoseconds + 100.0 nanoseconds => 100 nanoseconds + 120.0 nanoseconds => 120 nanoseconds + 144.0 nanoseconds => 144 nanoseconds + 168.0 nanoseconds => 168 nanoseconds + 210.0 nanoseconds => 210 nanoseconds + 240.0 nanoseconds => 240 nanoseconds + 288.0 nanoseconds => 288 nanoseconds + 300.0 nanoseconds => 300 nanoseconds + 360.0 nanoseconds => 360 nanoseconds + 420.0 nanoseconds => 420 nanoseconds + 576.0 nanoseconds => 576 nanoseconds + 600.0 nanoseconds => 600 nanoseconds + 700.0 nanoseconds => 700 nanoseconds + 720.0 nanoseconds => 720 nanoseconds + 900.0 nanoseconds => 900 nanoseconds + 1000.0 nanoseconds => 1 microsecond + 1200.0 nanoseconds => 1200 nanoseconds + 1440.0 nanoseconds => 1440 nanoseconds + 1800.0 nanoseconds => 1800 nanoseconds + 2400.0 nanoseconds => 2400 nanoseconds + 3000.0 nanoseconds => 3 microseconds + 3600.0 nanoseconds => 3600 nanoseconds + 6000.0 nanoseconds => 6 microseconds + 7000.0 nanoseconds => 7 microseconds + 10000.0 nanoseconds => 10 microseconds + 12000.0 nanoseconds => 12 microseconds + 24000.0 nanoseconds => 24 microseconds + 30000.0 nanoseconds => 30 microseconds + 60000.0 nanoseconds => 60 microseconds + 100000.0 nanoseconds => 100 microseconds + 1000000.0 nanoseconds => 1 millisecond + 7000000.0 nanoseconds => 7 milliseconds + 1.0E7 nanoseconds => 10 milliseconds + 1.2E7 nanoseconds => 12 milliseconds + 2.4E7 nanoseconds => 24 milliseconds + 3.0E7 nanoseconds => 30 milliseconds + 6.0E7 nanoseconds => 60 milliseconds + 1.0E8 nanoseconds => 100 milliseconds + 1.0E9 nanoseconds => 1 second + 1.0E12 nanoseconds => 1000 seconds + 0.0 microseconds => 0 days + 1.0 microseconds => 1 microsecond + 7.0 microseconds => 7 microseconds + 10.0 microseconds => 10 microseconds + 12.0 microseconds => 12 microseconds + 24.0 microseconds => 24 microseconds + 30.0 microseconds => 30 microseconds + 49.0 microseconds => 49 microseconds + 60.0 microseconds => 60 microseconds + 70.0 microseconds => 70 microseconds + 84.0 microseconds => 84 microseconds + 100.0 microseconds => 100 microseconds + 120.0 microseconds => 120 microseconds + 144.0 microseconds => 144 microseconds + 168.0 microseconds => 168 microseconds + 210.0 microseconds => 210 microseconds + 240.0 microseconds => 240 microseconds + 288.0 microseconds => 288 microseconds + 300.0 microseconds => 300 microseconds + 360.0 microseconds => 360 microseconds + 420.0 microseconds => 420 microseconds + 576.0 microseconds => 576 microseconds + 600.0 microseconds => 600 microseconds + 700.0 microseconds => 700 microseconds + 720.0 microseconds => 720 microseconds + 900.0 microseconds => 900 microseconds + 1000.0 microseconds => 1 millisecond + 1200.0 microseconds => 1200 microseconds + 1440.0 microseconds => 1440 microseconds + 1800.0 microseconds => 1800 microseconds + 2400.0 microseconds => 2400 microseconds + 3000.0 microseconds => 3 milliseconds + 3600.0 microseconds => 3600 microseconds + 6000.0 microseconds => 6 milliseconds + 7000.0 microseconds => 7 milliseconds + 10000.0 microseconds => 10 milliseconds + 12000.0 microseconds => 12 milliseconds + 24000.0 microseconds => 24 milliseconds + 30000.0 microseconds => 30 milliseconds + 60000.0 microseconds => 60 milliseconds + 100000.0 microseconds => 100 milliseconds + 1000000.0 microseconds => 1 second + 7000000.0 microseconds => 7 seconds + 1.0E7 microseconds => 10 seconds + 1.2E7 microseconds => 12 seconds + 2.4E7 microseconds => 24 seconds + 3.0E7 microseconds => 30 seconds + 6.0E7 microseconds => 1 minute + 1.0E8 microseconds => 100 seconds + 1.0E9 microseconds => 1000 seconds + 1.0E12 microseconds => 1000000 seconds + 0.0 milliseconds => 0 days + 1.0 milliseconds => 1 millisecond + 7.0 milliseconds => 7 milliseconds + 10.0 milliseconds => 10 milliseconds + 12.0 milliseconds => 12 milliseconds + 24.0 milliseconds => 24 milliseconds + 30.0 milliseconds => 30 milliseconds + 49.0 milliseconds => 49 milliseconds + 60.0 milliseconds => 60 milliseconds + 70.0 milliseconds => 70 milliseconds + 84.0 milliseconds => 84 milliseconds + 100.0 milliseconds => 100 milliseconds + 120.0 milliseconds => 120 milliseconds + 144.0 milliseconds => 144 milliseconds + 168.0 milliseconds => 168 milliseconds + 210.0 milliseconds => 210 milliseconds + 240.0 milliseconds => 240 milliseconds + 288.0 milliseconds => 288 milliseconds + 300.0 milliseconds => 300 milliseconds + 360.0 milliseconds => 360 milliseconds + 420.0 milliseconds => 420 milliseconds + 576.0 milliseconds => 576 milliseconds + 600.0 milliseconds => 600 milliseconds + 700.0 milliseconds => 700 milliseconds + 720.0 milliseconds => 720 milliseconds + 900.0 milliseconds => 900 milliseconds + 1000.0 milliseconds => 1 second + 1200.0 milliseconds => 1200 milliseconds + 1440.0 milliseconds => 1440 milliseconds + 1800.0 milliseconds => 1800 milliseconds + 2400.0 milliseconds => 2400 milliseconds + 3000.0 milliseconds => 3 seconds + 3600.0 milliseconds => 3600 milliseconds + 6000.0 milliseconds => 6 seconds + 7000.0 milliseconds => 7 seconds + 10000.0 milliseconds => 10 seconds + 12000.0 milliseconds => 12 seconds + 24000.0 milliseconds => 24 seconds + 30000.0 milliseconds => 30 seconds + 60000.0 milliseconds => 1 minute + 100000.0 milliseconds => 100 seconds + 1000000.0 milliseconds => 1000 seconds + 7000000.0 milliseconds => 7000 seconds + 1.0E7 milliseconds => 10000 seconds + 1.2E7 milliseconds => 200 minutes + 2.4E7 milliseconds => 400 minutes + 3.0E7 milliseconds => 500 minutes + 6.0E7 milliseconds => 1000 minutes + 1.0E8 milliseconds => 100000 seconds + 1.0E9 milliseconds => 1000000 seconds + 1.0E12 milliseconds => 1000000000 seconds + 0.0 seconds => 0 days + 1.0 seconds => 1 second + 7.0 seconds => 7 seconds + 10.0 seconds => 10 seconds + 12.0 seconds => 12 seconds + 24.0 seconds => 24 seconds + 30.0 seconds => 30 seconds + 49.0 seconds => 49 seconds + 60.0 seconds => 1 minute + 70.0 seconds => 70 seconds + 84.0 seconds => 84 seconds + 100.0 seconds => 100 seconds + 120.0 seconds => 2 minutes + 144.0 seconds => 144 seconds + 168.0 seconds => 168 seconds + 210.0 seconds => 210 seconds + 240.0 seconds => 4 minutes + 288.0 seconds => 288 seconds + 300.0 seconds => 5 minutes + 360.0 seconds => 6 minutes + 420.0 seconds => 7 minutes + 576.0 seconds => 576 seconds + 600.0 seconds => 10 minutes + 700.0 seconds => 700 seconds + 720.0 seconds => 12 minutes + 900.0 seconds => 15 minutes + 1000.0 seconds => 1000 seconds + 1200.0 seconds => 20 minutes + 1440.0 seconds => 24 minutes + 1800.0 seconds => 30 minutes + 2400.0 seconds => 40 minutes + 3000.0 seconds => 50 minutes + 3600.0 seconds => 1 hour + 6000.0 seconds => 100 minutes + 7000.0 seconds => 7000 seconds + 10000.0 seconds => 10000 seconds + 12000.0 seconds => 200 minutes + 24000.0 seconds => 400 minutes + 30000.0 seconds => 500 minutes + 60000.0 seconds => 1000 minutes + 100000.0 seconds => 100000 seconds + 1000000.0 seconds => 1000000 seconds + 7000000.0 seconds => 7000000 seconds + 1.0E7 seconds => 10000000 seconds + 1.2E7 seconds => 200000 minutes + 2.4E7 seconds => 400000 minutes + 3.0E7 seconds => 500000 minutes + 6.0E7 seconds => 1000000 minutes + 1.0E8 seconds => 100000000 seconds + 1.0E9 seconds => 1000000000 seconds + 1.0E12 seconds => class java.lang.IllegalArgumentException + 0.0 minutes => 0 days + 1.0 minutes => 1 minute + 7.0 minutes => 7 minutes + 10.0 minutes => 10 minutes + 12.0 minutes => 12 minutes + 24.0 minutes => 24 minutes + 30.0 minutes => 30 minutes + 49.0 minutes => 49 minutes + 60.0 minutes => 1 hour + 70.0 minutes => 70 minutes + 84.0 minutes => 84 minutes + 100.0 minutes => 100 minutes + 120.0 minutes => 2 hours + 144.0 minutes => 144 minutes + 168.0 minutes => 168 minutes + 210.0 minutes => 210 minutes + 240.0 minutes => 4 hours + 288.0 minutes => 288 minutes + 300.0 minutes => 5 hours + 360.0 minutes => 6 hours + 420.0 minutes => 7 hours + 576.0 minutes => 576 minutes + 600.0 minutes => 10 hours + 700.0 minutes => 700 minutes + 720.0 minutes => 12 hours + 900.0 minutes => 15 hours + 1000.0 minutes => 1000 minutes + 1200.0 minutes => 20 hours + 1440.0 minutes => 1 day + 1800.0 minutes => 30 hours + 2400.0 minutes => 40 hours + 3000.0 minutes => 50 hours + 3600.0 minutes => 60 hours + 6000.0 minutes => 100 hours + 7000.0 minutes => 7000 minutes + 10000.0 minutes => 10000 minutes + 12000.0 minutes => 200 hours + 24000.0 minutes => 400 hours + 30000.0 minutes => 500 hours + 60000.0 minutes => 1000 hours + 100000.0 minutes => 100000 minutes + 1000000.0 minutes => 1000000 minutes + 7000000.0 minutes => 7000000 minutes + 1.0E7 minutes => 10000000 minutes + 1.2E7 minutes => 200000 hours + 2.4E7 minutes => 400000 hours + 3.0E7 minutes => 500000 hours + 6.0E7 minutes => 1000000 hours + 1.0E8 minutes => 100000000 minutes + 1.0E9 minutes => class java.lang.IllegalArgumentException + 1.0E12 minutes => class java.lang.IllegalArgumentException + 0.0 hours => 0 days + 1.0 hours => 1 hour + 7.0 hours => 7 hours + 10.0 hours => 10 hours + 12.0 hours => 12 hours + 24.0 hours => 1 day + 30.0 hours => 30 hours + 49.0 hours => 49 hours + 60.0 hours => 60 hours + 70.0 hours => 70 hours + 84.0 hours => 84 hours + 100.0 hours => 100 hours + 120.0 hours => 5 days + 144.0 hours => 6 days + 168.0 hours => 7 days + 210.0 hours => 210 hours + 240.0 hours => 10 days + 288.0 hours => 12 days + 300.0 hours => 300 hours + 360.0 hours => 15 days + 420.0 hours => 420 hours + 576.0 hours => 24 days + 600.0 hours => 25 days + 700.0 hours => 700 hours + 720.0 hours => 30 days + 900.0 hours => 900 hours + 1000.0 hours => 1000 hours + 1200.0 hours => 50 days + 1440.0 hours => 60 days + 1800.0 hours => 75 days + 2400.0 hours => 100 days + 3000.0 hours => 125 days + 3600.0 hours => 150 days + 6000.0 hours => 250 days + 7000.0 hours => 7000 hours + 10000.0 hours => 10000 hours + 12000.0 hours => 500 days + 24000.0 hours => 1000 days + 30000.0 hours => 1250 days + 60000.0 hours => 2500 days + 100000.0 hours => 100000 hours + 1000000.0 hours => 1000000 hours + 7000000.0 hours => class java.lang.IllegalArgumentException + 1.0E7 hours => class java.lang.IllegalArgumentException + 1.2E7 hours => class java.lang.IllegalArgumentException + 2.4E7 hours => class java.lang.IllegalArgumentException + 3.0E7 hours => class java.lang.IllegalArgumentException + 6.0E7 hours => class java.lang.IllegalArgumentException + 1.0E8 hours => class java.lang.IllegalArgumentException + 1.0E9 hours => class java.lang.IllegalArgumentException + 1.0E12 hours => class java.lang.IllegalArgumentException + 0.0 days => 0 days + 1.0 days => 1 day + 7.0 days => 7 days + 10.0 days => 10 days + 12.0 days => 12 days + 24.0 days => 24 days + 30.0 days => 30 days + 49.0 days => 49 days + 60.0 days => 60 days + 70.0 days => 70 days + 84.0 days => 84 days + 100.0 days => 100 days + 120.0 days => 120 days + 144.0 days => 144 days + 168.0 days => 168 days + 210.0 days => 210 days + 240.0 days => 240 days + 288.0 days => 288 days + 300.0 days => 300 days + 360.0 days => 360 days + 420.0 days => 420 days + 576.0 days => 576 days + 600.0 days => 600 days + 700.0 days => 700 days + 720.0 days => 720 days + 900.0 days => 900 days + 1000.0 days => 1000 days + 1200.0 days => 1200 days + 1440.0 days => 1440 days + 1800.0 days => 1800 days + 2400.0 days => 2400 days + 3000.0 days => 3000 days + 3600.0 days => 3600 days + 6000.0 days => 6000 days + 7000.0 days => 7000 days + 10000.0 days => 10000 days + 12000.0 days => 12000 days + 24000.0 days => 24000 days + 30000.0 days => 30000 days + 60000.0 days => 60000 days + 100000.0 days => 100000 days + 1000000.0 days => class java.lang.IllegalArgumentException + 7000000.0 days => class java.lang.IllegalArgumentException + 1.0E7 days => class java.lang.IllegalArgumentException + 1.2E7 days => class java.lang.IllegalArgumentException + 2.4E7 days => class java.lang.IllegalArgumentException + 3.0E7 days => class java.lang.IllegalArgumentException + 6.0E7 days => class java.lang.IllegalArgumentException + 1.0E8 days => class java.lang.IllegalArgumentException + 1.0E9 days => class java.lang.IllegalArgumentException + 1.0E12 days => class java.lang.IllegalArgumentException +10000000000000001 nanoseconds => 10000000000000001 nanoseconds +10000000000000002 nanoseconds => 10000000000000002 nanoseconds + Inf => Duration.Inf + -Inf => Duration.MinusInf + +Inf => Duration.Inf + PlusInf => Duration.Inf + MinusInf => Duration.MinusInf diff --git a/test/files/jvm/duration-java/Test.java b/test/files/jvm/duration-java/Test.java new file mode 100644 index 0000000000..1c53ccb266 --- /dev/null +++ b/test/files/jvm/duration-java/Test.java @@ -0,0 +1,46 @@ +import scala.concurrent.util.Duration; +import java.util.*; +import java.util.concurrent.TimeUnit; +import static java.util.concurrent.TimeUnit.*; + +public class Test { + public static List<Double> inputs = Arrays.asList(0d, 1d, 7d, 10d, 12d, 24d, 30d, 60d, 100d, 1000d, 1e6); + public static List<Double> makeNumbers() { + ArrayList<Double> xs = new ArrayList<Double>(); + for (Double n1: inputs) { + for (Double n2: inputs) { + Double n = n1 * n2; + if (!xs.contains(n)) + xs.add(n); + } + } + Double[] arr = xs.toArray(new Double[0]); + Arrays.sort(arr); + return Arrays.asList(arr); + } + + public static void p(Object x) { + System.out.println(x); + } + public static void main(String[] args) { + for (TimeUnit t : TimeUnit.values()) { + for (Double n: makeNumbers()) { + String s = "" + n + " " + t.toString().toLowerCase(); + String result; + try { + Duration d = Duration.create(n, t); + result = d.toString(); + } catch(Exception e) { + result = e.getClass().toString(); + } + p(String.format("%25s => %s", s, result)); + } + } + for (String s: new String[] {"10000000000000001 nanoseconds", "10000000000000002 nanoseconds"}) + p(String.format("%25s => %s", s, Duration.create(s))); + for (String s: Arrays.asList("Inf", "-Inf", "+Inf", "PlusInf", "MinusInf")) { + Duration d = Duration.create(s); + p(String.format("%25s => %s", s, d)); + } + } +} diff --git a/test/files/jvm/duration-tck.scala b/test/files/jvm/duration-tck.scala new file mode 100644 index 0000000000..0947e84004 --- /dev/null +++ b/test/files/jvm/duration-tck.scala @@ -0,0 +1,186 @@ +/** + * Copyright (C) 2012 Typesafe Inc. <http://www.typesafe.com> + */ + +import scala.concurrent.util._ +import duration._ +import scala.reflect._ +import java.util.concurrent.TimeUnit._ +import scala.tools.partest.TestUtil.intercept + +object Test extends App { + + implicit class Assert(val left: Any) extends AnyVal { + import Duration.Undefined + def mustBe(right: Any) = right match { + case r: Double if r.isNaN => assert(left.asInstanceOf[Double].isNaN, s"$left was not NaN") + case r: Double if r == 0 && r.compareTo(0) == -1 => assert(left == 0 && left.asInstanceOf[Double].compareTo(0) == -1, s"$left was not -0.0") + case Undefined => assert(left.asInstanceOf[AnyRef] eq Undefined, s"$left was not Undefined") + case _ => assert(left == right, s"$left was not equal to $right") + } + } + + val zero = 0 seconds + val one = 1 second + val two = one + one + val three = 3 * one + val inf = Duration.Inf + val minf = Duration.MinusInf + val undef = Duration.Undefined + val inputs = List(zero, one, inf, minf, undef) + val nan = Double.NaN + + // test field ops + one.isFinite mustBe true + 0 * one mustBe zero + 2 * one mustBe two + three - two mustBe one + three / 3 mustBe one + two / one mustBe 2 + one + zero mustBe one + one / 1000000 mustBe 1.micro + + + // test infinities + + inf.isFinite mustBe false + minf.isFinite mustBe false + + inf mustBe inf + minf mustBe minf + -inf mustBe minf + -minf mustBe inf + + minf + inf mustBe undef + inf - inf mustBe undef + inf + minf mustBe undef + minf - minf mustBe undef + + inf + inf mustBe inf + inf - minf mustBe inf + minf - inf mustBe minf + minf + minf mustBe minf + + inf.compareTo(inf) mustBe 0 + inf.compareTo(one) mustBe 1 + inf.compareTo(minf) mustBe 1 + minf.compareTo(minf) mustBe 0 + minf.compareTo(one) mustBe -1 + minf.compareTo(inf) mustBe -1 + + assert(inf != minf) + assert(minf != inf) + assert(one != inf) + assert(minf != one) + + inf mustBe (minf * -1d) + inf mustBe (minf / -1d) + + one / inf mustBe 0d + -one / inf mustBe -0d + one / minf mustBe -0d + -one / minf mustBe 0d + + inputs filterNot (_.isFinite) foreach (x => x / zero mustBe x.toUnit(DAYS)) + inputs filterNot (_.isFinite) foreach (_ * 0d mustBe undef) + inputs filterNot (_.isFinite) foreach (_ * -0d mustBe undef) + inputs filterNot (_.isFinite) foreach (x => x * Double.PositiveInfinity mustBe x) + inputs filterNot (_.isFinite) foreach (x => x * Double.NegativeInfinity mustBe -x) + + inf.toUnit(SECONDS) mustBe Double.PositiveInfinity + minf.toUnit(MINUTES) mustBe Double.NegativeInfinity + Duration.fromNanos(Double.PositiveInfinity) mustBe inf + Duration.fromNanos(Double.NegativeInfinity) mustBe minf + + + // test undefined & NaN + + undef.isFinite mustBe false + -undef mustBe undef + assert(undef != undef) + assert(undef eq undef) + + inputs foreach (_ + undef mustBe undef) + inputs foreach (_ - undef mustBe undef) + inputs foreach (_ / undef mustBe nan) + inputs foreach (_ / nan mustBe undef) + inputs foreach (_ * nan mustBe undef) + inputs foreach (undef + _ mustBe undef) + inputs foreach (undef - _ mustBe undef) + inputs foreach (undef / _ mustBe nan) + undef / 1 mustBe undef + undef / nan mustBe undef + undef * 1 mustBe undef + undef * nan mustBe undef + inputs foreach (x => x / zero mustBe x.toUnit(SECONDS) / 0d) + inputs foreach (x => x / 0d mustBe Duration.fromNanos(x.toUnit(NANOSECONDS) / 0d)) + inputs foreach (x => x / -0d mustBe Duration.fromNanos(x.toUnit(NANOSECONDS) / -0d)) + + inputs filterNot (_ eq undef) foreach (_ compareTo undef mustBe -1) + inputs filterNot (_ eq undef) foreach (undef compareTo _ mustBe 1) + undef compare undef mustBe 0 + + undef.toUnit(DAYS) mustBe nan + Duration.fromNanos(nan) mustBe undef + + + // test overflow protection + for (unit ← Seq(DAYS, HOURS, MINUTES, SECONDS, MILLISECONDS, MICROSECONDS, NANOSECONDS)) { + val x = unit.convert(Long.MaxValue, NANOSECONDS) + val dur = Duration(x, unit) + val mdur = Duration(-x, unit) + -mdur mustBe (dur) + intercept[IllegalArgumentException] { Duration(x + 10000000d, unit) } + intercept[IllegalArgumentException] { Duration(-x - 10000000d, unit) } + if (unit != NANOSECONDS) { + intercept[IllegalArgumentException] { Duration(x + 1, unit) } + intercept[IllegalArgumentException] { Duration(-x - 1, unit) } + } + intercept[IllegalArgumentException] { dur + 1.day } + intercept[IllegalArgumentException] { mdur - 1.day } + intercept[IllegalArgumentException] { dur * 1.1 } + intercept[IllegalArgumentException] { mdur * 1.1 } + intercept[IllegalArgumentException] { dur * 2.1 } + intercept[IllegalArgumentException] { mdur * 2.1 } + intercept[IllegalArgumentException] { dur / 0.9 } + intercept[IllegalArgumentException] { mdur / 0.9 } + intercept[IllegalArgumentException] { dur / 0.4 } + intercept[IllegalArgumentException] { mdur / 0.4 } + Duration(x + unit.toString.toLowerCase) + Duration("-" + x + unit.toString.toLowerCase) + intercept[IllegalArgumentException] { Duration("%.0f".format(x + 10000000d) + unit.toString.toLowerCase) } + intercept[IllegalArgumentException] { Duration("-%.0f".format(x + 10000000d) + unit.toString.toLowerCase) } + } + intercept[IllegalArgumentException] { Duration.fromNanos(1e20) } + intercept[IllegalArgumentException] { Duration.fromNanos(-1e20) } + + + // test precision + 1.second + 1.millisecond mustBe 1001.milliseconds + 100000.days + 1.nanosecond mustBe 8640000000000000001L.nanoseconds + 1.5.seconds.toSeconds mustBe 1 + (-1.5).seconds.toSeconds mustBe -1 + + + // test unit stability + 1000.millis.unit mustBe MILLISECONDS + (1000.millis + 0.days).unit mustBe MILLISECONDS + 1.second.unit mustBe SECONDS + (1.second + 1.millisecond).unit mustBe MILLISECONDS + + + // test Deadline + val dead = 2.seconds.fromNow + val dead2 = 2 seconds fromNow + assert(dead.timeLeft > 1.second) + assert(dead2.timeLeft > 1.second) + Thread.sleep(1.second.toMillis) + assert(dead.timeLeft < 1.second) + assert(dead2.timeLeft < 1.second) + + + // check statically retaining finite-ness + val finiteDuration: FiniteDuration = 1.second plus 3.seconds minus 1.millisecond min 1.second max 1.second + + +} diff --git a/test/files/jvm/future-spec/TryTests.scala b/test/files/jvm/future-spec/TryTests.scala index 82ca12276f..5d1b9b84b4 100644 --- a/test/files/jvm/future-spec/TryTests.scala +++ b/test/files/jvm/future-spec/TryTests.scala @@ -46,6 +46,12 @@ object TryTests extends MinimalScalaTest { val e2 = new Exception Failure[Int](e) map(_ => throw e2) mustEqual Failure(e) } + "when there is a fatal exception" in { + val e3 = new ThreadDeath + intercept[ThreadDeath] { + Success(1) map (_ => throw e3) + } + } } "flatMap" in { @@ -60,6 +66,12 @@ object TryTests extends MinimalScalaTest { val e2 = new Exception Failure[Int](e).flatMap[Int](_ => throw e2) mustEqual Failure(e) } + "when there is a fatal exception" in { + val e3 = new ThreadDeath + intercept[ThreadDeath] { + Success(1).flatMap[Int](_ => throw e3) + } + } } "flatten" in { @@ -115,4 +127,4 @@ object TryTests extends MinimalScalaTest { } } } -}
\ No newline at end of file +} diff --git a/test/files/jvm/manifests-new.scala b/test/files/jvm/manifests-new.scala index 8706881640..f730be67bb 100644 --- a/test/files/jvm/manifests-new.scala +++ b/test/files/jvm/manifests-new.scala @@ -106,6 +106,6 @@ trait TestUtil { // val t1: TypeTag[T] = read(write(t)) val t1: TypeTag[T] = t val x1 = x.toString.replaceAll("@[0-9a-z]+$", "") - println("x="+x1+", t="+t1+", k="+t1.tpe.kind+", s="+t1.tpe.typeSymbol.toString) + println("x="+x1+", t="+t1+", k="+t1.tpe.asInstanceOf[Product].productPrefix+", s="+t1.tpe.typeSymbol.toString) } }
\ No newline at end of file diff --git a/test/files/jvm/scala-concurrent-tck.scala b/test/files/jvm/scala-concurrent-tck.scala index ffb5608fd2..0e76b711de 100644 --- a/test/files/jvm/scala-concurrent-tck.scala +++ b/test/files/jvm/scala-concurrent-tck.scala @@ -11,6 +11,8 @@ import scala.concurrent.{ import scala.concurrent.{ future, promise, blocking } import scala.util.{ Try, Success, Failure } import scala.concurrent.util.Duration +import scala.reflect.{ classTag, ClassTag } +import scala.tools.partest.TestUtil.intercept trait TestBase { @@ -19,7 +21,7 @@ trait TestBase { body(() => sv put true) sv.take(2000) } - + // def assert(cond: => Boolean) { // try { // Predef.assert(cond) @@ -663,6 +665,29 @@ trait FutureProjections extends TestBase { case nsee: NoSuchElementException => done() } } + + def testAwaitPositiveDuration(): Unit = once { done => + val p = Promise[Int]() + val f = p.future + future { + intercept[IllegalArgumentException] { Await.ready(f, Duration.Undefined) } + p.success(0) + Await.ready(f, Duration.Zero) + Await.ready(f, Duration(500, "ms")) + Await.ready(f, Duration.Inf) + done() + } onFailure { case x => throw x } + } + + def testAwaitNegativeDuration(): Unit = once { done => + val f = Promise().future + future { + intercept[TimeoutException] { Await.ready(f, Duration.Zero) } + intercept[TimeoutException] { Await.ready(f, Duration.MinusInf) } + intercept[TimeoutException] { Await.ready(f, Duration(-500, "ms")) } + done() + } onFailure { case x => throw x } + } testFailedFailureOnComplete() testFailedFailureOnSuccess() @@ -670,6 +695,8 @@ trait FutureProjections extends TestBase { testFailedSuccessOnFailure() testFailedFailureAwait() testFailedSuccessAwait() + testAwaitPositiveDuration() + testAwaitNegativeDuration() } diff --git a/test/files/jvm/serialization-new.check b/test/files/jvm/serialization-new.check index fa51c6a879..f886cfe29c 100644 --- a/test/files/jvm/serialization-new.check +++ b/test/files/jvm/serialization-new.check @@ -168,6 +168,30 @@ x = History() y = History() x equals y: true, y equals x: true +x = Map(Linked -> 1, Hash -> 2, Map -> 3) +y = Map(Linked -> 1, Hash -> 2, Map -> 3) +x equals y: true, y equals x: true + +x = ArrayBuffer((Linked,1), (Hash,2), (Map,3)) +y = ArrayBuffer((Linked,1), (Hash,2), (Map,3)) +x equals y: true, y equals x: true + +x = ArrayBuffer((Linked,1), (Hash,2), (Map,3)) +y = List((Linked,1), (Hash,2), (Map,3)) +x equals y: true, y equals x: true + +x = Set(layers, buffers, title) +y = Set(layers, buffers, title) +x equals y: true, y equals x: true + +x = ArrayBuffer(layers, buffers, title) +y = ArrayBuffer(layers, buffers, title) +x equals y: true, y equals x: true + +x = ArrayBuffer(layers, buffers, title) +y = List(layers, buffers, title) +x equals y: true, y equals x: true + x = ListBuffer(white, black) y = ListBuffer(white, black) x equals y: true, y equals x: true diff --git a/test/files/jvm/serialization-new.scala b/test/files/jvm/serialization-new.scala index 91eb52928f..1522fc8e27 100644 --- a/test/files/jvm/serialization-new.scala +++ b/test/files/jvm/serialization-new.scala @@ -285,8 +285,8 @@ object Test3_mutable { import scala.reflect.ClassTag import scala.collection.mutable.{ ArrayBuffer, ArrayBuilder, ArraySeq, ArrayStack, BitSet, DoubleLinkedList, - HashMap, HashSet, History, LinkedList, ListBuffer, Publisher, Queue, - Stack, StringBuilder, WrappedArray, TreeSet} + HashMap, HashSet, History, LinkedHashMap, LinkedHashSet, LinkedList, ListBuffer, + Publisher, Queue, Stack, StringBuilder, WrappedArray, TreeSet} import scala.collection.concurrent.TrieMap // in alphabetic order @@ -346,6 +346,26 @@ object Test3_mutable { val h1 = new History[String, Int] val _h1: History[String, Int] = read(write(h1)) check(h1, _h1) + + // LinkedHashMap + { val lhm1 = new LinkedHashMap[String, Int] + val list = List(("Linked", 1), ("Hash", 2), ("Map", 3)) + lhm1 ++= list.iterator + val _lhm1: LinkedHashMap[String, Int] = read(write(lhm1)) + check(lhm1, _lhm1) + check(lhm1.toSeq, _lhm1.toSeq) // check elements order + check(lhm1.toSeq, list) // check elements order + } + + // LinkedHashSet + { val lhs1 = new LinkedHashSet[String] + val list = List("layers", "buffers", "title") + lhs1 ++= list.iterator + val _lhs1: LinkedHashSet[String] = read(write(lhs1)) + check(lhs1, _lhs1) + check(lhs1.toSeq, _lhs1.toSeq) // check elements order + check(lhs1.toSeq, list) // check elements order + } /* // LinkedList val ll1 = new LinkedList[Int](2, null) diff --git a/test/files/jvm/serialization.check b/test/files/jvm/serialization.check index fa51c6a879..f886cfe29c 100644 --- a/test/files/jvm/serialization.check +++ b/test/files/jvm/serialization.check @@ -168,6 +168,30 @@ x = History() y = History() x equals y: true, y equals x: true +x = Map(Linked -> 1, Hash -> 2, Map -> 3) +y = Map(Linked -> 1, Hash -> 2, Map -> 3) +x equals y: true, y equals x: true + +x = ArrayBuffer((Linked,1), (Hash,2), (Map,3)) +y = ArrayBuffer((Linked,1), (Hash,2), (Map,3)) +x equals y: true, y equals x: true + +x = ArrayBuffer((Linked,1), (Hash,2), (Map,3)) +y = List((Linked,1), (Hash,2), (Map,3)) +x equals y: true, y equals x: true + +x = Set(layers, buffers, title) +y = Set(layers, buffers, title) +x equals y: true, y equals x: true + +x = ArrayBuffer(layers, buffers, title) +y = ArrayBuffer(layers, buffers, title) +x equals y: true, y equals x: true + +x = ArrayBuffer(layers, buffers, title) +y = List(layers, buffers, title) +x equals y: true, y equals x: true + x = ListBuffer(white, black) y = ListBuffer(white, black) x equals y: true, y equals x: true diff --git a/test/files/jvm/serialization.scala b/test/files/jvm/serialization.scala index 9c2f2acdbf..34b64938b4 100644 --- a/test/files/jvm/serialization.scala +++ b/test/files/jvm/serialization.scala @@ -285,8 +285,8 @@ object Test3_mutable { import scala.reflect.ClassManifest import scala.collection.mutable.{ ArrayBuffer, ArrayBuilder, ArraySeq, ArrayStack, BitSet, DoubleLinkedList, - HashMap, HashSet, History, LinkedList, ListBuffer, Publisher, Queue, - Stack, StringBuilder, WrappedArray, TreeSet} + HashMap, HashSet, History, LinkedHashMap, LinkedHashSet, LinkedList, ListBuffer, + Publisher, Queue, Stack, StringBuilder, WrappedArray, TreeSet} import scala.collection.concurrent.TrieMap // in alphabetic order @@ -346,6 +346,26 @@ object Test3_mutable { val h1 = new History[String, Int] val _h1: History[String, Int] = read(write(h1)) check(h1, _h1) + + // LinkedHashMap + { val lhm1 = new LinkedHashMap[String, Int] + val list = List(("Linked", 1), ("Hash", 2), ("Map", 3)) + lhm1 ++= list.iterator + val _lhm1: LinkedHashMap[String, Int] = read(write(lhm1)) + check(lhm1, _lhm1) + check(lhm1.toSeq, _lhm1.toSeq) // check elements order + check(lhm1.toSeq, list) // check elements order + } + + // LinkedHashSet + { val lhs1 = new LinkedHashSet[String] + val list = List("layers", "buffers", "title") + lhs1 ++= list.iterator + val _lhs1: LinkedHashSet[String] = read(write(lhs1)) + check(lhs1, _lhs1) + check(lhs1.toSeq, _lhs1.toSeq) // check elements order + check(lhs1.toSeq, list) // check elements order + } /* // LinkedList val ll1 = new LinkedList[Int](2, null) diff --git a/test/files/lib/javac-artifacts.jar.desired.sha1 b/test/files/lib/javac-artifacts.jar.desired.sha1 new file mode 100644 index 0000000000..8dbbc1d451 --- /dev/null +++ b/test/files/lib/javac-artifacts.jar.desired.sha1 @@ -0,0 +1 @@ +c5788c5e518eb267445c5a995fd98b2210f90a58 ?javac-artifacts.jar diff --git a/test/files/neg/any-vs-anyref.check b/test/files/neg/any-vs-anyref.check new file mode 100644 index 0000000000..63c4853130 --- /dev/null +++ b/test/files/neg/any-vs-anyref.check @@ -0,0 +1,64 @@ +any-vs-anyref.scala:6: error: type mismatch; + found : a.type (with underlying type A) + required: AnyRef +Note that A is bounded only by Equals, which means AnyRef is not a known parent. +Such types can participate in value classes, but instances +cannot appear in singleton types or in reference comparisons. + def foo1[A <: Product](a: A) = { type X = a.type } + ^ +any-vs-anyref.scala:7: error: type mismatch; + found : a.type (with underlying type A) + required: AnyRef +Note that A is bounded only by Product, Quux, which means AnyRef is not a known parent. +Such types can participate in value classes, but instances +cannot appear in singleton types or in reference comparisons. + def foo2[A <: Product with Quux](a: A) = { type X = a.type } + ^ +any-vs-anyref.scala:8: error: type mismatch; + found : a.type (with underlying type Product) + required: AnyRef +Note that Product extends Any, not AnyRef. +Such types can participate in value classes, but instances +cannot appear in singleton types or in reference comparisons. + def foo3(a: Product) = { type X = a.type } + ^ +any-vs-anyref.scala:9: error: type mismatch; + found : Product with Quux + required: AnyRef +Note that the parents of this type (Product, Quux) extend Any, not AnyRef. +Such types can participate in value classes, but instances +cannot appear in singleton types or in reference comparisons. + def foo4(a: Product with Quux) = { type X = a.type } + ^ +any-vs-anyref.scala:10: error: value eq is not a member of Quux with Product +Note that the parents of this type (Quux, Product) extend Any, not AnyRef. +Such types can participate in value classes, but instances +cannot appear in singleton types or in reference comparisons. + def foo5(x: Quux with Product) = (x eq "abc") && ("abc" eq x) + ^ +any-vs-anyref.scala:11: error: value eq is not a member of Quux with Product{def f: Int} +Note that the parents of this type (Quux, Product) extend Any, not AnyRef. +Such types can participate in value classes, but instances +cannot appear in singleton types or in reference comparisons. + def foo6(x: Quux with Product { def f: Int }) = (x eq "abc") && ("abc" eq x) + ^ +any-vs-anyref.scala:12: error: type mismatch; + found : Quux with Product{def eq(other: String): Boolean} + required: AnyRef +Note that the parents of this type (Quux, Product) extend Any, not AnyRef. +Such types can participate in value classes, but instances +cannot appear in singleton types or in reference comparisons. + def foo7(x: Quux with Product { def eq(other: String): Boolean }) = (x eq "abc") && ("abc" eq x) + ^ +any-vs-anyref.scala:22: error: value eq is not a member of Bippy +Note that Bippy extends Any, not AnyRef. +Such types can participate in value classes, but instances +cannot appear in singleton types or in reference comparisons. + def bad1(x: Bippy, y: Bippy) = x eq y + ^ +any-vs-anyref.scala:27: error: type mismatch; + found : Quux{def g(x: String): String} + required: Quux{def g(x: Int): Int} + f(new Quux { def g(x: String) = x }) + ^ +9 errors found diff --git a/test/files/neg/any-vs-anyref.scala b/test/files/neg/any-vs-anyref.scala new file mode 100644 index 0000000000..8d237fbaec --- /dev/null +++ b/test/files/neg/any-vs-anyref.scala @@ -0,0 +1,29 @@ +trait Quux extends Any +trait QuuxRef extends AnyRef +final class Bippy(val x: Any) extends AnyVal with Quux + +object Foo { + def foo1[A <: Product](a: A) = { type X = a.type } + def foo2[A <: Product with Quux](a: A) = { type X = a.type } + def foo3(a: Product) = { type X = a.type } + def foo4(a: Product with Quux) = { type X = a.type } + def foo5(x: Quux with Product) = (x eq "abc") && ("abc" eq x) + def foo6(x: Quux with Product { def f: Int }) = (x eq "abc") && ("abc" eq x) + def foo7(x: Quux with Product { def eq(other: String): Boolean }) = (x eq "abc") && ("abc" eq x) + + def ok1[A <: QuuxRef](a: A) = { type X = a.type } + def ok2[A <: Product with QuuxRef](a: A) = { type X = a.type } + def ok3(a: QuuxRef) = { type X = a.type } + def ok4(a: Product with QuuxRef) = { type X = a.type } + def ok5(x: QuuxRef with Product) = (x eq "abc") && ("abc" eq x) + def ok6(x: QuuxRef with Product { def f: Int }) = (x eq "abc") && ("abc" eq x) + def ok7(x: QuuxRef { def eq(other: String): Boolean }) = (x eq "abc") && ("abc" eq x) + + def bad1(x: Bippy, y: Bippy) = x eq y +} + +object Bar { + def f(x: Quux { def g(x: Int): Int }): Int = x g 5 + f(new Quux { def g(x: String) = x }) + f(new Quux { def g(x: Int) = x }) +} diff --git a/test/files/neg/applydynamic_sip.check b/test/files/neg/applydynamic_sip.check index 8845f68a52..dcf97b29fc 100644 --- a/test/files/neg/applydynamic_sip.check +++ b/test/files/neg/applydynamic_sip.check @@ -7,4 +7,52 @@ applydynamic_sip.scala:8: error: applyDynamicNamed does not support passing a va applydynamic_sip.scala:9: error: applyDynamicNamed does not support passing a vararg parameter qual.sel(arg, arg2 = "a2", a2: _*) ^ -three errors found +applydynamic_sip.scala:18: error: type mismatch; + found : String("sel") + required: Int +error after rewriting to Test.this.bad1.selectDynamic("sel") +possible cause: maybe a wrong Dynamic method signature? + bad1.sel + ^ +applydynamic_sip.scala:19: error: type mismatch; + found : String("sel") + required: Int +error after rewriting to Test.this.bad1.applyDynamic("sel") +possible cause: maybe a wrong Dynamic method signature? + bad1.sel(1) + ^ +applydynamic_sip.scala:20: error: type mismatch; + found : String("sel") + required: Int +error after rewriting to Test.this.bad1.applyDynamicNamed("sel") +possible cause: maybe a wrong Dynamic method signature? + bad1.sel(a = 1) + ^ +applydynamic_sip.scala:21: error: type mismatch; + found : String("sel") + required: Int +error after rewriting to Test.this.bad1.updateDynamic("sel") +possible cause: maybe a wrong Dynamic method signature? + bad1.sel = 1 + ^ +applydynamic_sip.scala:29: error: Int does not take parameters +error after rewriting to Test.this.bad2.selectDynamic("sel") +possible cause: maybe a wrong Dynamic method signature? + bad2.sel + ^ +applydynamic_sip.scala:30: error: Int does not take parameters +error after rewriting to Test.this.bad2.applyDynamic("sel") +possible cause: maybe a wrong Dynamic method signature? + bad2.sel(1) + ^ +applydynamic_sip.scala:31: error: Int does not take parameters +error after rewriting to Test.this.bad2.applyDynamicNamed("sel") +possible cause: maybe a wrong Dynamic method signature? + bad2.sel(a = 1) + ^ +applydynamic_sip.scala:32: error: Int does not take parameters +error after rewriting to Test.this.bad2.updateDynamic("sel") +possible cause: maybe a wrong Dynamic method signature? + bad2.sel = 1 + ^ +11 errors found diff --git a/test/files/neg/applydynamic_sip.flags b/test/files/neg/applydynamic_sip.flags new file mode 100644 index 0000000000..1141f97507 --- /dev/null +++ b/test/files/neg/applydynamic_sip.flags @@ -0,0 +1 @@ +-language:dynamics diff --git a/test/files/neg/applydynamic_sip.scala b/test/files/neg/applydynamic_sip.scala index 362461577b..ee4432ebe6 100644 --- a/test/files/neg/applydynamic_sip.scala +++ b/test/files/neg/applydynamic_sip.scala @@ -7,4 +7,27 @@ object Test extends App { qual.sel(a, a2: _*) qual.sel(arg = a, a2: _*) qual.sel(arg, arg2 = "a2", a2: _*) -}
\ No newline at end of file + + val bad1 = new Dynamic { + def selectDynamic(n: Int) = n + def applyDynamic(n: Int) = n + def applyDynamicNamed(n: Int) = n + def updateDynamic(n: Int) = n + + } + bad1.sel + bad1.sel(1) + bad1.sel(a = 1) + bad1.sel = 1 + + val bad2 = new Dynamic { + def selectDynamic = 1 + def applyDynamic = 1 + def applyDynamicNamed = 1 + def updateDynamic = 1 + } + bad2.sel + bad2.sel(1) + bad2.sel(a = 1) + bad2.sel = 1 +} diff --git a/test/files/neg/deadline-inf-illegal.check b/test/files/neg/deadline-inf-illegal.check new file mode 100644 index 0000000000..2b9b25e48e --- /dev/null +++ b/test/files/neg/deadline-inf-illegal.check @@ -0,0 +1,15 @@ +deadline-inf-illegal.scala:5: error: value fromNow is not a member of scala.concurrent.util.Duration + d.fromNow + ^ +deadline-inf-illegal.scala:6: error: type mismatch; + found : scala.concurrent.util.Duration + required: scala.concurrent.util.FiniteDuration + Deadline.now + d + ^ +deadline-inf-illegal.scala:7: error: overloaded method value - with alternatives: + (other: scala.concurrent.util.Deadline)scala.concurrent.util.FiniteDuration <and> + (other: scala.concurrent.util.FiniteDuration)scala.concurrent.util.Deadline + cannot be applied to (scala.concurrent.util.Duration) + Deadline.now - d + ^ +three errors found diff --git a/test/files/neg/deadline-inf-illegal.scala b/test/files/neg/deadline-inf-illegal.scala new file mode 100644 index 0000000000..161089bfee --- /dev/null +++ b/test/files/neg/deadline-inf-illegal.scala @@ -0,0 +1,8 @@ +import concurrent.util.{ Deadline, Duration } + +class T { + val d: Duration = Duration.Zero + d.fromNow + Deadline.now + d + Deadline.now - d +} diff --git a/test/files/neg/implicit-shadow.check b/test/files/neg/implicit-shadow.check new file mode 100644 index 0000000000..042fca867a --- /dev/null +++ b/test/files/neg/implicit-shadow.check @@ -0,0 +1,11 @@ +implicit-shadow.scala:4: <i2s: error> is not a valid implicit value for Int(1) => ?{def isEmpty: ?} because: +reference to i2s is ambiguous; +it is imported twice in the same scope by +import C._ +and import B._ + 1.isEmpty + ^ +implicit-shadow.scala:4: error: value isEmpty is not a member of Int + 1.isEmpty + ^ +one error found diff --git a/test/files/neg/implicit-shadow.flags b/test/files/neg/implicit-shadow.flags new file mode 100644 index 0000000000..44842a9d65 --- /dev/null +++ b/test/files/neg/implicit-shadow.flags @@ -0,0 +1 @@ +-Xlog-implicits diff --git a/test/files/neg/implicit-shadow.scala b/test/files/neg/implicit-shadow.scala new file mode 100644 index 0000000000..ffd34b6408 --- /dev/null +++ b/test/files/neg/implicit-shadow.scala @@ -0,0 +1,13 @@ +object Test { + import B._, C._ + + 1.isEmpty +} + +trait A { + implicit def i2s(i: Int): String = "" +} + +object B extends A + +object C extends A
\ No newline at end of file diff --git a/test/files/neg/interop_abstypetags_arenot_classmanifests.scala b/test/files/neg/interop_abstypetags_arenot_classmanifests.scala index c8567be5d4..5d88c90ffd 100644 --- a/test/files/neg/interop_abstypetags_arenot_classmanifests.scala +++ b/test/files/neg/interop_abstypetags_arenot_classmanifests.scala @@ -1,11 +1,11 @@ import scala.reflect.runtime.universe._ object Test extends App { - def absTypeTagIsnotClassManifest[T: AbsTypeTag] = { + def weakTypeTagIsnotClassManifest[T: WeakTypeTag] = { println(classManifest[T]) } - absTypeTagIsnotClassManifest[Int] - absTypeTagIsnotClassManifest[String] - absTypeTagIsnotClassManifest[Array[Int]] + weakTypeTagIsnotClassManifest[Int] + weakTypeTagIsnotClassManifest[String] + weakTypeTagIsnotClassManifest[Array[Int]] }
\ No newline at end of file diff --git a/test/files/neg/interop_abstypetags_arenot_classtags.scala b/test/files/neg/interop_abstypetags_arenot_classtags.scala index e3911c1588..de1f8657b6 100644 --- a/test/files/neg/interop_abstypetags_arenot_classtags.scala +++ b/test/files/neg/interop_abstypetags_arenot_classtags.scala @@ -2,11 +2,11 @@ import scala.reflect.runtime.universe._ import scala.reflect.{ClassTag, classTag} object Test extends App { - def absTypeTagIsnotClassTag[T: AbsTypeTag] = { + def weakTypeTagIsnotClassTag[T: WeakTypeTag] = { println(classTag[T]) } - absTypeTagIsnotClassTag[Int] - absTypeTagIsnotClassTag[String] - absTypeTagIsnotClassTag[Array[Int]] + weakTypeTagIsnotClassTag[Int] + weakTypeTagIsnotClassTag[String] + weakTypeTagIsnotClassTag[Array[Int]] }
\ No newline at end of file diff --git a/test/files/neg/interop_abstypetags_arenot_manifests.scala b/test/files/neg/interop_abstypetags_arenot_manifests.scala index 77a95048fd..1ca3673ce4 100644 --- a/test/files/neg/interop_abstypetags_arenot_manifests.scala +++ b/test/files/neg/interop_abstypetags_arenot_manifests.scala @@ -1,11 +1,11 @@ import scala.reflect.runtime.universe._ object Test extends App { - def absTypeTagIsnotManifest[T: AbsTypeTag] = { + def weakTypeTagIsnotManifest[T: WeakTypeTag] = { println(manifest[T]) } - absTypeTagIsnotManifest[Int] - absTypeTagIsnotManifest[String] - absTypeTagIsnotManifest[Array[Int]] + weakTypeTagIsnotManifest[Int] + weakTypeTagIsnotManifest[String] + weakTypeTagIsnotManifest[Array[Int]] }
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-context-bounds.check b/test/files/neg/macro-invalidsig-context-bounds.check index 5d42ebc515..eb5d833bc0 100644 --- a/test/files/neg/macro-invalidsig-context-bounds.check +++ b/test/files/neg/macro-invalidsig-context-bounds.check @@ -1,7 +1,7 @@ Macros_Test_1.scala:2: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context): c.Expr[Any]
found : (c: scala.reflect.macros.Context)(implicit evidence$2: Numeric[U]): c.universe.Literal
-macro implementations cannot have implicit parameters other than AbsTypeTag evidences
+macro implementations cannot have implicit parameters other than WeakTypeTag evidences
def foo[U] = macro Impls.foo[U]
^
one error found
diff --git a/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala b/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala index 5aa9a7eaf9..c066c485b1 100644 --- a/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala @@ -2,7 +2,7 @@ import scala.reflect.runtime.universe._ import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[U: c.AbsTypeTag: Numeric](c: Ctx) = { + def foo[U: c.WeakTypeTag: Numeric](c: Ctx) = { import c.universe._ Literal(Constant(42)) } diff --git a/test/files/neg/macro-invalidsig-implicit-params.check b/test/files/neg/macro-invalidsig-implicit-params.check index 62156770e4..ca35e62cd7 100644 --- a/test/files/neg/macro-invalidsig-implicit-params.check +++ b/test/files/neg/macro-invalidsig-implicit-params.check @@ -1,7 +1,7 @@ Impls_Macros_1.scala:18: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context)(x: c.Expr[Int]): c.Expr[Unit]
found : (c: scala.reflect.macros.Context)(implicit x: c.Expr[Int]): c.Expr[Unit]
-macro implementations cannot have implicit parameters other than AbsTypeTag evidences
+macro implementations cannot have implicit parameters other than WeakTypeTag evidences
def foo_targs[U](x: Int) = macro Impls.foo_targs[T, U]
^
one error found
diff --git a/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala b/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala index f724538993..845a168ff2 100644 --- a/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala +++ b/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala @@ -2,13 +2,13 @@ import scala.reflect.runtime.universe._ import scala.reflect.macros.{Context => Ctx} object Impls { - def foo_targs[T, U: c.AbsTypeTag](c: Ctx)(implicit x: c.Expr[Int]) = { + def foo_targs[T, U: c.WeakTypeTag](c: Ctx)(implicit x: c.Expr[Int]) = { import c.{prefix => prefix} import c.universe._ val body = Block( Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("invoking foo_targs...")))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("type of prefix is: " + prefix.staticType)))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("U is: " + implicitly[c.AbsTypeTag[U]].tpe)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("U is: " + implicitly[c.WeakTypeTag[U]].tpe)))), Literal(Constant(()))) c.Expr[Unit](body) } diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-a.check b/test/files/neg/macro-invalidsig-tparams-notparams-a.check index 5aee62b9e5..5404c185f3 100644 --- a/test/files/neg/macro-invalidsig-tparams-notparams-a.check +++ b/test/files/neg/macro-invalidsig-tparams-notparams-a.check @@ -1,4 +1,4 @@ -Macros_Test_2.scala:2: error: wrong number of type parameters for method foo: [U](c: scala.reflect.macros.Context)(implicit evidence$1: c.AbsTypeTag[U])Nothing
+Macros_Test_2.scala:2: error: wrong number of type parameters for method foo: [U](c: scala.reflect.macros.Context)(implicit evidence$1: c.WeakTypeTag[U])Nothing
def foo = macro Impls.foo
^
one error found
diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala index afbe0f0915..f8b3c92869 100644 --- a/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala @@ -2,5 +2,5 @@ import scala.reflect.runtime.universe._ import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[U: c.AbsTypeTag](c: Ctx) = ??? + def foo[U: c.WeakTypeTag](c: Ctx) = ??? }
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-b.check b/test/files/neg/macro-invalidsig-tparams-notparams-b.check index e8de8a4c6b..485d4de96e 100644 --- a/test/files/neg/macro-invalidsig-tparams-notparams-b.check +++ b/test/files/neg/macro-invalidsig-tparams-notparams-b.check @@ -1,4 +1,4 @@ -Macros_Test_2.scala:3: error: wrong number of type parameters for method foo: [T, U, V](c: scala.reflect.macros.Context)(implicit evidence$1: c.AbsTypeTag[T], implicit evidence$2: c.AbsTypeTag[U], implicit V: c.AbsTypeTag[V])c.Expr[Unit]
+Macros_Test_2.scala:3: error: wrong number of type parameters for method foo: [T, U, V](c: scala.reflect.macros.Context)(implicit evidence$1: c.WeakTypeTag[T], implicit evidence$2: c.WeakTypeTag[U], implicit V: c.WeakTypeTag[V])c.Expr[Unit]
def foo[V] = macro Impls.foo
^
one error found
diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala index b48f9d5f98..baf3aab9e3 100644 --- a/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala @@ -2,9 +2,9 @@ import scala.reflect.runtime.universe._ import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[T: c.AbsTypeTag, U: c.AbsTypeTag, V](c: Ctx)(implicit V: c.AbsTypeTag[V]): c.Expr[Unit] = { - println(implicitly[c.AbsTypeTag[T]]) - println(implicitly[c.AbsTypeTag[U]]) + def foo[T: c.WeakTypeTag, U: c.WeakTypeTag, V](c: Ctx)(implicit V: c.WeakTypeTag[V]): c.Expr[Unit] = { + println(implicitly[c.WeakTypeTag[T]]) + println(implicitly[c.WeakTypeTag[U]]) println(V) c.literalUnit } diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-c.check b/test/files/neg/macro-invalidsig-tparams-notparams-c.check index b1078fb233..1530c35097 100644 --- a/test/files/neg/macro-invalidsig-tparams-notparams-c.check +++ b/test/files/neg/macro-invalidsig-tparams-notparams-c.check @@ -1,4 +1,4 @@ -Macros_Test_2.scala:3: error: wrong number of type parameters for method foo: [T, U, V](c: scala.reflect.macros.Context)(implicit evidence$1: c.AbsTypeTag[T], implicit evidence$2: c.AbsTypeTag[U], implicit V: c.AbsTypeTag[V])c.Expr[Unit]
+Macros_Test_2.scala:3: error: wrong number of type parameters for method foo: [T, U, V](c: scala.reflect.macros.Context)(implicit evidence$1: c.WeakTypeTag[T], implicit evidence$2: c.WeakTypeTag[U], implicit V: c.WeakTypeTag[V])c.Expr[Unit]
def foo[V] = macro Impls.foo[V]
^
one error found
diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala index 3506bdc789..44b4ed6ab3 100644 --- a/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala @@ -2,10 +2,10 @@ import scala.reflect.runtime.universe._ import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[T: c.AbsTypeTag, U: c.AbsTypeTag, V](c: Ctx)(implicit V: c.AbsTypeTag[V]): c.Expr[Unit] = { + def foo[T: c.WeakTypeTag, U: c.WeakTypeTag, V](c: Ctx)(implicit V: c.WeakTypeTag[V]): c.Expr[Unit] = { import c.universe._ - println(implicitly[c.AbsTypeTag[T]]) - println(implicitly[c.AbsTypeTag[U]]) + println(implicitly[c.WeakTypeTag[T]]) + println(implicitly[c.WeakTypeTag[U]]) println(V) c.literalUnit } diff --git a/test/files/neg/macro-reify-typetag-useabstypetag/Test.scala b/test/files/neg/macro-reify-typetag-useabstypetag/Test.scala index b66ad6c523..1e7fcb3f45 100644 --- a/test/files/neg/macro-reify-typetag-useabstypetag/Test.scala +++ b/test/files/neg/macro-reify-typetag-useabstypetag/Test.scala @@ -1,7 +1,7 @@ import scala.reflect.runtime.universe._ object Test extends App { - def fooTypeTag[T: AbsTypeTag] = { + def fooTypeTag[T: WeakTypeTag] = { println(implicitly[TypeTag[T]]) println(implicitly[TypeTag[List[T]]]) } diff --git a/test/files/neg/macro-without-xmacros-a.check b/test/files/neg/macro-without-xmacros-a.check index fd2667dbb8..ae6c6c695a 100644 --- a/test/files/neg/macro-without-xmacros-a.check +++ b/test/files/neg/macro-without-xmacros-a.check @@ -1,17 +1,17 @@ -Macros_2.scala:5: error: macro definition needs to be enabled
-by making the implicit value language.experimental.macros visible.
-This can be achieved by adding the import clause 'import language.experimental.macros'
-or by setting the compiler option -language:experimental.macros.
-See the Scala docs for value scala.language.experimental.macros for a discussion
-why the feature needs to be explicitly enabled.
- def foo(x: Int): Int = macro foo_impl
- ^
-Macros_2.scala:7: error: macro definition needs to be enabled
-by making the implicit value language.experimental.macros visible.
- def bar(x: Int): Int = macro bar_impl
- ^
-Macros_2.scala:11: error: macro definition needs to be enabled
-by making the implicit value language.experimental.macros visible.
- def quux(x: Int): Int = macro quux_impl
- ^
-three errors found
+Macros_2.scala:5: error: macro definition needs to be enabled +by making the implicit value language.experimental.macros visible. +This can be achieved by adding the import clause 'import scala.language.experimental.macros' +or by setting the compiler option -language:experimental.macros. +See the Scala docs for value scala.language.experimental.macros for a discussion +why the feature needs to be explicitly enabled. + def foo(x: Int): Int = macro foo_impl + ^ +Macros_2.scala:7: error: macro definition needs to be enabled +by making the implicit value language.experimental.macros visible. + def bar(x: Int): Int = macro bar_impl + ^ +Macros_2.scala:11: error: macro definition needs to be enabled +by making the implicit value language.experimental.macros visible. + def quux(x: Int): Int = macro quux_impl + ^ +three errors found diff --git a/test/files/neg/macro-without-xmacros-b.check b/test/files/neg/macro-without-xmacros-b.check index 2d675b8319..c3cadcf36a 100644 --- a/test/files/neg/macro-without-xmacros-b.check +++ b/test/files/neg/macro-without-xmacros-b.check @@ -1,17 +1,17 @@ -Macros_2.scala:3: error: macro definition needs to be enabled
-by making the implicit value language.experimental.macros visible.
-This can be achieved by adding the import clause 'import language.experimental.macros'
-or by setting the compiler option -language:experimental.macros.
-See the Scala docs for value scala.language.experimental.macros for a discussion
-why the feature needs to be explicitly enabled.
- def foo(x: Int): Int = macro Impls.foo_impl
- ^
-Macros_2.scala:5: error: macro definition needs to be enabled
-by making the implicit value language.experimental.macros visible.
- def bar(x: Int): Int = macro Impls.bar_impl
- ^
-Macros_2.scala:9: error: macro definition needs to be enabled
-by making the implicit value language.experimental.macros visible.
- def quux(x: Int): Int = macro Impls.quux_impl
- ^
-three errors found
+Macros_2.scala:3: error: macro definition needs to be enabled +by making the implicit value language.experimental.macros visible. +This can be achieved by adding the import clause 'import scala.language.experimental.macros' +or by setting the compiler option -language:experimental.macros. +See the Scala docs for value scala.language.experimental.macros for a discussion +why the feature needs to be explicitly enabled. + def foo(x: Int): Int = macro Impls.foo_impl + ^ +Macros_2.scala:5: error: macro definition needs to be enabled +by making the implicit value language.experimental.macros visible. + def bar(x: Int): Int = macro Impls.bar_impl + ^ +Macros_2.scala:9: error: macro definition needs to be enabled +by making the implicit value language.experimental.macros visible. + def quux(x: Int): Int = macro Impls.quux_impl + ^ +three errors found diff --git a/test/files/neg/names-defaults-neg.check b/test/files/neg/names-defaults-neg.check index 2809350855..f3c45a6aa0 100644 --- a/test/files/neg/names-defaults-neg.check +++ b/test/files/neg/names-defaults-neg.check @@ -76,7 +76,7 @@ and method f in object t8 of type (a: Int, b: Object)String match argument types (a: Int,b: String) and expected result type Any println(t8.f(a = 0, b = "1")) // ambigous reference ^ -names-defaults-neg.scala:69: error: wrong number of arguments for <none>: (x: Int, y: String)A1 +names-defaults-neg.scala:69: error: wrong number of arguments for pattern A1(x: Int,y: String) A1() match { case A1(_) => () } ^ names-defaults-neg.scala:76: error: no type parameters for method test4: (x: T[T[List[T[X forSome { type X }]]]])T[T[List[T[X forSome { type X }]]]] exist so that it can be applied to arguments (List[Int]) diff --git a/test/files/neg/no-implicit-to-anyref.check b/test/files/neg/no-implicit-to-anyref.check new file mode 100644 index 0000000000..d94b57a30a --- /dev/null +++ b/test/files/neg/no-implicit-to-anyref.check @@ -0,0 +1,28 @@ +no-implicit-to-anyref.scala:11: error: type mismatch; + found : Int(1) + required: AnyRef +Note: an implicit exists from scala.Int => java.lang.Integer, but +methods inherited from Object are rendered ambiguous. This is to avoid +a blanket implicit which would convert any scala.Int to any AnyRef. +You may wish to use a type ascription: `x: java.lang.Integer`. + 1: AnyRef + ^ +no-implicit-to-anyref.scala:17: error: type mismatch; + found : Any + required: AnyRef + (null: Any): AnyRef + ^ +no-implicit-to-anyref.scala:21: error: type mismatch; + found : AnyVal + required: AnyRef + (0: AnyVal): AnyRef + ^ +no-implicit-to-anyref.scala:27: error: type mismatch; + found : Test.AV + required: AnyRef +Note that AV extends Any, not AnyRef. +Such types can participate in value classes, but instances +cannot appear in singleton types or in reference comparisons. + new AV(0): AnyRef + ^ +four errors found diff --git a/test/files/neg/no-implicit-to-anyref.scala b/test/files/neg/no-implicit-to-anyref.scala new file mode 100644 index 0000000000..3e3d373e38 --- /dev/null +++ b/test/files/neg/no-implicit-to-anyref.scala @@ -0,0 +1,29 @@ +// Checks that the state of standard implicits in Predef._ and scala._ +// doesn't allow us to unambiguously and implicitly convert AnyVal +// and subtypes to AnyRef. +// +// In the days before value classes, this was precariously held be +// the competing implicits Any => StringAdd and Any => StringFormat. +// Since then, these have both become value classes, but seeing as +// this happened simultaneously, we're still okay. +object Test { + locally { + 1: AnyRef + } + + locally { + // before this test case was added and ContextErrors was tweaked, this + // emitted: "Note that Any extends Any, not AnyRef." + (null: Any): AnyRef + } + + locally { + (0: AnyVal): AnyRef + } + + class AV(val a: Int) extends AnyVal + + locally { + new AV(0): AnyRef + } +} diff --git a/test/files/neg/not-possible-cause.check b/test/files/neg/not-possible-cause.check new file mode 100644 index 0000000000..5c09fa1545 --- /dev/null +++ b/test/files/neg/not-possible-cause.check @@ -0,0 +1,9 @@ +not-possible-cause.scala:2: error: type mismatch; + found : a.type (with underlying type A) + required: AnyRef +Note that A is bounded only by Equals, which means AnyRef is not a known parent. +Such types can participate in value classes, but instances +cannot appear in singleton types or in reference comparisons. + def foo[A <: Product](a: A) { type X = a.type } + ^ +one error found diff --git a/test/files/neg/not-possible-cause.scala b/test/files/neg/not-possible-cause.scala new file mode 100644 index 0000000000..83ec24dec8 --- /dev/null +++ b/test/files/neg/not-possible-cause.scala @@ -0,0 +1,3 @@ +object Foo { + def foo[A <: Product](a: A) { type X = a.type } +} diff --git a/test/files/neg/override.check b/test/files/neg/override.check index fc152cb3b1..8be98bf4d0 100644 --- a/test/files/neg/override.check +++ b/test/files/neg/override.check @@ -1,5 +1,5 @@ override.scala:9: error: overriding type T in trait A with bounds >: Int <: Int; type T in trait B with bounds >: String <: String has incompatible type - lazy val x : A with B = x + lazy val x : A with B = {println(""); x} ^ one error found diff --git a/test/files/neg/override.scala b/test/files/neg/override.scala index 3e589b52e3..7975516061 100755 --- a/test/files/neg/override.scala +++ b/test/files/neg/override.scala @@ -6,7 +6,7 @@ trait X { trait Y extends X { trait B { type T >: String <: String } - lazy val x : A with B = x + lazy val x : A with B = {println(""); x} n = "foo" } diff --git a/test/files/neg/reify_ann2b.scala b/test/files/neg/reify_ann2b.scala index 2076af34c8..72d8c611cb 100644 --- a/test/files/neg/reify_ann2b.scala +++ b/test/files/neg/reify_ann2b.scala @@ -24,5 +24,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/neg/reify_metalevel_breach_+0_refers_to_1.scala b/test/files/neg/reify_metalevel_breach_+0_refers_to_1.scala index 9499960480..e4d1edffc4 100644 --- a/test/files/neg/reify_metalevel_breach_+0_refers_to_1.scala +++ b/test/files/neg/reify_metalevel_breach_+0_refers_to_1.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/neg/reify_metalevel_breach_-1_refers_to_0_a.scala b/test/files/neg/reify_metalevel_breach_-1_refers_to_0_a.scala index e6aaeb9426..7397441586 100644 --- a/test/files/neg/reify_metalevel_breach_-1_refers_to_0_a.scala +++ b/test/files/neg/reify_metalevel_breach_-1_refers_to_0_a.scala @@ -9,6 +9,6 @@ object Test extends App { val code = reify{outer.splice.splice} 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/neg/reify_metalevel_breach_-1_refers_to_0_b.scala b/test/files/neg/reify_metalevel_breach_-1_refers_to_0_b.scala index 16dcae8683..4f27a44f0c 100644 --- a/test/files/neg/reify_metalevel_breach_-1_refers_to_0_b.scala +++ b/test/files/neg/reify_metalevel_breach_-1_refers_to_0_b.scala @@ -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/neg/reify_metalevel_breach_-1_refers_to_1.scala b/test/files/neg/reify_metalevel_breach_-1_refers_to_1.scala index 9600489f35..2f637301aa 100644 --- a/test/files/neg/reify_metalevel_breach_-1_refers_to_1.scala +++ b/test/files/neg/reify_metalevel_breach_-1_refers_to_1.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/neg/reify_nested_inner_refers_to_local.scala b/test/files/neg/reify_nested_inner_refers_to_local.scala index fcbc1f7865..75ed1bf330 100644 --- a/test/files/neg/reify_nested_inner_refers_to_local.scala +++ b/test/files/neg/reify_nested_inner_refers_to_local.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/neg/static-annot.check b/test/files/neg/static-annot.check deleted file mode 100644 index 66efebdcee..0000000000 --- a/test/files/neg/static-annot.check +++ /dev/null @@ -1,19 +0,0 @@ -static-annot.scala:8: error: Only members of top-level objects and their nested objects can be annotated with @static. - @static val bar = 1 - ^ -static-annot.scala:27: error: @static annotated field bar has the same name as a member of class Conflicting - @static val bar = 1 - ^ -static-annot.scala:37: error: The @static annotation is only allowed on public members. - @static private val bar = 1 - ^ -static-annot.scala:38: error: The @static annotation is only allowed on public members. - @static private val baz = 2 - ^ -static-annot.scala:39: error: The @static annotation is not allowed on lazy members. - @static lazy val bam = 3 - ^ -static-annot.scala:14: error: Only members of top-level objects and their nested objects can be annotated with @static. - @static val blah = 2 - ^ -6 errors found
\ No newline at end of file diff --git a/test/files/neg/static-annot.scala b/test/files/neg/static-annot.scala deleted file mode 100644 index c0b5ed30d8..0000000000 --- a/test/files/neg/static-annot.scala +++ /dev/null @@ -1,53 +0,0 @@ - - -import annotation.static - - - -class StaticInClass { - @static val bar = 1 -} - - -class NestedObjectInClass { - object Nested { - @static val blah = 2 - } -} - - -object NestedObjectInObject { - object Nested { - @static val succeed = 3 - } -} - - -object Conflicting { - @static val bar = 1 -} - - -class Conflicting { - val bar = 45 -} - - -object PrivateProtectedLazy { - @static private val bar = 1 - @static private val baz = 2 - @static lazy val bam = 3 -} - - -class PrivateProtectedLazy { - println(PrivateProtectedLazy.bar) - println(PrivateProtectedLazy.baz) - println(PrivateProtectedLazy.bam) -} - - -class StaticDef { - // this should not crash the compiler - @static def x = 42 -} diff --git a/test/files/neg/t2296a.check b/test/files/neg/t2296a.check new file mode 100644 index 0000000000..863b861046 --- /dev/null +++ b/test/files/neg/t2296a.check @@ -0,0 +1,5 @@ +S.scala:6: error: Implementation restriction: trait S accesses protected method foo inside a concrete trait method. +Add an accessor in a class extending class J as a workaround. + foo() + ^ +one error found diff --git a/test/files/run/t2296a/J.java b/test/files/neg/t2296a/J.java index 78ff3e9804..78ff3e9804 100644 --- a/test/files/run/t2296a/J.java +++ b/test/files/neg/t2296a/J.java diff --git a/test/files/run/t2296a/S.scala b/test/files/neg/t2296a/S.scala index 532d038a42..532d038a42 100644 --- a/test/files/run/t2296a/S.scala +++ b/test/files/neg/t2296a/S.scala diff --git a/test/files/neg/t2296b.check b/test/files/neg/t2296b.check new file mode 100644 index 0000000000..07cc54d573 --- /dev/null +++ b/test/files/neg/t2296b.check @@ -0,0 +1,5 @@ +S_2.scala:6: error: Implementation restriction: trait S accesses protected method foo inside a concrete trait method. +Add an accessor in a class extending class J_1 as a workaround. + foo() + ^ +one error found diff --git a/test/files/run/t2296b/J_1.java b/test/files/neg/t2296b/J_1.java index 4c91d47073..4c91d47073 100644 --- a/test/files/run/t2296b/J_1.java +++ b/test/files/neg/t2296b/J_1.java diff --git a/test/files/run/t2296b/S_2.scala b/test/files/neg/t2296b/S_2.scala index 6cdb0cfaba..6cdb0cfaba 100644 --- a/test/files/run/t2296b/S_2.scala +++ b/test/files/neg/t2296b/S_2.scala diff --git a/test/files/neg/t3614.check b/test/files/neg/t3614.check index 5fdb5cbf1f..0f9c83aa0d 100644 --- a/test/files/neg/t3614.check +++ b/test/files/neg/t3614.check @@ -1,4 +1,4 @@ -t3614.scala:2: error: class type required but AnyRef{def a: <?>} found +t3614.scala:2: error: class type required but AnyRef{def a: Int} found def v = new ({ def a=0 }) ^ -one error found
\ No newline at end of file +one error found diff --git a/test/files/neg/t5031.check b/test/files/neg/t5031.check index 8983d8daf9..2f1090c321 100644 --- a/test/files/neg/t5031.check +++ b/test/files/neg/t5031.check @@ -1,5 +1,5 @@ -Id.scala:3: error: Companions 'class Test' and 'object Test' must be defined in same file: +package.scala:2: error: Companions 'class Test' and 'object Test' must be defined in same file: Found in t5031/package.scala and t5031/Id.scala -object Test - ^ + class Test + ^ one error found diff --git a/test/files/neg/t5031b.check b/test/files/neg/t5031b.check new file mode 100644 index 0000000000..3bc2284a4d --- /dev/null +++ b/test/files/neg/t5031b.check @@ -0,0 +1,5 @@ +b.scala:3: error: Companions 'class Bippy' and 'object Bippy' must be defined in same file: + Found in t5031b/a.scala and t5031b/b.scala +object Bippy + ^ +one error found diff --git a/test/files/neg/t5031b/a.scala b/test/files/neg/t5031b/a.scala new file mode 100644 index 0000000000..0ab9aa9769 --- /dev/null +++ b/test/files/neg/t5031b/a.scala @@ -0,0 +1,3 @@ +package foo + +class Bippy diff --git a/test/files/neg/t5031b/b.scala b/test/files/neg/t5031b/b.scala new file mode 100644 index 0000000000..bdef237af5 --- /dev/null +++ b/test/files/neg/t5031b/b.scala @@ -0,0 +1,3 @@ +package foo + +object Bippy diff --git a/test/files/neg/t5510.check b/test/files/neg/t5510.check index 60da3bed40..04220e79bb 100644 --- a/test/files/neg/t5510.check +++ b/test/files/neg/t5510.check @@ -13,7 +13,7 @@ t5510.scala:5: error: unclosed string literal t5510.scala:6: error: unclosed multi-line string literal val s5 = ""s""" $s1 $s2 s" ^ -t5510.scala:7: error: '}' expected but eof found. +t5510.scala:7: error: unclosed multi-line string literal } ^ 6 errors found diff --git a/test/files/neg/t5692a.check b/test/files/neg/t5692a.check new file mode 100644 index 0000000000..527cb35fba --- /dev/null +++ b/test/files/neg/t5692a.check @@ -0,0 +1,4 @@ +Test_2.scala:2: error: type parameter not specified
+ def x = Macros.foo
+ ^
+one error found
diff --git a/test/files/neg/t5692a.flags b/test/files/neg/t5692a.flags new file mode 100644 index 0000000000..cd66464f2f --- /dev/null +++ b/test/files/neg/t5692a.flags @@ -0,0 +1 @@ +-language:experimental.macros
\ No newline at end of file diff --git a/test/files/neg/t5692a/Macros_1.scala b/test/files/neg/t5692a/Macros_1.scala new file mode 100644 index 0000000000..06b5a3de36 --- /dev/null +++ b/test/files/neg/t5692a/Macros_1.scala @@ -0,0 +1,6 @@ +import scala.reflect.macros.Context + +object Macros { + def impl[T](c: Context) = c.literalUnit + def foo[T] = macro impl[T] +}
\ No newline at end of file diff --git a/test/files/neg/t5692a/Test_2.scala b/test/files/neg/t5692a/Test_2.scala new file mode 100644 index 0000000000..08d510cc6f --- /dev/null +++ b/test/files/neg/t5692a/Test_2.scala @@ -0,0 +1,3 @@ +class Test { + def x = Macros.foo +}
\ No newline at end of file diff --git a/test/files/neg/t5692b.check b/test/files/neg/t5692b.check new file mode 100644 index 0000000000..8f6b2624cf --- /dev/null +++ b/test/files/neg/t5692b.check @@ -0,0 +1,4 @@ +Test_2.scala:2: error: type parameters not specified
+ def x = Macros.foo
+ ^
+one error found
diff --git a/test/files/neg/t5692b.flags b/test/files/neg/t5692b.flags new file mode 100644 index 0000000000..cd66464f2f --- /dev/null +++ b/test/files/neg/t5692b.flags @@ -0,0 +1 @@ +-language:experimental.macros
\ No newline at end of file diff --git a/test/files/neg/t5692b/Macros_1.scala b/test/files/neg/t5692b/Macros_1.scala new file mode 100644 index 0000000000..b28d19f903 --- /dev/null +++ b/test/files/neg/t5692b/Macros_1.scala @@ -0,0 +1,6 @@ +import scala.reflect.macros.Context + +object Macros { + def impl[T, U](c: Context) = c.literalUnit + def foo[T, U] = macro impl[T, U] +}
\ No newline at end of file diff --git a/test/files/neg/t5692b/Test_2.scala b/test/files/neg/t5692b/Test_2.scala new file mode 100644 index 0000000000..08d510cc6f --- /dev/null +++ b/test/files/neg/t5692b/Test_2.scala @@ -0,0 +1,3 @@ +class Test { + def x = Macros.foo +}
\ No newline at end of file diff --git a/test/files/neg/t6040.check b/test/files/neg/t6040.check index f44a81c471..f6757f97e3 100644 --- a/test/files/neg/t6040.check +++ b/test/files/neg/t6040.check @@ -1,6 +1,6 @@ error: extension of type scala.Dynamic needs to be enabled by making the implicit value language.dynamics visible. -This can be achieved by adding the import clause 'import language.dynamics' +This can be achieved by adding the import clause 'import scala.language.dynamics' or by setting the compiler option -language:dynamics. See the Scala docs for value scala.language.dynamics for a discussion why the feature needs to be explicitly enabled. diff --git a/test/files/neg/t6162-inheritance.check b/test/files/neg/t6162-inheritance.check new file mode 100644 index 0000000000..a7d3cc3238 --- /dev/null +++ b/test/files/neg/t6162-inheritance.check @@ -0,0 +1,10 @@ +t6162-inheritance.scala:6: error: inheritance from class Foo in package t6126 is deprecated: `Foo` will be made final in a future version. +class SubFoo extends Foo + ^ +t6162-inheritance.scala:11: error: inheritance from trait T in package t6126 is deprecated +object SubT extends T + ^ +t6162-inheritance.scala:17: error: inheritance from trait S in package t6126 is deprecated + new S { + ^ +three errors found diff --git a/test/files/neg/t6162-inheritance.flags b/test/files/neg/t6162-inheritance.flags new file mode 100644 index 0000000000..65faf53579 --- /dev/null +++ b/test/files/neg/t6162-inheritance.flags @@ -0,0 +1 @@ +-Xfatal-warnings -deprecation
\ No newline at end of file diff --git a/test/files/neg/t6162-inheritance.scala b/test/files/neg/t6162-inheritance.scala new file mode 100644 index 0000000000..7b47b9285a --- /dev/null +++ b/test/files/neg/t6162-inheritance.scala @@ -0,0 +1,19 @@ +package scala.t6126 + +@deprecatedInheritance("`Foo` will be made final in a future version.", "2.10.0") +class Foo + +class SubFoo extends Foo + +@deprecatedInheritance() +trait T + +object SubT extends T + +@deprecatedInheritance() +trait S + +object O { + new S { + } +} diff --git a/test/files/neg/t6162-overriding.check b/test/files/neg/t6162-overriding.check new file mode 100644 index 0000000000..e774888d36 --- /dev/null +++ b/test/files/neg/t6162-overriding.check @@ -0,0 +1,7 @@ +t6162-overriding.scala:14: error: overriding method bar in class Bar is deprecated: `bar` will be made private in a future version. + override def bar = 43 + ^ +t6162-overriding.scala:15: error: overriding method baz in class Bar is deprecated + override def baz = 43 + ^ +two errors found diff --git a/test/files/neg/t6162-overriding.flags b/test/files/neg/t6162-overriding.flags new file mode 100644 index 0000000000..65faf53579 --- /dev/null +++ b/test/files/neg/t6162-overriding.flags @@ -0,0 +1 @@ +-Xfatal-warnings -deprecation
\ No newline at end of file diff --git a/test/files/neg/t6162-overriding.scala b/test/files/neg/t6162-overriding.scala new file mode 100644 index 0000000000..4cab0c2dee --- /dev/null +++ b/test/files/neg/t6162-overriding.scala @@ -0,0 +1,17 @@ +package scala.t6162 + +class Bar { + @deprecatedOverriding("`bar` will be made private in a future version.", "2.10.0") + def bar = 42 + + @deprecatedOverriding() + def baz = 42 + + def baz(a: Any) = 0 +} + +class SubBar extends Bar { + override def bar = 43 + override def baz = 43 + override def baz(a: Any) = 43 // okay +} diff --git a/test/files/neg/t6227.check b/test/files/neg/t6227.check new file mode 100644 index 0000000000..5e3c636712 --- /dev/null +++ b/test/files/neg/t6227.check @@ -0,0 +1,4 @@ +t6227.scala:2: error: illegal combination of modifiers: implicit and case for: class IntOps + implicit case class IntOps( i: Int ) { + ^ +one error found diff --git a/test/files/neg/t6227.scala b/test/files/neg/t6227.scala new file mode 100644 index 0000000000..46416839d1 --- /dev/null +++ b/test/files/neg/t6227.scala @@ -0,0 +1,6 @@ +object Test { + implicit case class IntOps( i: Int ) { + def twice = i * 2 + } +} + diff --git a/test/files/neg/t6258.check b/test/files/neg/t6258.check new file mode 100644 index 0000000000..73363d8280 --- /dev/null +++ b/test/files/neg/t6258.check @@ -0,0 +1,16 @@ +t6258.scala:2: error: missing parameter type for expanded function +The argument types of an anonymous function must be fully known. (SLS 8.5) +Expected type was: PartialFunction[?, Int] + val f : PartialFunction[_, Int] = { case a : Int => a } // undefined param + ^ +t6258.scala:5: error: missing parameter type for expanded function +The argument types of an anonymous function must be fully known. (SLS 8.5) +Expected type was: PartialFunction[?,Int] + foo { case a : Int => a } // undefined param + ^ +t6258.scala:22: error: missing parameter type for expanded function +The argument types of an anonymous function must be fully known. (SLS 8.5) +Expected type was: PartialFunction[?,Any] + bar[M[Any]] (foo { // undefined param + ^ +three errors found diff --git a/test/files/neg/t6258.scala b/test/files/neg/t6258.scala new file mode 100644 index 0000000000..5046a4750a --- /dev/null +++ b/test/files/neg/t6258.scala @@ -0,0 +1,25 @@ +object Test { + val f : PartialFunction[_, Int] = { case a : Int => a } // undefined param + + def foo[A](pf: PartialFunction[A, Int]) {}; + foo { case a : Int => a } // undefined param + + val g : PartialFunction[Int, _] = { case a : Int => a } // okay +} + + +// Another variation, seen in the wild with Specs2. +class X { + trait Matcher[-T] + + def bar[T](m: Matcher[T]) = null + def bar[T](i: Int) = null + + def foo[T](p: PartialFunction[T, Any]): Matcher[T] = null + + case class M[X](a: X) + + bar[M[Any]] (foo { // undefined param + case M(_) => null + }) +} diff --git a/test/files/neg/t6263.check b/test/files/neg/t6263.check new file mode 100644 index 0000000000..9e9c7c615b --- /dev/null +++ b/test/files/neg/t6263.check @@ -0,0 +1,9 @@ +t6263.scala:5: error: type mismatch; + found : A.this.c.type (with underlying type C) + required: AnyRef +Note that C extends Any, not AnyRef. +Such types can participate in value classes, but instances +cannot appear in singleton types or in reference comparisons. + type t = c.type + ^ +one error found diff --git a/test/files/neg/t6263.scala b/test/files/neg/t6263.scala new file mode 100644 index 0000000000..6575185b5c --- /dev/null +++ b/test/files/neg/t6263.scala @@ -0,0 +1,6 @@ +class C(val a: Any) extends AnyVal +class A { + implicit def c2AnyRef(c: C): AnyRef = new {} + val c = new C(0) + type t = c.type +} diff --git a/test/files/neg/t6276.check b/test/files/neg/t6276.check new file mode 100644 index 0000000000..0b3dfa5531 --- /dev/null +++ b/test/files/neg/t6276.check @@ -0,0 +1,19 @@ +t6276.scala:4: error: method a in class C does nothing other than call itself recursively + def a: Any = a // warn + ^ +t6276.scala:5: error: value b in class C does nothing other than call itself recursively + val b: Any = b // warn + ^ +t6276.scala:7: error: method c in class C does nothing other than call itself recursively + def c: Any = this.c // warn + ^ +t6276.scala:8: error: method d in class C does nothing other than call itself recursively + def d: Any = C.this.d // warn + ^ +t6276.scala:13: error: method a does nothing other than call itself recursively + def a: Any = a // warn + ^ +t6276.scala:22: error: method a does nothing other than call itself recursively + def a = a // warn + ^ +6 errors found diff --git a/test/files/neg/t6276.flags b/test/files/neg/t6276.flags new file mode 100644 index 0000000000..85d8eb2ba2 --- /dev/null +++ b/test/files/neg/t6276.flags @@ -0,0 +1 @@ +-Xfatal-warnings diff --git a/test/files/neg/t6276.scala b/test/files/neg/t6276.scala new file mode 100644 index 0000000000..bd0a473f71 --- /dev/null +++ b/test/files/neg/t6276.scala @@ -0,0 +1,44 @@ +object Test { + def foo(a: Int, b: Int, c: Int) { + class C { + def a: Any = a // warn + val b: Any = b // warn + + def c: Any = this.c // warn + def d: Any = C.this.d // warn + } + + def method { + // method local + def a: Any = a // warn + } + + trait T { + def a: Any + } + + new T { + // inherited return type + def a = a // warn + } + + // no warnings below + new { + def a: Any = {println(""); a} + val b: Any = {println(""); b} + def c(i: Int): Any = c(i - 0) + } + + class D { + def other: D = null + def foo: Any = other.foo + } + + class E { + def foo: Any = 0 + class D extends E { + override def foo: Any = E.this.foo + } + } + } +} diff --git a/test/files/neg/t6283.check b/test/files/neg/t6283.check new file mode 100644 index 0000000000..69e417ee93 --- /dev/null +++ b/test/files/neg/t6283.check @@ -0,0 +1,4 @@ +t6283.scala:1: error: `abstract' modifier cannot be used with value classes +abstract class Funky(val i: Int) extends AnyVal + ^ +one error found diff --git a/test/files/neg/t6283.scala b/test/files/neg/t6283.scala new file mode 100644 index 0000000000..d41eb18a74 --- /dev/null +++ b/test/files/neg/t6283.scala @@ -0,0 +1 @@ +abstract class Funky(val i: Int) extends AnyVal diff --git a/test/files/neg/t6323a.check b/test/files/neg/t6323a.check new file mode 100644 index 0000000000..694c79ca5f --- /dev/null +++ b/test/files/neg/t6323a.check @@ -0,0 +1,9 @@ +t6323a.scala:11: `package`.this.materializeTypeTag[Test](scala.reflect.runtime.`package`.universe) is not a valid implicit value for reflect.runtime.universe.TypeTag[Test] because:
+failed to typecheck the materialized tag:
+cannot create a TypeTag referring to local class Test.Test
+ val value = u.typeOf[Test]
+ ^
+t6323a.scala:11: error: No TypeTag available for Test
+ val value = u.typeOf[Test]
+ ^
+one error found
diff --git a/test/files/neg/t6323a.flags b/test/files/neg/t6323a.flags new file mode 100644 index 0000000000..4c6cdb71e2 --- /dev/null +++ b/test/files/neg/t6323a.flags @@ -0,0 +1 @@ +-Xlog-implicits
\ No newline at end of file diff --git a/test/files/neg/t6323a.scala b/test/files/neg/t6323a.scala new file mode 100644 index 0000000000..a203167f3c --- /dev/null +++ b/test/files/neg/t6323a.scala @@ -0,0 +1,21 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => m} +import scala.reflect.runtime.{universe => u} + +object Test extends App { + locally { + try { + case class Test(a:String,b:List[Int]) + + val lookAtMe = m.reflect(Test("a",List(5))) + val value = u.typeOf[Test] + val members = value.members + val member = value.members.filter(_.name.encoded == "a") + val aAccessor = lookAtMe.reflectMethod(member.head.asMethod) + val thisShouldBeA = aAccessor.apply() + println(thisShouldBeA) + } catch { + case ScalaReflectionException(msg) => println(msg) + } + } +}
\ No newline at end of file diff --git a/test/files/neg/t6335.check b/test/files/neg/t6335.check new file mode 100644 index 0000000000..1727a05eb2 --- /dev/null +++ b/test/files/neg/t6335.check @@ -0,0 +1,9 @@ +t6335.scala:6: error: method Z is defined twice + conflicting symbols both originated in file 't6335.scala' + implicit class Z[A](val i: A) { def zz = i } + ^ +t6335.scala:3: error: method X is defined twice + conflicting symbols both originated in file 't6335.scala' + implicit class X(val x: Int) { def xx = x } + ^ +two errors found diff --git a/test/files/neg/t6335.scala b/test/files/neg/t6335.scala new file mode 100644 index 0000000000..5c41e81ef5 --- /dev/null +++ b/test/files/neg/t6335.scala @@ -0,0 +1,7 @@ +object ImplicitClass { + def X(i: Int) {} + implicit class X(val x: Int) { def xx = x } + + def Z[A](i: A) {} + implicit class Z[A](val i: A) { def zz = i } +}
\ No newline at end of file diff --git a/test/files/neg/t6336.check b/test/files/neg/t6336.check new file mode 100644 index 0000000000..f6b35ad232 --- /dev/null +++ b/test/files/neg/t6336.check @@ -0,0 +1,4 @@ +t6336.scala:3: error: Parameter type in structural refinement may not refer to a user-defined value class + val a = new { def y[T](x: X[T]) = x.i } + ^ +one error found diff --git a/test/files/neg/t6336.scala b/test/files/neg/t6336.scala new file mode 100644 index 0000000000..a9844ff94f --- /dev/null +++ b/test/files/neg/t6336.scala @@ -0,0 +1,11 @@ +object D { + def main(args: Array[String]) { + val a = new { def y[T](x: X[T]) = x.i } + val x = new X(3) + val t = a.y(x) + println(t) + } +} + +class X[T](val i: Int) extends AnyVal + diff --git a/test/files/neg/t6340.check b/test/files/neg/t6340.check new file mode 100644 index 0000000000..f18b8c3f4b --- /dev/null +++ b/test/files/neg/t6340.check @@ -0,0 +1,10 @@ +t6340.scala:11: error: value D is not a member of object Foo + import Foo.{ A, B, C, D, E, X, Y, Z } + ^ +t6340.scala:16: error: not found: type D + val d = new D + ^ +t6340.scala:17: error: not found: type W + val w = new W + ^ +three errors found diff --git a/test/files/neg/t6340.scala b/test/files/neg/t6340.scala new file mode 100644 index 0000000000..8934d5c15d --- /dev/null +++ b/test/files/neg/t6340.scala @@ -0,0 +1,21 @@ +object Foo { + class A + class B + class C + class X + class Y + class Z +} + +object Test { + import Foo.{ A, B, C, D, E, X, Y, Z } + + val a = new A + val b = new B + val c = new C + val d = new D + val w = new W + val x = new X + val y = new Y + val z = new Z +} diff --git a/test/files/neg/t6359.check b/test/files/neg/t6359.check new file mode 100644 index 0000000000..2aa1ac5035 --- /dev/null +++ b/test/files/neg/t6359.check @@ -0,0 +1,7 @@ +t6359.scala:3: error: value class may not have nested module definitions + object X + ^ +t6359.scala:4: error: value class may not have nested class definitions + class Y + ^ +two errors found diff --git a/test/files/neg/t6359.scala b/test/files/neg/t6359.scala new file mode 100644 index 0000000000..96550fd906 --- /dev/null +++ b/test/files/neg/t6359.scala @@ -0,0 +1,8 @@ +class M(val t: Int) extends AnyVal { + def lazyString = { + object X + class Y + + () => {X; new Y} + } +} diff --git a/test/files/neg/t900.check b/test/files/neg/t900.check index 4611ceba8c..6fe26a31ac 100644 --- a/test/files/neg/t900.check +++ b/test/files/neg/t900.check @@ -1,10 +1,9 @@ t900.scala:4: error: type mismatch; found : Foo.this.x.type (with underlying type Foo.this.bar) required: AnyRef -Note that implicit conversions are not applicable because they are ambiguous: - both method any2stringfmt in object Predef of type (x: Any)scala.runtime.StringFormat - and method any2stringadd in object Predef of type (x: Any)scala.runtime.StringAdd - are possible conversion functions from Foo.this.x.type to AnyRef +Note that bar is unbounded, which means AnyRef is not a known parent. +Such types can participate in value classes, but instances +cannot appear in singleton types or in reference comparisons. def break(): x.type ^ one error found diff --git a/test/files/neg/unit2anyref.check b/test/files/neg/unit2anyref.check index 10fe1861f5..6d11461700 100644 --- a/test/files/neg/unit2anyref.check +++ b/test/files/neg/unit2anyref.check @@ -1,8 +1,6 @@ unit2anyref.scala:2: error: type mismatch; found : Unit required: AnyRef -Note: Unit is not implicitly converted to AnyRef. You can safely -pattern match `x: AnyRef` or cast `x.asInstanceOf[AnyRef]` to do so. val x: AnyRef = () // this should not succeed. ^ one error found diff --git a/test/files/neg/wrong-args-for-none.check b/test/files/neg/wrong-args-for-none.check new file mode 100644 index 0000000000..d3b2d572ab --- /dev/null +++ b/test/files/neg/wrong-args-for-none.check @@ -0,0 +1,4 @@ +wrong-args-for-none.scala:5: error: wrong number of arguments for pattern Test.Foo(x: Int,y: Int) + def f(x: Any) = x match { case Bar(Foo(5)) => } + ^ +one error found diff --git a/test/files/neg/wrong-args-for-none.scala b/test/files/neg/wrong-args-for-none.scala new file mode 100644 index 0000000000..1caa4782a3 --- /dev/null +++ b/test/files/neg/wrong-args-for-none.scala @@ -0,0 +1,6 @@ +object Test { + case class Foo(x: Int, y: Int) + case class Bar(x: AnyRef) + + def f(x: Any) = x match { case Bar(Foo(5)) => } +} diff --git a/test/files/pos/t4579.scala b/test/files/pos/t4579.scala index 2404b19da1..8951ec011f 100644 --- a/test/files/pos/t4579.scala +++ b/test/files/pos/t4579.scala @@ -12,11 +12,11 @@ class LispTokenizer(s: String) extends Iterator[String] { while (i < s.length() && s.charAt(i) <= ' ') i += 1 i < s.length() } - def next: String = + def next: String = if (hasNext) { val start = i if (isDelimiter(s charAt i)) i += 1 - else + else do i = i + 1 while (!isDelimiter(s charAt i)) s.substring(start, i) @@ -235,7 +235,7 @@ object LispCaseClasses extends Lisp { def string2lisp(s: String): Data = { val it = new LispTokenizer(s); - def parseExpr(token: String): Data = { + def parse(token: String): Data = { if (token == "(") parseList else if (token == ")") sys.error("unbalanced parentheses") else if ('0' <= token.charAt(0) && token.charAt(0) <= '9') @@ -246,9 +246,9 @@ object LispCaseClasses extends Lisp { } def parseList: Data = { val token = it.next; - if (token == ")") NIL() else CONS(parseExpr(token), parseList) + if (token == ")") NIL() else CONS(parse(token), parseList) } - parseExpr(it.next) + parse(it.next) } def lisp2string(d: Data): String = d.toString(); @@ -426,7 +426,7 @@ object LispAny extends Lisp { def string2lisp(s: String): Data = { val it = new LispTokenizer(s); - def parseExpr(token: String): Data = { + def parse(token: String): Data = { if (token == "(") parseList else if (token == ")") sys.error("unbalanced parentheses") //else if (Character.isDigit(token.charAt(0))) @@ -438,9 +438,9 @@ object LispAny extends Lisp { } def parseList: List[Data] = { val token = it.next; - if (token == ")") Nil else parseExpr(token) :: parseList + if (token == ")") Nil else parse(token) :: parseList } - parseExpr(it.next) + parse(it.next) } } diff --git a/test/files/pos/t5667.scala b/test/files/pos/t5667.scala index 513de5b663..353eec93d6 100644 --- a/test/files/pos/t5667.scala +++ b/test/files/pos/t5667.scala @@ -1,6 +1,4 @@ object Main { implicit class C(val s: String) extends AnyVal implicit class C2(val s: String) extends AnyRef - - implicit case class Foo(i: Int) } diff --git a/test/files/pos/t6034.scala b/test/files/pos/t6034.scala new file mode 100644 index 0000000000..3558d7ff0b --- /dev/null +++ b/test/files/pos/t6034.scala @@ -0,0 +1 @@ +final class OptPlus[+A](val x: A) extends AnyVal { } diff --git a/test/files/pos/t6047.scala b/test/files/pos/t6047.scala index 80d5e9668b..bc5f856bd2 100644 --- a/test/files/pos/t6047.scala +++ b/test/files/pos/t6047.scala @@ -4,17 +4,17 @@ import java.io.InputStream object Macros { def unpack[A](input: InputStream): A = macro unpack_impl[A] - def unpack_impl[A: c.AbsTypeTag](c: Context)(input: c.Expr[InputStream]): c.Expr[A] = { + def unpack_impl[A: c.WeakTypeTag](c: Context)(input: c.Expr[InputStream]): c.Expr[A] = { import c.universe._ def unpackcode(tpe: c.Type): c.Expr[_] = { - if (tpe <:< implicitly[c.AbsTypeTag[Traversable[_]]].tpe) { + if (tpe <:< implicitly[c.WeakTypeTag[Traversable[_]]].tpe) { } ??? } - unpackcode(implicitly[c.AbsTypeTag[A]].tpe) + unpackcode(implicitly[c.WeakTypeTag[A]].tpe) ??? } }
\ No newline at end of file diff --git a/test/files/pos/t6245/Base.java b/test/files/pos/t6245/Base.java new file mode 100644 index 0000000000..651ea08bf2 --- /dev/null +++ b/test/files/pos/t6245/Base.java @@ -0,0 +1,5 @@ +package t1; + +public class Base { + protected Vis inner; +} diff --git a/test/files/pos/t6245/Foo.scala b/test/files/pos/t6245/Foo.scala new file mode 100644 index 0000000000..f5f997fbff --- /dev/null +++ b/test/files/pos/t6245/Foo.scala @@ -0,0 +1,9 @@ +import t1.Vis + +abstract class Foo extends t1.Base { + trait Nested { + def crash() { + inner + } + } +} diff --git a/test/files/pos/t6245/Vis.java b/test/files/pos/t6245/Vis.java new file mode 100644 index 0000000000..4267f4e40b --- /dev/null +++ b/test/files/pos/t6245/Vis.java @@ -0,0 +1,3 @@ +package t1; + +public class Vis { } diff --git a/test/files/pos/t6259.scala b/test/files/pos/t6259.scala new file mode 100644 index 0000000000..43361c417e --- /dev/null +++ b/test/files/pos/t6259.scala @@ -0,0 +1,47 @@ +package t6259 + +import scala.reflect.runtime.universe._ + +class A[X](implicit val tt: TypeTag[X]) {} +object B extends A[String] + +object C { + object D extends A[String] +} + +trait E { + object F extends A[String] +} + +class G { + object H extends A[String] +} + +object Test { + val x = { + object InVal extends A[String] + 5 + } + +} + +// Note: Both of these fail right now. + +trait NeedsEarly { + val x: AnyRef +} + +object Early extends { + // Drops to this.getClass and is not ok... + val x = { object EarlyOk extends A[String]; EarlyOk } +} with NeedsEarly + + +class DoubleTrouble[X](x: AnyRef)(implicit override val tt: TypeTag[X]) extends A[X] + +object DoubleOk extends DoubleTrouble[String]({ + // Drops to this.getClass and is an issue + object InnerTrouble extends A[String]; + InnerTrouble +}) + diff --git a/test/files/pos/t6274.scala b/test/files/pos/t6274.scala new file mode 100644 index 0000000000..cf769fc72d --- /dev/null +++ b/test/files/pos/t6274.scala @@ -0,0 +1,13 @@ +trait Crash { + + def foo(i: => Int) (j: Int): Int + + def t = { + // var count = 0 + foo { + var count = 0 + count + } _ + } + +} diff --git a/test/files/pos/t6278-synth-def.scala b/test/files/pos/t6278-synth-def.scala new file mode 100644 index 0000000000..b8b660fbe3 --- /dev/null +++ b/test/files/pos/t6278-synth-def.scala @@ -0,0 +1,30 @@ + +package t6278 + +import language.implicitConversions + +object test { + def ok() { + class Foo(val i: Int) { + def foo[A](body: =>A): A = body + } + implicit def toFoo(i: Int): Foo = new Foo(i) + + val k = 1 + k foo println("k?") + val j = 2 + } + def nope() { + implicit class Foo(val i: Int) { + def foo[A](body: =>A): A = body + } + + val k = 1 + k foo println("k?") + //lazy + val j = 2 + } + def main(args: Array[String]) { + ok(); nope() + } +} diff --git a/test/files/pos/t6335.scala b/test/files/pos/t6335.scala new file mode 100644 index 0000000000..50e34092d1 --- /dev/null +++ b/test/files/pos/t6335.scala @@ -0,0 +1,25 @@ +object E extends Z { + def X = 3 + implicit class X(val i: Int) { + def xx = i + } + + def Y(a: Any) = 0 + object Y + implicit class Y(val i: String) { def yy = i } + + implicit class Z(val i: Boolean) { def zz = i } +} + +trait Z { + def Z = 0 +} + +object Test { + import E._ + 0.xx + + "".yy + + true.zz +} diff --git a/test/files/pos/t6367.scala b/test/files/pos/t6367.scala new file mode 100644 index 0000000000..1214be7418 --- /dev/null +++ b/test/files/pos/t6367.scala @@ -0,0 +1,34 @@ +package play.api.libs.json.util + +trait FunctionalCanBuild[M[_]]{ + def apply[A,B](ma:M[A], mb:M[B]):M[A ~ B] +} + +trait Variant[M[_]] + +trait Functor[M[_]] extends Variant[M]{ + def fmap[A,B](m:M[A], f: A => B): M[B] +} + +case class ~[A,B](_1:A,_2:B) + +class FunctionalBuilder[M[_]](canBuild:FunctionalCanBuild[M]){ + class CanBuild20[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20]( + m1:M[A1 ~ A2 ~ A3 ~ A4 ~ A5 ~ A6 ~ A7 ~ A8 ~ A9 ~ A10 ~ A11 ~ A12 ~ A13 ~ A14 ~ A15 ~ A16 ~ A17 ~ A18 ~ A19], + m2:M[A20] + ) { + + def ~[A21](m3:M[A21]) = new CanBuild21(canBuild(m1,m2),m3) + + def apply[B](f: (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20) => B)(implicit fu:Functor[M]): M[B] = + fu.fmap[A1 ~ A2 ~ A3 ~ A4 ~ A5 ~ A6 ~ A7 ~ A8 ~ A9 ~ A10 ~ A11 ~ A12 ~ A13 ~ A14 ~ A15 ~ A16 ~ A17 ~ A18 ~ A19 ~ A20, B]( + canBuild(m1, m2), + { case a1 ~ a2 ~ a3 ~ a4 ~ a5 ~ a6 ~ a7 ~ a8 ~ a9 ~ a10 ~ a11 ~ a12 ~ a13 ~ a14 ~ a15 ~ a16 ~ a17 ~ a18 ~ a19 ~ a20 => + f(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) } + ) + } + + class CanBuild21[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21](m1:M[A1 ~ A2 ~ A3 ~ A4 ~ A5 ~ A6 ~ A7 ~ A8 ~ A9 ~ A10 ~ A11 ~ A12 ~ A13 ~ A14 ~ A15 ~ A16 ~ A17 ~ A18 ~ A19 ~ A20], m2:M[A21]){ + } + +} diff --git a/test/files/pos/z1720.scala b/test/files/pos/z1720.scala new file mode 100644 index 0000000000..7394d428c1 --- /dev/null +++ b/test/files/pos/z1720.scala @@ -0,0 +1,16 @@ +package test + +class Thing { + def info: Info[this.type] = InfoRepository.getInfo(this) + def info2: Info[this.type] = { + def self: this.type = this + InfoRepository.getInfo(self) + } +} + +trait Info[T] +case class InfoImpl[T](thing: T) extends Info[T] + +object InfoRepository { + def getInfo(t: Thing): Info[t.type] = InfoImpl(t) +} diff --git a/test/files/presentation/recursive-ask.check b/test/files/presentation/recursive-ask.check new file mode 100644 index 0000000000..357d2cf879 --- /dev/null +++ b/test/files/presentation/recursive-ask.check @@ -0,0 +1,4 @@ +[ outer] askForResponse +[nested] askForResponse +passed +done diff --git a/test/files/presentation/recursive-ask/RecursiveAsk.scala b/test/files/presentation/recursive-ask/RecursiveAsk.scala new file mode 100644 index 0000000000..b0e29b3fd3 --- /dev/null +++ b/test/files/presentation/recursive-ask/RecursiveAsk.scala @@ -0,0 +1,20 @@ +import scala.tools.nsc.interactive.tests._ + +object Test extends InteractiveTest { + override def execute(): Unit = recursiveAskForResponse() + + def recursiveAskForResponse() { + val res0 = compiler.askForResponse( () => { + println("[ outer] askForResponse") + val res = compiler.askForResponse( () => { println("[nested] askForResponse") }) + println (res.get(5000) match { + case Some(_) => "passed" + case None => "timeout" + }) + }) + + res0.get + + println("done") + } +} diff --git a/test/files/run/abstypetags_core.scala b/test/files/run/abstypetags_core.scala index 226de94055..2692fec035 100644 --- a/test/files/run/abstypetags_core.scala +++ b/test/files/run/abstypetags_core.scala @@ -1,34 +1,34 @@ import scala.reflect.runtime.universe._ object Test extends App { - println(implicitly[AbsTypeTag[Byte]] eq AbsTypeTag.Byte) - println(implicitly[AbsTypeTag[Byte]]) - println(implicitly[AbsTypeTag[Short]] eq AbsTypeTag.Short) - println(implicitly[AbsTypeTag[Short]]) - println(implicitly[AbsTypeTag[Char]] eq AbsTypeTag.Char) - println(implicitly[AbsTypeTag[Char]]) - println(implicitly[AbsTypeTag[Int]] eq AbsTypeTag.Int) - println(implicitly[AbsTypeTag[Int]]) - println(implicitly[AbsTypeTag[Long]] eq AbsTypeTag.Long) - println(implicitly[AbsTypeTag[Long]]) - println(implicitly[AbsTypeTag[Float]] eq AbsTypeTag.Float) - println(implicitly[AbsTypeTag[Float]]) - println(implicitly[AbsTypeTag[Double]] eq AbsTypeTag.Double) - println(implicitly[AbsTypeTag[Double]]) - println(implicitly[AbsTypeTag[Boolean]] eq AbsTypeTag.Boolean) - println(implicitly[AbsTypeTag[Boolean]]) - println(implicitly[AbsTypeTag[Unit]] eq AbsTypeTag.Unit) - println(implicitly[AbsTypeTag[Unit]]) - println(implicitly[AbsTypeTag[Any]] eq AbsTypeTag.Any) - println(implicitly[AbsTypeTag[Any]]) - println(implicitly[AbsTypeTag[AnyVal]] eq AbsTypeTag.AnyVal) - println(implicitly[AbsTypeTag[AnyVal]]) - println(implicitly[AbsTypeTag[AnyRef]] eq AbsTypeTag.AnyRef) - println(implicitly[AbsTypeTag[AnyRef]]) - println(implicitly[AbsTypeTag[Object]] eq AbsTypeTag.Object) - println(implicitly[AbsTypeTag[Object]]) - println(implicitly[AbsTypeTag[Null]] eq AbsTypeTag.Null) - println(implicitly[AbsTypeTag[Null]]) - println(implicitly[AbsTypeTag[Nothing]] eq AbsTypeTag.Nothing) - println(implicitly[AbsTypeTag[Nothing]]) + println(implicitly[WeakTypeTag[Byte]] eq WeakTypeTag.Byte) + println(implicitly[WeakTypeTag[Byte]]) + println(implicitly[WeakTypeTag[Short]] eq WeakTypeTag.Short) + println(implicitly[WeakTypeTag[Short]]) + println(implicitly[WeakTypeTag[Char]] eq WeakTypeTag.Char) + println(implicitly[WeakTypeTag[Char]]) + println(implicitly[WeakTypeTag[Int]] eq WeakTypeTag.Int) + println(implicitly[WeakTypeTag[Int]]) + println(implicitly[WeakTypeTag[Long]] eq WeakTypeTag.Long) + println(implicitly[WeakTypeTag[Long]]) + println(implicitly[WeakTypeTag[Float]] eq WeakTypeTag.Float) + println(implicitly[WeakTypeTag[Float]]) + println(implicitly[WeakTypeTag[Double]] eq WeakTypeTag.Double) + println(implicitly[WeakTypeTag[Double]]) + println(implicitly[WeakTypeTag[Boolean]] eq WeakTypeTag.Boolean) + println(implicitly[WeakTypeTag[Boolean]]) + println(implicitly[WeakTypeTag[Unit]] eq WeakTypeTag.Unit) + println(implicitly[WeakTypeTag[Unit]]) + println(implicitly[WeakTypeTag[Any]] eq WeakTypeTag.Any) + println(implicitly[WeakTypeTag[Any]]) + println(implicitly[WeakTypeTag[AnyVal]] eq WeakTypeTag.AnyVal) + println(implicitly[WeakTypeTag[AnyVal]]) + println(implicitly[WeakTypeTag[AnyRef]] eq WeakTypeTag.AnyRef) + println(implicitly[WeakTypeTag[AnyRef]]) + println(implicitly[WeakTypeTag[Object]] eq WeakTypeTag.Object) + println(implicitly[WeakTypeTag[Object]]) + println(implicitly[WeakTypeTag[Null]] eq WeakTypeTag.Null) + println(implicitly[WeakTypeTag[Null]]) + println(implicitly[WeakTypeTag[Nothing]] eq WeakTypeTag.Nothing) + println(implicitly[WeakTypeTag[Nothing]]) }
\ No newline at end of file diff --git a/test/files/run/abstypetags_serialize.scala b/test/files/run/abstypetags_serialize.scala index 5b9142f6d5..38a7aba325 100644 --- a/test/files/run/abstypetags_serialize.scala +++ b/test/files/run/abstypetags_serialize.scala @@ -3,7 +3,7 @@ import scala.reflect.runtime.universe._ import scala.reflect.runtime.{currentMirror => cm} object Test extends App { - def test(tag: AbsTypeTag[_]) = + def test(tag: WeakTypeTag[_]) = try { val fout = new ByteArrayOutputStream() val out = new ObjectOutputStream(fout) @@ -13,7 +13,7 @@ object Test extends App { val fin = new ByteArrayInputStream(fout.toByteArray) val in = new ObjectInputStream(fin) - val retag = in.readObject().asInstanceOf[scala.reflect.basis.AbsTypeTag[_]].in(cm) + val retag = in.readObject().asInstanceOf[scala.reflect.basis.WeakTypeTag[_]].in(cm) in.close() fin.close() @@ -24,8 +24,8 @@ object Test extends App { } def qwe[T, U[_]] = { - test(implicitly[AbsTypeTag[T]]) - test(implicitly[AbsTypeTag[U[String]]]) + test(implicitly[WeakTypeTag[T]]) + test(implicitly[WeakTypeTag[U[String]]]) } qwe 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/classtags_core.check b/test/files/run/classtags_core.check index 6519db2178..5a9b41fd6d 100644 --- a/test/files/run/classtags_core.check +++ b/test/files/run/classtags_core.check @@ -1,30 +1,30 @@ true
-ClassTag[byte]
+Byte
true
-ClassTag[short]
+Short
true
-ClassTag[char]
+Char
true
-ClassTag[int]
+Int
true
-ClassTag[long]
+Long
true
-ClassTag[float]
+Float
true
-ClassTag[double]
+Double
true
-ClassTag[boolean]
+Boolean
true
-ClassTag[void]
+Unit
true
-ClassTag[class java.lang.Object]
+Any
true
-ClassTag[class java.lang.Object]
+AnyVal
true
-ClassTag[class java.lang.Object]
+Object
true
-ClassTag[class java.lang.Object]
+Object
true
-ClassTag[class scala.runtime.Null$]
+Null
true
-ClassTag[class scala.runtime.Nothing$]
+Nothing
diff --git a/test/files/run/classtags_multi.check b/test/files/run/classtags_multi.check index 3a7f16c3a0..68cee4841d 100644 --- a/test/files/run/classtags_multi.check +++ b/test/files/run/classtags_multi.check @@ -1,5 +1,5 @@ -ClassTag[int]
-ClassTag[class [I]
-ClassTag[class [[I]
-ClassTag[class [[[I]
-ClassTag[class [[[[I]
+Int
+Array[int]
+Array[Array[int]]
+Array[Array[Array[int]]]
+Array[Array[Array[Array[int]]]]
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/compiler-asSeenFrom.check b/test/files/run/compiler-asSeenFrom.check index 96e257d303..47d40b0331 100644 --- a/test/files/run/compiler-asSeenFrom.check +++ b/test/files/run/compiler-asSeenFrom.check @@ -269,8 +269,8 @@ value jZ { // after parser value jZ { // after explicitouter protected val $outer: D.this.type - val ll$D$J$$$outer(): D.this.type - val ll$C$I$$$outer(): C.this.type + val $outer(): D.this.type + val $outer(): C.this.type def thisI(): I.this.type def thisC(): C.this.type def t2(): T2 @@ -279,9 +279,9 @@ value jZ { // after explicitouter value jZ { // after erasure protected val $outer: ll.D - val ll$D$J$$$outer(): ll.D + val $outer(): ll.D protected val $outer: ll.C - val ll$C$I$$$outer(): ll.C + val $outer(): ll.C def thisI(): ll.C#I def thisC(): ll.C def t2(): Object @@ -290,9 +290,9 @@ value jZ { // after erasure value jZ { // after flatten protected val $outer: ll.D - val ll$D$J$$$outer(): ll.D + val $outer(): ll.D protected val $outer: ll.C - val ll$C$I$$$outer(): ll.C + val $outer(): ll.C def thisI(): ll.C#C$I def thisC(): ll.C def t2(): Object diff --git a/test/files/run/dynamic-anyval.check b/test/files/run/dynamic-anyval.check new file mode 100644 index 0000000000..dee7bef8e8 --- /dev/null +++ b/test/files/run/dynamic-anyval.check @@ -0,0 +1,4 @@ +().dingo(bippy, 5) +List(1, 2, 3).dingo(bippy, 5) +().dingo(bippy, 5) +List(1, 2, 3).dingo(bippy, 5) diff --git a/test/files/run/dynamic-anyval.scala b/test/files/run/dynamic-anyval.scala new file mode 100644 index 0000000000..605503d377 --- /dev/null +++ b/test/files/run/dynamic-anyval.scala @@ -0,0 +1,22 @@ +import scala.language.dynamics + +object Test { + implicit class DynamicValue[T](val value: T) extends AnyVal with Dynamic { + def applyDynamic(name: String)(args: Any*) = println(s"""$this.$name(${args mkString ", "})""") + override def toString = "" + value + } + implicit class DynamicValue2[T](val value: T) extends Dynamic { + def applyDynamic(name: String)(args: Any*) = println(s"""$this.$name(${args mkString ", "})""") + override def toString = "" + value + } + + def f[T](x: DynamicValue[T]) = x.dingo("bippy", 5) + def g[T](x: DynamicValue2[T]) = x.dingo("bippy", 5) + + def main(args: Array[String]): Unit = { + f(()) + f(List(1, 2, 3)) + g(()) + g(List(1, 2, 3)) + } +} 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 0d6f694a68..2550f4dae0 100644 --- a/test/files/run/existentials3-new.check +++ b/test/files/run/existentials3-new.check @@ -1,24 +1,24 @@ -Bar.type, t=AbstractTypeRef, s= <: scala.runtime.AbstractFunction0[Bar] with Serializable{case def unapply(x$0: Bar): Boolean} with Singleton
-Bar, t=AbstractTypeRef, s= <: Test.ToS with Product with Serializable{def copy(): Bar}
+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=AbstractTypeRef, s= <: B with Test.ToS
-$anon, t=AbstractTypeRef, s= <: B with A with Test.ToS
+$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=AbstractTypeRef, s= <: scala.runtime.AbstractFunction0[Bar] with Serializable{case def unapply(x$0: Bar): Boolean} with Singleton
-Bar, t=AbstractTypeRef, s= <: Test.ToS with Product with Serializable{def copy(): Bar}
+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=AbstractTypeRef, s= <: B with Test.ToS
-$anon, t=AbstractTypeRef, s= <: B with A with Test.ToS
+$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/existentials3-new.scala b/test/files/run/existentials3-new.scala index 649fac8327..110c8eff7a 100644 --- a/test/files/run/existentials3-new.scala +++ b/test/files/run/existentials3-new.scala @@ -35,34 +35,34 @@ object Test { def printTpe(t: Type) = { val s = if (t.typeSymbol.isFreeType) t.typeSymbol.typeSignature.toString else t.typeSymbol.toString - println("%s, t=%s, s=%s".format(t, t.kind, s)) + println("%s, t=%s, s=%s".format(t, t.asInstanceOf[Product].productPrefix, s)) } def m[T: TypeTag](x: T) = printTpe(typeOf[T]) - def m2[T: AbsTypeTag](x: T) = printTpe(implicitly[AbsTypeTag[T]].tpe) + def m2[T: WeakTypeTag](x: T) = printTpe(implicitly[WeakTypeTag[T]].tpe) // tags do work for f10/g10 def main(args: Array[String]): Unit = { - m(f1) - m(f2) + m2(f1) + m2(f2) m(f3) m(f4) m(f5) m(f6) m(f7) - m(f8) - m(f9) + m2(f8) + m2(f9) m2(f10) m(f11) m(f12) - m(g1) - m(g2) + m2(g1) + m2(g2) m(g3) m(g4) m(g5) m(g6) m(g7) - m(g8) - m(g9) + m2(g8) + m2(g9) m2(g10) m(g11) m(g12) diff --git a/test/files/run/getClassTest-valueClass.check b/test/files/run/getClassTest-valueClass.check new file mode 100644 index 0000000000..7608d92b4e --- /dev/null +++ b/test/files/run/getClassTest-valueClass.check @@ -0,0 +1,2 @@ +int +class V diff --git a/test/files/run/getClassTest-valueClass.scala b/test/files/run/getClassTest-valueClass.scala new file mode 100644 index 0000000000..05a116dfff --- /dev/null +++ b/test/files/run/getClassTest-valueClass.scala @@ -0,0 +1,10 @@ +class V(val x: Int) extends AnyVal + +object Test { + def main(args: Array[String]) = { + val v = new V(2) + val s: Any = 2 + println(2.getClass) + println(v.getClass) + } +} diff --git a/test/files/run/interop_classtags_are_classmanifests.check b/test/files/run/interop_classtags_are_classmanifests.check index 7a0a829af2..c07ed0e657 100644 --- a/test/files/run/interop_classtags_are_classmanifests.check +++ b/test/files/run/interop_classtags_are_classmanifests.check @@ -1,3 +1,3 @@ -ClassTag[int]
-ClassTag[class java.lang.String]
-ClassTag[class [I]
+Int
+java.lang.String
+Array[int]
diff --git a/test/files/run/interop_manifests_are_abstypetags.scala b/test/files/run/interop_manifests_are_abstypetags.scala index 1cba2fdb4b..f2c2723106 100644 --- a/test/files/run/interop_manifests_are_abstypetags.scala +++ b/test/files/run/interop_manifests_are_abstypetags.scala @@ -1,11 +1,11 @@ import scala.reflect.runtime.universe._ object Test extends App { - def manifestIsAbsTypeTag[T: Manifest] = { - println(implicitly[AbsTypeTag[T]].tpe) + def manifestIsWeakTypeTag[T: Manifest] = { + println(implicitly[WeakTypeTag[T]].tpe) } - manifestIsAbsTypeTag[Int] - manifestIsAbsTypeTag[String] - manifestIsAbsTypeTag[Array[Int]] + manifestIsWeakTypeTag[Int] + manifestIsWeakTypeTag[String] + manifestIsWeakTypeTag[Array[Int]] }
\ No newline at end of file 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-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-d1/Impls_Macros_1.scala b/test/files/run/macro-def-path-dependent-d1/Impls_Macros_1.scala index 2daf6fc3fb..69d9708b2a 100644 --- a/test/files/run/macro-def-path-dependent-d1/Impls_Macros_1.scala +++ b/test/files/run/macro-def-path-dependent-d1/Impls_Macros_1.scala @@ -5,5 +5,5 @@ import scala.reflect.api.Universe object Test { def materializeTypeTag[T](u: Universe)(e: T) = macro materializeTypeTag_impl[T] - def materializeTypeTag_impl[T: c.AbsTypeTag](c: Context)(u: c.Expr[Universe])(e: c.Expr[T]): c.Expr[u.value.TypeTag[T]] = ??? + def materializeTypeTag_impl[T: c.WeakTypeTag](c: Context)(u: c.Expr[Universe])(e: c.Expr[T]): c.Expr[u.value.TypeTag[T]] = ??? }
\ No newline at end of file diff --git a/test/files/run/macro-def-path-dependent-d2/Impls_1.scala b/test/files/run/macro-def-path-dependent-d2/Impls_1.scala index 1cda64e43e..7fa9c3579e 100644 --- a/test/files/run/macro-def-path-dependent-d2/Impls_1.scala +++ b/test/files/run/macro-def-path-dependent-d2/Impls_1.scala @@ -3,5 +3,5 @@ import scala.reflect.macros.Context import scala.reflect.api.Universe object Impls { - def materializeTypeTag_impl[T: c.AbsTypeTag](c: Context)(u: c.Expr[Universe])(e: c.Expr[T]): c.Expr[u.value.TypeTag[T]] = ??? + def materializeTypeTag_impl[T: c.WeakTypeTag](c: Context)(u: c.Expr[Universe])(e: c.Expr[T]): c.Expr[u.value.TypeTag[T]] = ??? }
\ No newline at end of file diff --git a/test/files/run/macro-expand-implicit-argument/Macros_1.scala b/test/files/run/macro-expand-implicit-argument/Macros_1.scala index 7629c5a9e2..86c4198870 100644 --- a/test/files/run/macro-expand-implicit-argument/Macros_1.scala +++ b/test/files/run/macro-expand-implicit-argument/Macros_1.scala @@ -35,7 +35,7 @@ object Macros { * arr * } */ - def arrayMacro[A:c.AbsTypeTag](c:Context)(as:c.Expr[A]*)(ct: c.Expr[ClassTag[A]]): c.Expr[Array[A]] = { + def arrayMacro[A:c.WeakTypeTag](c:Context)(as:c.Expr[A]*)(ct: c.Expr[ClassTag[A]]): c.Expr[Array[A]] = { import c.mirror._ import c.universe._ def const(x:Int) = Literal(Constant(x)) @@ -44,7 +44,7 @@ object Macros { val arr = newTermName("arr") val create = Apply(Select(ct.tree, "newArray"), List(const(n))) - val arrtpe = TypeTree(implicitly[c.AbsTypeTag[Array[A]]].tpe) + val arrtpe = TypeTree(implicitly[c.WeakTypeTag[Array[A]]].tpe) val valdef = ValDef(Modifiers(), arr, arrtpe, create) val updates = (0 until n).map { diff --git a/test/files/run/macro-expand-nullary-generic/Impls_1.scala b/test/files/run/macro-expand-nullary-generic/Impls_1.scala index fbbc23a824..1180c83a40 100644 --- a/test/files/run/macro-expand-nullary-generic/Impls_1.scala +++ b/test/files/run/macro-expand-nullary-generic/Impls_1.scala @@ -2,14 +2,14 @@ import scala.reflect.runtime.universe._ import scala.reflect.macros.{Context => Ctx} object Impls { - def impl[T: c.AbsTypeTag](c: Ctx) = { + def impl[T: c.WeakTypeTag](c: Ctx) = { import c.universe._ - val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works " + implicitly[c.AbsTypeTag[T]])))) + val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works " + implicitly[c.WeakTypeTag[T]])))) c.Expr[Unit](body) } - def fooNullary[T: c.AbsTypeTag](c: Ctx) = impl[T](c) - def fooEmpty[T: c.AbsTypeTag](c: Ctx)() = impl[T](c) - def barNullary[T: c.AbsTypeTag](c: Ctx)(x: c.Expr[Int]) = impl[T](c) - def barEmpty[T: c.AbsTypeTag](c: Ctx)(x: c.Expr[Int])() = impl[T](c) + def fooNullary[T: c.WeakTypeTag](c: Ctx) = impl[T](c) + def fooEmpty[T: c.WeakTypeTag](c: Ctx)() = impl[T](c) + def barNullary[T: c.WeakTypeTag](c: Ctx)(x: c.Expr[Int]) = impl[T](c) + def barEmpty[T: c.WeakTypeTag](c: Ctx)(x: c.Expr[Int])() = impl[T](c) }
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-explicit/Impls_1.scala b/test/files/run/macro-expand-tparams-explicit/Impls_1.scala index 0a879687e8..72b420d92f 100644 --- a/test/files/run/macro-expand-tparams-explicit/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-explicit/Impls_1.scala @@ -2,9 +2,9 @@ import scala.reflect.runtime.universe._ import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[U: c.AbsTypeTag](c: Ctx) = { + def foo[U: c.WeakTypeTag](c: Ctx) = { import c.universe._ - val U = implicitly[c.AbsTypeTag[U]] + val U = implicitly[c.WeakTypeTag[U]] val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(U.toString)))) c.Expr[Unit](body) } diff --git a/test/files/run/macro-expand-tparams-implicit.check b/test/files/run/macro-expand-tparams-implicit.check index 80c6b826ba..37226ec68d 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]
-TypeTag[String]
+WeakTypeTag[String]
diff --git a/test/files/run/macro-expand-tparams-implicit/Impls_1.scala b/test/files/run/macro-expand-tparams-implicit/Impls_1.scala index f6cb63b9c9..33770516df 100644 --- a/test/files/run/macro-expand-tparams-implicit/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-implicit/Impls_1.scala @@ -2,9 +2,9 @@ import scala.reflect.runtime.universe._ import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[U: c.AbsTypeTag](c: Ctx)(x: c.Expr[U]) = { + def foo[U: c.WeakTypeTag](c: Ctx)(x: c.Expr[U]) = { import c.universe._ - val U = implicitly[c.AbsTypeTag[U]] + val U = implicitly[c.WeakTypeTag[U]] val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(U.toString)))) c.Expr[Unit](body) } diff --git a/test/files/run/macro-expand-tparams-prefix-a.check b/test/files/run/macro-expand-tparams-prefix-a.check index 6c23b47d64..7ef9fa7330 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]
-TypeTag[String]
+WeakTypeTag[String]
TypeTag[Boolean]
diff --git a/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala index f6cb63b9c9..33770516df 100644 --- a/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala @@ -2,9 +2,9 @@ import scala.reflect.runtime.universe._ import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[U: c.AbsTypeTag](c: Ctx)(x: c.Expr[U]) = { + def foo[U: c.WeakTypeTag](c: Ctx)(x: c.Expr[U]) = { import c.universe._ - val U = implicitly[c.AbsTypeTag[U]] + val U = implicitly[c.WeakTypeTag[U]] val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(U.toString)))) c.Expr[Unit](body) } diff --git a/test/files/run/macro-expand-tparams-prefix-b.check b/test/files/run/macro-expand-tparams-prefix-b.check index 67dabff11e..f4a2a8e80d 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] TypeTag[String]
+TypeTag[Boolean] WeakTypeTag[String]
diff --git a/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala index 7e0fa26569..9378e67712 100644 --- a/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala @@ -2,10 +2,10 @@ import scala.reflect.runtime.universe._ import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[T: c.AbsTypeTag, U: c.AbsTypeTag](c: Ctx)(x: c.Expr[U]) = { + def foo[T: c.WeakTypeTag, U: c.WeakTypeTag](c: Ctx)(x: c.Expr[U]) = { import c.universe._ - val T = implicitly[c.AbsTypeTag[T]] - val U = implicitly[c.AbsTypeTag[U]] + val T = implicitly[c.WeakTypeTag[T]] + val U = implicitly[c.WeakTypeTag[U]] val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString + " " + U.toString)))) c.Expr[Unit](body) } diff --git a/test/files/run/macro-expand-tparams-prefix-c1.check b/test/files/run/macro-expand-tparams-prefix-c1.check index 8d1c4e3416..473668ac58 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]
-TypeTag[String]
+WeakTypeTag[String]
TypeTag[Boolean]
diff --git a/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala index ca515be627..afdd7d4f7a 100644 --- a/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala @@ -2,11 +2,11 @@ import scala.reflect.runtime.universe._ import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[T, U: c.AbsTypeTag, V](c: Ctx)(implicit T: c.AbsTypeTag[T], V: c.AbsTypeTag[V]): c.Expr[Unit] = { + def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = { import c.universe._ c.Expr(Block(List( Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.AbsTypeTag[U]].toString)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))), Literal(Constant(())))) } diff --git a/test/files/run/macro-expand-tparams-prefix-c2.check b/test/files/run/macro-expand-tparams-prefix-c2.check index 8d1c4e3416..473668ac58 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]
-TypeTag[String]
+WeakTypeTag[String]
TypeTag[Boolean]
diff --git a/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala b/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala index 5a554590d8..3c2838208a 100644 --- a/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala +++ b/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala @@ -2,11 +2,11 @@ import scala.reflect.runtime.universe._ import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[T, U: c.AbsTypeTag, V](c: Ctx)(implicit T: c.AbsTypeTag[T], V: c.AbsTypeTag[V]): c.Expr[Unit] = { + def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = { import c.universe._ c.Expr(Block(List( Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.AbsTypeTag[U]].toString)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))), Literal(Constant(())))) } diff --git a/test/files/run/macro-expand-tparams-prefix-d1.check b/test/files/run/macro-expand-tparams-prefix-d1.check index 319edfbed0..2331e2549e 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 @@ -AbsTypeTag[T]
-AbsTypeTag[U]
+WeakTypeTag[T]
+WeakTypeTag[U]
TypeTag[Boolean]
diff --git a/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala index ca515be627..afdd7d4f7a 100644 --- a/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala @@ -2,11 +2,11 @@ import scala.reflect.runtime.universe._ import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[T, U: c.AbsTypeTag, V](c: Ctx)(implicit T: c.AbsTypeTag[T], V: c.AbsTypeTag[V]): c.Expr[Unit] = { + def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = { import c.universe._ c.Expr(Block(List( Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.AbsTypeTag[U]].toString)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))), Literal(Constant(())))) } 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-impl-default-params/Impls_Macros_1.scala b/test/files/run/macro-impl-default-params/Impls_Macros_1.scala index 06c58d96ab..db77b1923a 100644 --- a/test/files/run/macro-impl-default-params/Impls_Macros_1.scala +++ b/test/files/run/macro-impl-default-params/Impls_Macros_1.scala @@ -2,10 +2,10 @@ import scala.reflect.runtime.universe._ import scala.reflect.macros.{Context => Ctx} object Impls { - def foo_targs[T, U: c.AbsTypeTag](c: Ctx = null)(x: c.Expr[Int] = null) = { + def foo_targs[T, U: c.WeakTypeTag](c: Ctx = null)(x: c.Expr[Int] = null) = { import c.{prefix => prefix} import c.universe._ - val U = implicitly[c.AbsTypeTag[U]] + val U = implicitly[c.WeakTypeTag[U]] val body = Block( Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("invoking foo_targs...")))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("type of prefix is: " + prefix.staticType)))), 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/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/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/Impls_Macros_1.scala b/test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala index a54b7f4b08..4583a726cf 100644 --- a/test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala +++ b/test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala @@ -1,7 +1,7 @@ import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[T: c.AbsTypeTag](c: Ctx)(x: c.Expr[T]) = { + def foo[T: c.WeakTypeTag](c: Ctx)(x: c.Expr[T]) = { import c.universe._ val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(x.tree.toString)))) c.Expr[Unit](body) 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/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-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/Test.scala b/test/files/run/macro-reify-abstypetag-notypeparams/Test.scala index 34f742b9fb..73c2d05921 100644 --- a/test/files/run/macro-reify-abstypetag-notypeparams/Test.scala +++ b/test/files/run/macro-reify-abstypetag-notypeparams/Test.scala @@ -1,6 +1,6 @@ import scala.reflect.runtime.universe._ object Test extends App { - println(implicitly[AbsTypeTag[Int]]) - println(implicitly[AbsTypeTag[List[Int]]]) + println(implicitly[WeakTypeTag[Int]]) + println(implicitly[WeakTypeTag[List[Int]]]) }
\ No newline at end of file diff --git a/test/files/run/macro-reify-abstypetag-typeparams-notags.check b/test/files/run/macro-reify-abstypetag-typeparams-notags.check index be62b59a69..6aeec96079 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 @@ -AbsTypeTag[T]
-AbsTypeTag[List[T]]
+WeakTypeTag[T]
+WeakTypeTag[List[T]]
diff --git a/test/files/run/macro-reify-abstypetag-typeparams-notags/Test.scala b/test/files/run/macro-reify-abstypetag-typeparams-notags/Test.scala index 0b42cc07b5..4ba2231d9a 100644 --- a/test/files/run/macro-reify-abstypetag-typeparams-notags/Test.scala +++ b/test/files/run/macro-reify-abstypetag-typeparams-notags/Test.scala @@ -2,8 +2,8 @@ import scala.reflect.runtime.universe._ object Test extends App { def fooNoTypeTag[T] = { - println(implicitly[AbsTypeTag[T]]) - println(implicitly[AbsTypeTag[List[T]]]) + println(implicitly[WeakTypeTag[T]]) + println(implicitly[WeakTypeTag[List[T]]]) } fooNoTypeTag[Int] }
\ No newline at end of file diff --git a/test/files/run/macro-reify-abstypetag-typeparams-tags.check b/test/files/run/macro-reify-abstypetag-typeparams-tags.check index d6ca5a85ef..6e2646c5e0 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]
-AbsTypeTag[List[Int]]
+WeakTypeTag[List[Int]]
diff --git a/test/files/run/macro-reify-abstypetag-typeparams-tags/Test.scala b/test/files/run/macro-reify-abstypetag-typeparams-tags/Test.scala index 82a7b7971d..70ca615e1f 100644 --- a/test/files/run/macro-reify-abstypetag-typeparams-tags/Test.scala +++ b/test/files/run/macro-reify-abstypetag-typeparams-tags/Test.scala @@ -1,9 +1,9 @@ import scala.reflect.runtime.universe._ object Test extends App { - def fooTypeTag[T: AbsTypeTag] = { - println(implicitly[AbsTypeTag[T]]) - println(implicitly[AbsTypeTag[List[T]]]) + def fooTypeTag[T: WeakTypeTag] = { + println(implicitly[WeakTypeTag[T]]) + println(implicitly[WeakTypeTag[List[T]]]) } fooTypeTag[Int] }
\ No newline at end of file diff --git a/test/files/run/macro-reify-abstypetag-usetypetag.check b/test/files/run/macro-reify-abstypetag-usetypetag.check index d6ca5a85ef..6e2646c5e0 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]
-AbsTypeTag[List[Int]]
+WeakTypeTag[List[Int]]
diff --git a/test/files/run/macro-reify-abstypetag-usetypetag/Test.scala b/test/files/run/macro-reify-abstypetag-usetypetag/Test.scala index 3c62725c42..ecae4110a8 100644 --- a/test/files/run/macro-reify-abstypetag-usetypetag/Test.scala +++ b/test/files/run/macro-reify-abstypetag-usetypetag/Test.scala @@ -2,8 +2,8 @@ import scala.reflect.runtime.universe._ object Test extends App { def fooTypeTag[T: TypeTag] = { - println(implicitly[AbsTypeTag[T]]) - println(implicitly[AbsTypeTag[List[T]]]) + println(implicitly[WeakTypeTag[T]]) + println(implicitly[WeakTypeTag[List[T]]]) } fooTypeTag[Int] }
\ No newline at end of file diff --git a/test/files/run/macro-reify-freevars/Macros_1.scala b/test/files/run/macro-reify-freevars/Macros_1.scala index 57fdc32437..20f80c06d1 100644 --- a/test/files/run/macro-reify-freevars/Macros_1.scala +++ b/test/files/run/macro-reify-freevars/Macros_1.scala @@ -1,7 +1,7 @@ package scala.collection.slick object QueryableMacros{ - def map[T:c.AbsTypeTag, S:c.AbsTypeTag] + def map[T:c.WeakTypeTag, S:c.WeakTypeTag] (c: scala.reflect.macros.Context) (projection: c.Expr[T => S]) : c.Expr[scala.collection.slick.Queryable[S]] = { 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 04714970dd..ae2def2d3e 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 @@ -21,9 +21,9 @@ case class Utils[C <: Context]( c:C ) { } } object QueryableMacros{ - def _helper[C <: Context,S:c.AbsTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = { + def _helper[C <: Context,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = { import c.universe._ - val element_type = implicitly[c.AbsTypeTag[S]].tpe + val element_type = implicitly[c.WeakTypeTag[S]].tpe val foo = c.Expr[ru.Expr[Queryable[S]]]( c.reifyTree( c.runtimeUniverse, EmptyTree, c.typeCheck( Utils[c.type](c).removeDoubleReify( @@ -32,7 +32,7 @@ object QueryableMacros{ ))) c.universe.reify{ Queryable.factory[S]( foo.splice )} } - def map[T:c.AbsTypeTag, S:c.AbsTypeTag] + def map[T:c.WeakTypeTag, S:c.WeakTypeTag] (c: scala.reflect.macros.Context) (projection: c.Expr[T => S]): c.Expr[Queryable[S]] = _helper[c.type,S]( c )( "_map", projection ) } 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 04714970dd..ae2def2d3e 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 @@ -21,9 +21,9 @@ case class Utils[C <: Context]( c:C ) { } } object QueryableMacros{ - def _helper[C <: Context,S:c.AbsTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = { + def _helper[C <: Context,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = { import c.universe._ - val element_type = implicitly[c.AbsTypeTag[S]].tpe + val element_type = implicitly[c.WeakTypeTag[S]].tpe val foo = c.Expr[ru.Expr[Queryable[S]]]( c.reifyTree( c.runtimeUniverse, EmptyTree, c.typeCheck( Utils[c.type](c).removeDoubleReify( @@ -32,7 +32,7 @@ object QueryableMacros{ ))) c.universe.reify{ Queryable.factory[S]( foo.splice )} } - def map[T:c.AbsTypeTag, S:c.AbsTypeTag] + def map[T:c.WeakTypeTag, S:c.WeakTypeTag] (c: scala.reflect.macros.Context) (projection: c.Expr[T => S]): c.Expr[Queryable[S]] = _helper[c.type,S]( c )( "_map", projection ) } 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..b23a5c70e1 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 @@ -15,7 +15,7 @@ object Impls { 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] + toolBox.eval(imported).asInstanceOf[T] } } 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-tagful-a/Macros_1.scala b/test/files/run/macro-reify-tagful-a/Macros_1.scala index 0eac74236f..f2512dcfaf 100644 --- a/test/files/run/macro-reify-tagful-a/Macros_1.scala +++ b/test/files/run/macro-reify-tagful-a/Macros_1.scala @@ -5,7 +5,7 @@ object Macros { def foo[T](s: T) = macro Impls.foo[T] object Impls { - def foo[T: c.AbsTypeTag](c: Ctx)(s: c.Expr[T]) = c.universe.reify { + def foo[T: c.WeakTypeTag](c: Ctx)(s: c.Expr[T]) = c.universe.reify { List(s.splice) } } diff --git a/test/files/run/macro-reify-tagless-a.check b/test/files/run/macro-reify-tagless-a.check index d69f641280..c2385ba008 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.AbsTypeTag annotation for this type parameter? If you have troubles tracking free type variables, consider using -Xlog-free-types
+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-typecheck-macrosdisabled/Impls_Macros_1.scala b/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala index b2f6f7d50e..f693ad78cc 100644 --- a/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala +++ b/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala @@ -18,7 +18,8 @@ object Macros { val rupkg = c.mirror.staticModule("scala.reflect.runtime.package") val rusym = build.selectTerm(rupkg, "universe") val NullaryMethodType(rutpe) = rusym.typeSignature - val ru = build.newFreeTerm("ru", rutpe, scala.reflect.runtime.universe) + val ru = build.newFreeTerm("ru", scala.reflect.runtime.universe) + build.setTypeSignature(ru, rutpe) val tree2 = Apply(Select(Ident(ru), newTermName("reify")), List(Literal(Constant(2)))) val ttree2 = c.typeCheck(tree2, withMacrosDisabled = true) diff --git a/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala b/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala index 948c047351..1dbf5a1a87 100644 --- a/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala +++ b/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala @@ -18,7 +18,8 @@ object Macros { val rupkg = c.mirror.staticModule("scala.reflect.runtime.package") val rusym = build.selectTerm(rupkg, "universe") val NullaryMethodType(rutpe) = rusym.typeSignature - val ru = build.newFreeTerm("ru", rutpe, scala.reflect.runtime.universe) + val ru = build.newFreeTerm("ru", scala.reflect.runtime.universe) + build.setTypeSignature(ru, rutpe) val tree2 = Apply(Select(Ident(ru), newTermName("reify")), List(Apply(Select(Ident(newTermName("scala")), newTermName("Array")), List(Literal(Constant(2)))))) val ttree2 = c.typeCheck(tree2, withMacrosDisabled = true) diff --git a/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala b/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala index 3d350a50fa..bcbd12817b 100644 --- a/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala +++ b/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala @@ -2,13 +2,13 @@ import scala.reflect.runtime.universe._ import scala.reflect.macros.Context object Macros { - def cons_impl[A: c.AbsTypeTag](c: Context)(x: c.Expr[A], xs: c.Expr[List[A]]): c.Expr[List[A]] = c.universe.reify { - println("A = " + c.literal(implicitly[c.AbsTypeTag[A]].toString).splice) + def cons_impl[A: c.WeakTypeTag](c: Context)(x: c.Expr[A], xs: c.Expr[List[A]]): c.Expr[List[A]] = c.universe.reify { + println("A = " + c.literal(implicitly[c.WeakTypeTag[A]].toString).splice) x.splice :: xs.splice } - def nil_impl[B: c.AbsTypeTag](c: Context): c.Expr[List[B]] = c.universe.reify { - println("B = " + c.literal(implicitly[c.AbsTypeTag[B]].toString).splice) + def nil_impl[B: c.WeakTypeTag](c: Context): c.Expr[List[B]] = c.universe.reify { + println("B = " + c.literal(implicitly[c.WeakTypeTag[B]].toString).splice) Nil } diff --git a/test/files/run/macro-undetparams-macroitself.check b/test/files/run/macro-undetparams-macroitself.check index 80c6b826ba..37226ec68d 100644 --- a/test/files/run/macro-undetparams-macroitself.check +++ b/test/files/run/macro-undetparams-macroitself.check @@ -1,2 +1,2 @@ TypeTag[Int]
-TypeTag[String]
+WeakTypeTag[String]
diff --git a/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala b/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala index 081894cf52..0244273b6f 100644 --- a/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala +++ b/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala @@ -2,7 +2,7 @@ import scala.reflect.runtime.universe._ import scala.reflect.macros.Context object Macros { - def impl[T: c.AbsTypeTag](c: Context)(foo: c.Expr[T]): c.Expr[Unit] = c.universe.reify { println(c.literal(implicitly[c.AbsTypeTag[T]].toString).splice) } + def impl[T: c.WeakTypeTag](c: Context)(foo: c.Expr[T]): c.Expr[Unit] = c.universe.reify { println(c.literal(implicitly[c.WeakTypeTag[T]].toString).splice) } def foo[T](foo: T) = macro impl[T] }
\ No newline at end of file diff --git a/test/files/run/partialfun.check b/test/files/run/partialfun.check new file mode 100644 index 0000000000..a317f7b150 --- /dev/null +++ b/test/files/run/partialfun.check @@ -0,0 +1,6 @@ +47
+147
+100
+0:isDefinedAt
+1:isDefinedAt
+2:apply
diff --git a/test/files/run/partialfun.scala b/test/files/run/partialfun.scala new file mode 100644 index 0000000000..4b360750c9 --- /dev/null +++ b/test/files/run/partialfun.scala @@ -0,0 +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()
+ }
+}
diff --git a/test/files/run/pure-args-byname-noinline.check b/test/files/run/pure-args-byname-noinline.check new file mode 100644 index 0000000000..a39c61eb64 --- /dev/null +++ b/test/files/run/pure-args-byname-noinline.check @@ -0,0 +1,12 @@ +2 +2 +2 +2 +List(1) +List() + +1 +1 +1 +1 +1 diff --git a/test/files/run/pure-args-byname-noinline.scala b/test/files/run/pure-args-byname-noinline.scala new file mode 100644 index 0000000000..5c5c8a7eb6 --- /dev/null +++ b/test/files/run/pure-args-byname-noinline.scala @@ -0,0 +1,33 @@ +object Test { + //Were affected by SI-6306 + def f[A](a: =>A) = println(a.toString) + def f1[A <: AnyVal](a: =>A) = println(a.toString) + def f1a[A <: AnyVal](a: =>A) = println(a.##) + def f2[A <: AnyRef](a: =>A) = println(a.toString) + def f2a[A <: String](a: =>A) = println(a.toString) + //Works + def f3[A](a: =>Seq[A]) = println(a.toString) + + def foo() = println(2) + def client(f: () => Unit) = {f(); f()} + def attempt2() { + val bar: () => Unit = foo _ + //The code causing SI-6306 was supposed to optimize code like this: + client(() => bar ()) + //to: + client(bar) + } + def main(args: Array[String]) { + attempt2() + f3(Seq(1)) + f3(Seq()) + f("") + f((1).toString) + f((1).##) + f1((1).##) + f2((1).toString) + f2a((1).toString) + } +} + +// vim: set ts=8 sw=2 et: diff --git a/test/files/run/reflection-equality.check b/test/files/run/reflection-equality.check index be531fbbd3..17c1f6dd70 100644 --- a/test/files/run/reflection-equality.check +++ b/test/files/run/reflection-equality.check @@ -1,53 +1,53 @@ -Type in expressions to have them evaluated.
-Type :help for more information.
-
-scala>
-
-scala> class X {
- def methodIntIntInt(x: Int, y: Int) = x+y
-}
-defined class X
-
-scala>
-
-scala> import scala.reflect.runtime.universe._
-import scala.reflect.runtime.universe._
-
-scala> import scala.reflect.runtime.{ currentMirror => cm }
-import scala.reflect.runtime.{currentMirror=>cm}
-
-scala> def im: InstanceMirror = cm.reflect(new X)
-im: reflect.runtime.universe.InstanceMirror
-
-scala> val cs: ClassSymbol = im.symbol
-cs: reflect.runtime.universe.ClassSymbol = class X
-
-scala> val ts: Type = cs.typeSignature
-ts: reflect.runtime.universe.Type =
-java.lang.Object {
- def <init>: <?>
- def methodIntIntInt: <?>
-}
-
-scala> val ms: MethodSymbol = ts.declaration(newTermName("methodIntIntInt")).asMethod
-ms: reflect.runtime.universe.MethodSymbol = method methodIntIntInt
-
-scala> val MethodType( _, t1 ) = ms.typeSignature
-t1: reflect.runtime.universe.Type = scala.Int
-
-scala> val t2 = typeOf[scala.Int]
-t2: reflect.runtime.universe.Type = Int
-
-scala> t1 == t2
-res0: Boolean = false
-
-scala> t1 =:= t2
-res1: Boolean = true
-
-scala> t1 <:< t2
-res2: Boolean = true
-
-scala> t2 <:< t1
-res3: Boolean = true
-
-scala>
+Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> class X { + def methodIntIntInt(x: Int, y: Int) = x+y +} +defined class X + +scala> + +scala> import scala.reflect.runtime.universe._ +import scala.reflect.runtime.universe._ + +scala> import scala.reflect.runtime.{ currentMirror => cm } +import scala.reflect.runtime.{currentMirror=>cm} + +scala> def im: InstanceMirror = cm.reflect(new X) +im: reflect.runtime.universe.InstanceMirror + +scala> val cs: ClassSymbol = im.symbol +cs: reflect.runtime.universe.ClassSymbol = class X + +scala> val ts: Type = cs.typeSignature +ts: reflect.runtime.universe.Type = +java.lang.Object { + def <init>(): X + def methodIntIntInt(x: scala.Int,y: scala.Int): scala.Int +} + +scala> val ms: MethodSymbol = ts.declaration(newTermName("methodIntIntInt")).asMethod +ms: reflect.runtime.universe.MethodSymbol = method methodIntIntInt + +scala> val MethodType( _, t1 ) = ms.typeSignature +t1: reflect.runtime.universe.Type = scala.Int + +scala> val t2 = typeOf[scala.Int] +t2: reflect.runtime.universe.Type = Int + +scala> t1 == t2 +res0: Boolean = false + +scala> t1 =:= t2 +res1: Boolean = true + +scala> t1 <:< t2 +res2: Boolean = true + +scala> t2 <:< t1 +res3: Boolean = true + +scala> diff --git a/test/files/run/reflection-fieldmirror-accessorsareokay.scala b/test/files/run/reflection-fieldmirror-accessorsareokay.scala index 9590cbe811..16354025f3 100644 --- a/test/files/run/reflection-fieldmirror-accessorsareokay.scala +++ b/test/files/run/reflection-fieldmirror-accessorsareokay.scala @@ -14,7 +14,7 @@ object Test extends App { def test(f: Symbol) = { try { val fm: FieldMirror = im.reflectField(f.asTerm) - println(fm.symbol.isVariable) + println(fm.symbol.isVar) println(fm.get) fm.set(2) println(fm.get) diff --git a/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala b/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala index 5cfe583ed5..2b4a9bb55e 100644 --- a/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala +++ b/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala @@ -12,5 +12,5 @@ object Test extends App { val cs = im.symbol val f = cs.typeSignature.declaration(newTermName("x" + nme.LOCAL_SUFFIX_STRING)).asTerm val fm: FieldMirror = im.reflectField(f) - println(fm.symbol.isVariable) + println(fm.symbol.isVar) } diff --git a/test/files/run/reflection-fieldmirror-privatethis.scala b/test/files/run/reflection-fieldmirror-privatethis.scala index 7aa179958d..ab838dbb1b 100644 --- a/test/files/run/reflection-fieldmirror-privatethis.scala +++ b/test/files/run/reflection-fieldmirror-privatethis.scala @@ -12,7 +12,7 @@ object Test extends App { val cs = im.symbol val f = cs.typeSignature.declaration(newTermName("x")).asTerm val fm: FieldMirror = im.reflectField(f) - println(fm.symbol.isVariable) + println(fm.symbol.isVar) println(fm.get) fm.set(2) println(fm.get) diff --git a/test/files/run/reflection-fieldsymbol-navigation.scala b/test/files/run/reflection-fieldsymbol-navigation.scala index da4612a564..4448724988 100644 --- a/test/files/run/reflection-fieldsymbol-navigation.scala +++ b/test/files/run/reflection-fieldsymbol-navigation.scala @@ -7,9 +7,9 @@ class C { object Test extends App { val x = typeOf[C].member(newTermName("x")).asTerm println(x) - println(x.isVariable) + println(x.isVar) println(x.accessed) - println(x.accessed.asTerm.isVariable) + println(x.accessed.asTerm.isVar) println(x.getter) println(x.setter) }
\ No newline at end of file diff --git a/test/files/run/reflection-implicit.check b/test/files/run/reflection-implicit.check new file mode 100644 index 0000000000..bab1518c45 --- /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..0b16c0d103 --- /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.getAnnotations foreach (_.javaArgs) + println(sym.getAnnotations) +}
\ 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/reify_ann1a.scala b/test/files/run/reify_ann1a.scala index 754baef6b7..88b4191195 100644 --- a/test/files/run/reify_ann1a.scala +++ b/test/files/run/reify_ann1a.scala @@ -25,5 +25,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_ann1b.scala b/test/files/run/reify_ann1b.scala index eb00b4cb10..a8fb876023 100644 --- a/test/files/run/reify_ann1b.scala +++ b/test/files/run/reify_ann1b.scala @@ -25,5 +25,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_ann2a.scala b/test/files/run/reify_ann2a.scala index 9f901d86bd..b7e5833584 100644 --- a/test/files/run/reify_ann2a.scala +++ b/test/files/run/reify_ann2a.scala @@ -25,5 +25,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_ann3.scala b/test/files/run/reify_ann3.scala index cbf1e10063..662d58aaf3 100644 --- a/test/files/run/reify_ann3.scala +++ b/test/files/run/reify_ann3.scala @@ -19,5 +19,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_ann4.scala b/test/files/run/reify_ann4.scala index 58c8c2c521..a85e5e3625 100644 --- a/test/files/run/reify_ann4.scala +++ b/test/files/run/reify_ann4.scala @@ -23,5 +23,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_ann5.scala b/test/files/run/reify_ann5.scala index 801db07960..877360180c 100644 --- a/test/files/run/reify_ann5.scala +++ b/test/files/run/reify_ann5.scala @@ -20,5 +20,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_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.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.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.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.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.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.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_26.check b/test/files/run/reify_newimpl_26.check index c006cb7ffb..5996f3b322 100644 --- a/test/files/run/reify_newimpl_26.check +++ b/test/files/run/reify_newimpl_26.check @@ -5,16 +5,16 @@ scala> scala> def foo[T]{
import scala.reflect.runtime.universe._
- val tt = implicitly[AbsTypeTag[List[T]]]
+ 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[AbsTypeTag[List[T]]]
+ val tt = implicitly[WeakTypeTag[List[T]]]
^
foo: [T]=> Unit
scala> foo[Int]
-AbsTypeTag[scala.List[T]]
+WeakTypeTag[scala.List[T]]
scala>
diff --git a/test/files/run/reify_newimpl_26.scala b/test/files/run/reify_newimpl_26.scala index a12d8a2970..af74d60e8b 100644 --- a/test/files/run/reify_newimpl_26.scala +++ b/test/files/run/reify_newimpl_26.scala @@ -5,7 +5,7 @@ object Test extends ReplTest { def code = """ def foo[T]{ import scala.reflect.runtime.universe._ - val tt = implicitly[AbsTypeTag[List[T]]] + val tt = implicitly[WeakTypeTag[List[T]]] println(tt) } foo[Int] 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/richWrapperEquals.scala b/test/files/run/richWrapperEquals.scala index 44beb133b3..4a43617cde 100644 --- a/test/files/run/richWrapperEquals.scala +++ b/test/files/run/richWrapperEquals.scala @@ -1,10 +1,6 @@ object Test { def main(args: Array[String]): Unit = { - assert(intWrapper(5) == 5) - assert(5 == intWrapper(5)) assert(5 == (5: java.lang.Integer)) assert((5: java.lang.Integer) == 5) - assert((5: java.lang.Integer) == intWrapper(5)) - assert(intWrapper(5) == (5: java.lang.Integer)) } } diff --git a/test/files/run/static-annot-repl.check b/test/files/run/static-annot-repl.check deleted file mode 100644 index d1029a9809..0000000000 --- a/test/files/run/static-annot-repl.check +++ /dev/null @@ -1,32 +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 -x3: Int - -scala> x1 -res0: Int = 42 - -scala> x2 -res1: Int = 43 - -scala> x3 -res2: Int = 44 - -scala> class Test { - @static def x = 42 -} -defined class Test - -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.scala b/test/files/run/t1195-new.scala index 4edfb5073f..0f62b140c9 100644 --- a/test/files/run/t1195-new.scala +++ b/test/files/run/t1195-new.scala @@ -9,7 +9,7 @@ object Test { val g1 = g() val h1 = h() - def m[T: TypeTag](x: T) = println(typeOf[T] + ", underlying = " + typeOf[T].typeSymbol.typeSignature) + def m[T: WeakTypeTag](x: T) = println(weakTypeOf[T] + ", underlying = " + weakTypeOf[T].typeSymbol.typeSignature) def main(args: Array[String]): Unit = { m(f) 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/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/t4813.scala b/test/files/run/t4813.scala new file mode 100644 index 0000000000..6d48ca8758 --- /dev/null +++ b/test/files/run/t4813.scala @@ -0,0 +1,37 @@ +import collection.mutable._ +import reflect._ + + +object Test extends App { + def runTest[T, U](col: T)(clone: T => U)(mod: T => Unit)(implicit ct: ClassTag[T]): Unit = { + val cloned = clone(col) + assert(cloned == col, s"cloned should be equal to original. $cloned != $col") + mod(col) + assert(cloned != col, s"cloned should not modify when original does: $ct") + } + + // Seqs + runTest(ArrayBuffer(1,2,3))(_.clone) { buf => buf transform (_ + 1) } + runTest(ArraySeq(1,2,3))(_.clone) { buf => buf transform (_ + 1) } + runTest(Buffer(1,2,3))(_.clone) { buf => buf transform (_ + 1) } + runTest(DoubleLinkedList(1,2,3))(_.clone) { buf => buf transform (_ + 1) } + runTest(IndexedSeq(1,2,3))(_.clone) { buf => buf transform (_ + 1) } + runTest(LinearSeq(1,2,3))(_.clone) { buf => buf transform (_ + 1) } + runTest(LinkedList(1,2,3))(_.clone) { buf => buf transform (_ + 1) } + runTest(ListBuffer(1,2,3))(_.clone) { buf => buf transform (_ + 1) } + runTest(MutableList(1,2,3))(_.clone) { buf => buf transform (_ + 1) } + runTest(Queue(1,2,3))(_.clone) { buf => buf transform (_ + 1) } + runTest(Stack(1,2,3))(_.clone) { buf => buf transform (_ + 1) } + + // Sets + runTest(BitSet(1,2,3))(_.clone) { buf => buf add 4 } + runTest(HashSet(1,2,3))(_.clone) { buf => buf add 4 } + runTest(Set(1,2,3))(_.clone) { buf => buf add 4 } + runTest(SortedSet(1,2,3))(_.clone) { buf => buf add 4 } + runTest(TreeSet(1,2,3))(_.clone) { buf => buf add 4 } + + // Maps + runTest(HashMap(1->1,2->2,3->3))(_.clone) { buf => buf put (4,4) } + runTest(WeakHashMap(1->1,2->2,3->3))(_.clone) { buf => buf put (4,4) } +} + diff --git a/test/files/run/t5064.check b/test/files/run/t5064.check new file mode 100644 index 0000000000..077006abd9 --- /dev/null +++ b/test/files/run/t5064.check @@ -0,0 +1,25 @@ +[12] T5064.super.<init>() +[12] T5064.super.<init> +[12] this +[16:23] immutable.this.List.apply(scala.this.Predef.wrapIntArray(Array[Int]{1})) +[16:20] immutable.this.List.apply +<16:20> immutable.this.List +<16:20> immutable.this +[16:23] scala.this.Predef.wrapIntArray(Array[Int]{1}) +[20] scala.this.Predef.wrapIntArray +[20] scala.this.Predef +[20] scala.this +[26:32] collection.this.Seq.apply(scala.this.Predef.wrapIntArray(Array[Int]{1})) +[26:29] collection.this.Seq.apply +<26:29> collection.this.Seq +<26:29> collection.this +[26:32] scala.this.Predef.wrapIntArray(Array[Int]{1}) +[29] scala.this.Predef.wrapIntArray +[29] scala.this.Predef +[29] scala.this +[35:39] immutable.this.List +<35:39> immutable.this +[42:45] collection.this.Seq +<42:45> collection.this +[48:51] immutable.this.Nil +<48:51> immutable.this diff --git a/test/files/run/t5064.scala b/test/files/run/t5064.scala new file mode 100644 index 0000000000..35f0951765 --- /dev/null +++ b/test/files/run/t5064.scala @@ -0,0 +1,23 @@ +import scala.tools.partest._ + +object Test extends CompilerTest { + import global._ + override def extraSettings = super.extraSettings + " -Yrangepos" + override def sources = List( + """|class T5064 { + | List(1) + | Seq(1) + | List + | Seq + | Nil + |}""".stripMargin + ) + def check(source: String, unit: CompilationUnit) { + for (ClassDef(_, _, _, Template(_, _, stats)) <- unit.body ; stat <- stats ; t <- stat) { + t match { + case _: Select | _: Apply | _: This => println("%-15s %s".format(t.pos.show, t)) + case _ => + } + } + } +}
\ No newline at end of file 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/t5256a.check b/test/files/run/t5256a.check index 518663b3da..7e60139db3 100644 --- a/test/files/run/t5256a.check +++ b/test/files/run/t5256a.check @@ -1,6 +1,6 @@ -class A
-A
+class A +A Object { - def <init>: <?> - def foo: <?> -}
+ def <init>(): A + def foo: Nothing +} diff --git a/test/files/run/t5256b.check b/test/files/run/t5256b.check index d6015f2743..a80df6eb30 100644 --- a/test/files/run/t5256b.check +++ b/test/files/run/t5256b.check @@ -1,6 +1,6 @@ -class A
-Test.A
+class A +Test.A Object { - def <init>: <?> - def foo: <?> -}
+ def <init>(): Test.A + def foo: Nothing +} diff --git a/test/files/run/t5256d.check b/test/files/run/t5256d.check index dd32c05a93..9742ae572e 100644 --- a/test/files/run/t5256d.check +++ b/test/files/run/t5256d.check @@ -1,32 +1,32 @@ -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.reflect.runtime.{currentMirror => cm}
-import scala.reflect.runtime.{currentMirror=>cm}
-
-scala> class A { def foo = ??? }
-defined class A
-
-scala> val c = cm.classSymbol(classOf[A])
-c: reflect.runtime.universe.ClassSymbol = class A
-
-scala> println(c)
-class A
-
-scala> println(c.fullName)
-$line8.$read.$iw.$iw.$iw.$iw.A
-
-scala> println(c.typeSignature)
-java.lang.Object {
- def <init>: <?>
- def foo: <?>
-}
-
-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.reflect.runtime.{currentMirror => cm} +import scala.reflect.runtime.{currentMirror=>cm} + +scala> class A { def foo = ??? } +defined class A + +scala> val c = cm.classSymbol(classOf[A]) +c: reflect.runtime.universe.ClassSymbol = class A + +scala> println(c) +class A + +scala> println(c.fullName) +$line8.$read.$iw.$iw.$iw.$iw.A + +scala> println(c.typeSignature) +java.lang.Object { + def <init>(): A + def foo: scala.Nothing +} + +scala> + +scala> diff --git a/test/files/run/t5256e.check b/test/files/run/t5256e.check index 6c6de90acc..011115720c 100644 --- a/test/files/run/t5256e.check +++ b/test/files/run/t5256e.check @@ -1,6 +1,6 @@ class A Test.C.A Object { - def <init>: <?> - def foo: <?> + def <init>(): C.this.A + def foo: Nothing } diff --git a/test/files/run/t5256f.check b/test/files/run/t5256f.check index c840793fd5..e0fec85596 100644 --- a/test/files/run/t5256f.check +++ b/test/files/run/t5256f.check @@ -1,12 +1,12 @@ class A1 Test.A1 Object { - def <init>: <?> - def foo: <?> + def <init>(): Test.A1 + def foo: Nothing } class A2 Test.A2 Object { - def <init>: <?> - def foo: <?> + def <init>(): Test.this.A2 + def foo: Nothing } 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/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/t5356.check b/test/files/run/t5356.check index 21c4aef07b..7522e7ea74 100644 --- a/test/files/run/t5356.check +++ b/test/files/run/t5356.check @@ -1,6 +1,6 @@ -1 scala.runtime.RichInt -1 scala.runtime.RichInt +1 java.lang.Integer +1 java.lang.Integer 1 scala.math.BigInt -1 scala.runtime.RichDouble -1 scala.runtime.RichFloat +1 java.lang.Double +1 java.lang.Float 1 diff --git a/test/files/run/t5356.scala b/test/files/run/t5356.scala index f7696c6088..ec17e036ad 100644 --- a/test/files/run/t5356.scala +++ b/test/files/run/t5356.scala @@ -1,12 +1,12 @@ object Test { - def f(x: { def toInt: Int }) = println(x.toInt + " " + x.getClass.getName) - + def f(x: Any { def toInt: Int }) = println(x.toInt + " " + x.getClass.getName) + def main(args: Array[String]): Unit = { f(1) f(1.toInt) f(BigInt(1)) f(1d) f(1f) - println((1: { def toInt: Int }).toInt) + println((1: (Any { def toInt: Int })).toInt) } } diff --git a/test/files/run/t5770.check b/test/files/run/t5770.check new file mode 100644 index 0000000000..eeb1d55321 --- /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/t5881.check b/test/files/run/t5881.check index 477fb935a8..8e596e9323 100644 --- a/test/files/run/t5881.check +++ b/test/files/run/t5881.check @@ -1,2 +1,2 @@ -ClassTag[class scala.collection.immutable.List]
-ClassTag[class 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/t6114.scala b/test/files/run/t6114.scala new file mode 100644 index 0000000000..cb880ece00 --- /dev/null +++ b/test/files/run/t6114.scala @@ -0,0 +1,61 @@ +object Test extends App { + def testList = { + val list = new java.util.ArrayList[Int] + list.add(1) + list.add(2) + list.add(3) + import scala.collection.JavaConverters._ + val next = list.asScala ++ List(4,5,6) + assert(next != list.asScala) + + val raw = list.asScala + val cloned = raw.clone + list.add(1) + assert(raw != cloned) + } + def testSet = { + val set = new java.util.HashSet[Int] + set.add(1) + set.add(2) + set.add(3) + import scala.collection.JavaConverters._ + val next = set.asScala ++ Set(4,5,6) + assert(next != set.asScala) + + val raw = set.asScala + val cloned = raw.clone + set.add(4) + assert(raw != cloned) + } + def testMap = { + val map = new java.util.HashMap[Int,Int] + map.put(1,1) + map.put(2,2) + map.put(3,3) + import scala.collection.JavaConverters._ + val next = map.asScala ++ Map(4->4,5->5,6->6) + assert(next != map.asScala) + + val raw = map.asScala + val cloned = raw.clone + map.put(4,4) + assert(raw != cloned) + } + + def testCollection = { + val list: java.util.Collection[Int] = new java.util.ArrayDeque[Int] + list.add(1) + list.add(2) + list.add(3) + import scala.collection.JavaConverters._ + val next = list.asScala ++ List(4,5,6) + assert(next != list.asScala) + + // Note: Clone is hidden at this level, so no overriden cloning. + } + + testList + testSet + testMap + testCollection +} 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/t6220.scala b/test/files/run/t6220.scala new file mode 100644 index 0000000000..834b692f43 --- /dev/null +++ b/test/files/run/t6220.scala @@ -0,0 +1,92 @@ +import scala.collection.immutable._ + +object Test extends App { + + // finds an int x such that improved(x) differs in the first bit to improved(0), + // which is the worst case for the HashTrieSet + def findWorstCaseInts() { + // copy of improve from HashSet + def improve(hcode: Int) = { + var h: Int = hcode + ~(hcode << 9) + h = h ^ (h >>> 14) + h = h + (h << 4) + h ^ (h >>> 10) + } + + // find two hashes which have a large separation + val x = 0 + var y = 1 + val ix = improve(x) + while(y!=0 && improve(y)!=ix+(1<<31)) + y+=1 + printf("%s %s %x %x\n",x,y,improve(x), improve(y)) + } + // this is not done every test run since it would slow down ant test.suite too much. + // findWorstCaseInts() + + // two numbers that are immediately adiacent when fed through HashSet.improve + val h0 = 0 + val h1 = 1270889724 + + // h is the hashcode, i is ignored for the hashcode but relevant for equality + case class Collision(h:Int, i:Int) { + override def hashCode = h + } + val a = Collision(h0,0) + val b = Collision(h0,1) + val c = Collision(h1,0) + + // create a HashSetCollision1 + val x = HashSet(a) + b + if(x.getClass.getSimpleName != "HashSetCollision1") + println("x should be a collision") + StructureTests.validate(x) + // StructureTests.printStructure(x) + require(x.size==2 && x.contains(a) && x.contains(b)) + + // go from a HashSetCollision1 to a HashTrieSet with maximum depth + val y = x + c + if(y.getClass.getSimpleName != "HashTrieSet") + println("y should be a HashTrieSet") + StructureTests.validate(y) + // StructureTests.printStructure(y) + require(y.size==3 && y.contains(a) && y.contains(b) && y.contains(c)) + + // go from a HashSet1 directly to a HashTrieSet with maximum depth + val z = HashSet(a) + c + if(y.getClass.getSimpleName != "HashTrieSet") + println("y should be a HashTrieSet") + StructureTests.validate(z) + // StructureTests.printStructure(z) + require(z.size == 2 && z.contains(a) && z.contains(c)) +} + +package scala.collection.immutable { + object StructureTests { + def printStructure(x:HashSet[_], prefix:String="") { + x match { + case m:HashSet.HashTrieSet[_] => + println(prefix+m.getClass.getSimpleName + " " + m.size) + m.elems.foreach(child => printStructure(child, prefix + " ")) + case m:HashSet.HashSetCollision1[_] => + println(prefix+m.getClass.getSimpleName + " " + m.ks.size) + case m:HashSet.HashSet1[_] => + println(prefix+m.getClass.getSimpleName + " " + m.head) + case _ => + println(prefix+"empty") + } + } + + def validate(x:HashSet[_]) { + x match { + case m:HashSet.HashTrieSet[_] => + require(m.elems.size>1 || (m.elems.size==1 && m.elems(0).isInstanceOf[HashSet.HashTrieSet[_]])) + m.elems.foreach(validate _) + case m:HashSet.HashSetCollision1[_] => + require(m.ks.size>1) + case m:HashSet.HashSet1[_] => + case _ => + } + } + } +} 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/t6246.check b/test/files/run/t6246.check new file mode 100644 index 0000000000..9532185ead --- /dev/null +++ b/test/files/run/t6246.check @@ -0,0 +1,90 @@ +runtimeClass = byte, toString = Byte +true +true +true +false +true +false +false +false +false +runtimeClass = short, toString = Short +true +true +true +false +true +false +false +false +false +runtimeClass = char, toString = Char +true +true +true +false +true +false +false +false +false +runtimeClass = int, toString = Int +true +true +true +false +true +false +false +false +false +runtimeClass = long, toString = Long +true +true +true +false +true +false +false +false +false +runtimeClass = float, toString = Float +true +true +true +false +true +false +false +false +false +runtimeClass = double, toString = Double +true +true +true +false +true +false +false +false +false +runtimeClass = void, toString = Unit +true +true +true +false +true +false +false +false +false +runtimeClass = boolean, toString = Boolean +true +true +true +false +true +false +false +false +false
\ No newline at end of file diff --git a/test/files/run/t6246.scala b/test/files/run/t6246.scala new file mode 100644 index 0000000000..28765e1adf --- /dev/null +++ b/test/files/run/t6246.scala @@ -0,0 +1,26 @@ +import scala.reflect.{ClassTag, classTag} + +object Test extends App { + def testValueClass(tag: ClassTag[_]) { + println(s"runtimeClass = ${tag.runtimeClass}, toString = ${tag.toString}") + println(tag <:< tag) + println(tag <:< ClassTag.AnyVal) + println(tag <:< ClassTag.Any) + println(tag <:< ClassTag.Nothing) + println(ClassTag.Nothing <:< tag) + println(tag <:< ClassTag.Null) + println(ClassTag.Null <:< tag) + println(tag <:< ClassTag.Object) + println(ClassTag.Object <:< tag) + } + + testValueClass(ClassTag.Byte) + testValueClass(ClassTag.Short) + testValueClass(ClassTag.Char) + testValueClass(ClassTag.Int) + testValueClass(ClassTag.Long) + testValueClass(ClassTag.Float) + testValueClass(ClassTag.Double) + testValueClass(ClassTag.Unit) + testValueClass(ClassTag.Boolean) +}
\ No newline at end of file diff --git a/test/files/run/t6261.scala b/test/files/run/t6261.scala new file mode 100644 index 0000000000..b4463256c9 --- /dev/null +++ b/test/files/run/t6261.scala @@ -0,0 +1,130 @@ +import scala.collection.immutable._ + +object Test extends App { + + def test0() { + val m=ListMap(1->2,3->4) + if(m.tail ne m.tail) + println("ListMap.tail uses a builder, so it is not O(1)") + } + + def test1() { + // test that a HashTrieMap with one leaf element is not created! + val x = HashMap.empty + (1->1) + (2->2) + if(x.getClass.getSimpleName != "HashTrieMap") + println("A hash map containing two non-colliding values should be a HashTrieMap") + + val y = x - 1 + if(y.getClass.getSimpleName != "HashMap1") + println("A hash map containing one element should always use HashMap1") + } + + def test2() { + // class that always causes hash collisions + case class Collision(value:Int) { override def hashCode = 0 } + + // create a set that should have a collison + val x = HashMap.empty + (Collision(0)->0) + (Collision(1) ->0) + if(x.getClass.getSimpleName != "HashMapCollision1") + println("HashMap of size >1 with collisions should use HashMapCollision") + + // remove the collision again by removing all but one element + val y = x - Collision(0) + if(y.getClass.getSimpleName != "HashMap1") + println("HashMap of size 1 should use HashMap1" + y.getClass) + } + def test3() { + // finds an int x such that improved(x) differs in the first bit to improved(0), + // which is the worst case for the HashTrieSet + def findWorstCaseInts() { + // copy of improve from HashSet + def improve(hcode: Int) = { + var h: Int = hcode + ~(hcode << 9) + h = h ^ (h >>> 14) + h = h + (h << 4) + h ^ (h >>> 10) + } + + // find two hashes which have a large separation + val x = 0 + var y = 1 + val ix = improve(x) + while(y!=0 && improve(y)!=ix+(1<<31)) + y+=1 + printf("%s %s %x %x\n",x,y,improve(x), improve(y)) + } + // this is not done every test run since it would slow down ant test.suite too much. + // findWorstCaseInts() + + // two numbers that are immediately adiacent when fed through HashSet.improve + val h0 = 0 + val h1 = 1270889724 + + // h is the hashcode, i is ignored for the hashcode but relevant for equality + case class Collision(h:Int, i:Int) { + override def hashCode = h + } + val a = Collision(h0,0)->0 + val b = Collision(h0,1)->0 + val c = Collision(h1,0)->0 + + // create a HashSetCollision1 + val x = HashMap(a) + b + if(x.getClass.getSimpleName != "HashMapCollision1") + println("x should be a HashMapCollision") + StructureTests.validate(x) + //StructureTests.printStructure(x) + require(x.size==2 && x.contains(a._1) && x.contains(b._1)) + + // go from a HashSetCollision1 to a HashTrieSet with maximum depth + val y = x + c + if(y.getClass.getSimpleName != "HashTrieMap") + println("y should be a HashTrieMap") + StructureTests.validate(y) + // StructureTests.printStructure(y) + require(y.size==3 && y.contains(a._1) && y.contains(b._1) && y.contains(c._1)) + + // go from a HashSet1 directly to a HashTrieSet with maximum depth + val z = HashMap(a) + c + if(y.getClass.getSimpleName != "HashTrieMap") + println("y should be a HashTrieMap") + StructureTests.validate(z) + // StructureTests.printStructure(z) + require(z.size == 2 && z.contains(a._1) && z.contains(c._1)) + } + test0() + test1() + test2() + test3() +} + + +package scala.collection.immutable { + object StructureTests { + def printStructure(x:HashMap[_,_], prefix:String="") { + x match { + case m:HashMap.HashTrieMap[_,_] => + println(prefix+m.getClass.getSimpleName + " " + m.size) + m.elems.foreach(child => printStructure(child, prefix + " ")) + case m:HashMap.HashMapCollision1[_,_] => + println(prefix+m.getClass.getSimpleName + " " + m.kvs.size) + case m:HashMap.HashMap1[_,_] => + println(prefix+m.getClass.getSimpleName + " " + m.head) + case _ => + println(prefix+"empty") + } + } + + def validate(x:HashMap[_,_]) { + x match { + case m:HashMap.HashTrieMap[_,_] => + require(m.elems.size>1 || (m.elems.size==1 && m.elems(0).isInstanceOf[HashMap.HashTrieMap[_,_]])) + m.elems.foreach(validate _) + case m:HashMap.HashMapCollision1[_,_] => + require(m.kvs.size>1) + case m:HashMap.HashMap1[_,_] => + case _ => + } + } + } +} diff --git a/test/files/run/t6271.scala b/test/files/run/t6271.scala new file mode 100644 index 0000000000..8ebf7ad8b5 --- /dev/null +++ b/test/files/run/t6271.scala @@ -0,0 +1,32 @@ +object Test extends App { + def filterIssue = { + val viewed : Iterable[Iterable[Int]] = List(List(0).view).view + val filtered = viewed flatMap { x => List( x filter (_ > 0) ) } + filtered.iterator.toIterable.flatten + } + def takenIssue = { + val viewed : Iterable[Iterable[Int]] = List(List(0).view).view + val filtered = viewed flatMap { x => List( x take 0 ) } + filtered.iterator.toIterable.flatten + } + def droppedIssue = { + val viewed : Iterable[Iterable[Int]] = List(List(0).view).view + val filtered = viewed flatMap { x => List( x drop 1 ) } + filtered.iterator.toIterable.flatten + } + def flatMappedIssue = { + val viewed : Iterable[Iterable[Int]] = List(List(0).view).view + val filtered = viewed flatMap { x => List( x flatMap (_ => List()) ) } + filtered.iterator.toIterable.flatten + } + def slicedIssue = { + val viewed : Iterable[Iterable[Int]] = List(List(0).view).view + val filtered = viewed flatMap { x => List( x slice (2,3) ) } + filtered.iterator.toIterable.flatten + } + filterIssue + takenIssue + droppedIssue + flatMappedIssue + slicedIssue +} diff --git a/test/files/run/t6273.check b/test/files/run/t6273.check new file mode 100644 index 0000000000..c1c18daac2 --- /dev/null +++ b/test/files/run/t6273.check @@ -0,0 +1,19 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> val y = 55 +y: Int = 55 + +scala> val x = s""" + y = $y +""" +x: String = +" + y = 55 +" + +scala> + +scala> diff --git a/test/files/run/t6273.scala b/test/files/run/t6273.scala new file mode 100644 index 0000000000..ed0fd452e0 --- /dev/null +++ b/test/files/run/t6273.scala @@ -0,0 +1,11 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + def tq = "\"\"\"" + def code = s""" +val y = 55 +val x = s$tq + y = $$y +$tq + """ +} diff --git a/test/files/run/t6287.check b/test/files/run/t6287.check new file mode 100644 index 0000000000..2a783704a2 --- /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/t6290.scala b/test/files/run/t6290.scala new file mode 100644 index 0000000000..9d05db0d18 --- /dev/null +++ b/test/files/run/t6290.scala @@ -0,0 +1,4 @@ +object Test { + implicit val foo = language.dynamics + def main(args: Array[String]): Unit = () +} diff --git a/test/files/run/t6292.scala b/test/files/run/t6292.scala new file mode 100644 index 0000000000..51e31f95fc --- /dev/null +++ b/test/files/run/t6292.scala @@ -0,0 +1,18 @@ + import scala.collection.mutable.DoubleLinkedList + +object Test { + def main(args: Array[String]): Unit = { + cloneAndtest(DoubleLinkedList[Int]()) + cloneAndtest(DoubleLinkedList[Int](1)) + cloneAndtest(DoubleLinkedList[Int](1,2,3,4)) + } + + def cloneAndtest(l: DoubleLinkedList[Int]): Unit = + testSame(l, l.clone.asInstanceOf[DoubleLinkedList[Int]]) + + def testSame(one: DoubleLinkedList[Int], two: DoubleLinkedList[Int]): Unit = { + def msg = s" for ${one} and ${two} !" + assert(one.size == two.size, s"Cloned sizes are not the same $msg!") + assert(one == two, s"Cloned lists are not equal $msg") + } +} diff --git a/test/files/run/t6318_derived.check b/test/files/run/t6318_derived.check new file mode 100644 index 0000000000..ad43b6579b --- /dev/null +++ b/test/files/run/t6318_derived.check @@ -0,0 +1,3 @@ +Some(X)
+true
+Some(X)
diff --git a/test/files/run/t6318_derived.scala b/test/files/run/t6318_derived.scala new file mode 100644 index 0000000000..ccdc18daee --- /dev/null +++ b/test/files/run/t6318_derived.scala @@ -0,0 +1,15 @@ +import scala.reflect.{ClassTag, classTag} + +object Test extends App { + def test[T: ClassTag](x: T) { + println(classTag[T].runtimeClass.isAssignableFrom(x.getClass)) + println(classTag[T].unapply(x)) + } + + class X(val x: Int) extends AnyVal { override def toString = "X" } + val x = new X(1) + // the commented line crashes because of SI-6326 + //println(classTag[X].runtimeClass.isAssignableFrom(x.getClass)) + println(classTag[X].unapply(x)) + test(x) +}
\ No newline at end of file diff --git a/test/files/run/t6318_primitives.check b/test/files/run/t6318_primitives.check new file mode 100644 index 0000000000..bb474c3bdc --- /dev/null +++ b/test/files/run/t6318_primitives.check @@ -0,0 +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
diff --git a/test/files/run/t6318_primitives.scala b/test/files/run/t6318_primitives.scala new file mode 100644 index 0000000000..30f27120b3 --- /dev/null +++ b/test/files/run/t6318_primitives.scala @@ -0,0 +1,71 @@ +import scala.reflect.{ClassTag, classTag} + +object Test extends App { + def test[T: ClassTag](x: T) { + println(classTag[T].runtimeClass.isAssignableFrom(x.getClass)) + println(classTag[T].unapply(x)) + } + + { + val x = 1.toByte + println(ClassTag.Byte.runtimeClass.isAssignableFrom(x.getClass)) + println(ClassTag.Byte.unapply(x)) + test(x) + } + + { + val x = 1.toShort + println(ClassTag.Short.runtimeClass.isAssignableFrom(x.getClass)) + println(ClassTag.Short.unapply(x)) + test(x) + } + + { + val x = 1.toChar + println(ClassTag.Char.runtimeClass.isAssignableFrom(x.getClass)) + println(ClassTag.Char.unapply(x)) + test(x) + } + + { + val x = 1.toInt + println(ClassTag.Int.runtimeClass.isAssignableFrom(x.getClass)) + println(ClassTag.Int.unapply(x)) + test(x) + } + + { + val x = 1.toLong + println(ClassTag.Long.runtimeClass.isAssignableFrom(x.getClass)) + println(ClassTag.Long.unapply(x)) + test(x) + } + + { + val x = 1.toFloat + println(ClassTag.Float.runtimeClass.isAssignableFrom(x.getClass)) + println(ClassTag.Float.unapply(x)) + test(x) + } + + { + val x = 1.toDouble + println(ClassTag.Double.runtimeClass.isAssignableFrom(x.getClass)) + println(ClassTag.Double.unapply(x)) + test(x) + } + + { + val x = true + println(ClassTag.Boolean.runtimeClass.isAssignableFrom(x.getClass)) + println(ClassTag.Boolean.unapply(x)) + test(x) + } + + { + val x = () + println(ClassTag.Unit.runtimeClass.isAssignableFrom(x.getClass)) + println(ClassTag.Unit.unapply(x)) + test(x) + } +}
\ No newline at end of file diff --git a/test/files/run/t6323b.check b/test/files/run/t6323b.check new file mode 100644 index 0000000000..80b6176178 --- /dev/null +++ b/test/files/run/t6323b.check @@ -0,0 +1 @@ +cannot reflect value a, because it's a member of a weak type Test
diff --git a/test/files/run/t6323b.scala b/test/files/run/t6323b.scala new file mode 100644 index 0000000000..f530ac3ecc --- /dev/null +++ b/test/files/run/t6323b.scala @@ -0,0 +1,21 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => m} +import scala.reflect.runtime.{universe => u} + +object Test extends App { + locally { + try { + case class Test(a:String,b:List[Int]) + + val lookAtMe = m.reflect(Test("a",List(5))) + val value = u.weakTypeOf[Test] + val members = value.members + val member = value.members.filter(_.name.encoded == "a") + val aAccessor = lookAtMe.reflectMethod(member.head.asMethod) + val thisShouldBeA = aAccessor.apply() + println(thisShouldBeA) + } catch { + case ScalaReflectionException(msg) => println(msg) + } + } +}
\ No newline at end of file diff --git a/test/files/run/t6327.check b/test/files/run/t6327.check new file mode 100644 index 0000000000..f7bacac931 --- /dev/null +++ b/test/files/run/t6327.check @@ -0,0 +1,4 @@ +A +A +A +A diff --git a/test/files/run/t6327.scala b/test/files/run/t6327.scala new file mode 100644 index 0000000000..7683101f14 --- /dev/null +++ b/test/files/run/t6327.scala @@ -0,0 +1,22 @@ +import language._ + +object Test extends App { + + case class R[+T](s: String) { def x() = println(s) } + + // Implicits in contention; StringR is nested to avoid ambiguity + object R { implicit val StringR = R[String]("A") } + implicit val Default = R[Any]("B") + + class B() extends Dynamic { + def selectDynamic[T](f: String)(implicit r: R[T]): Unit = r.x() + } + + val b = new B() + + // These should all produce the same output, but they don't + b.selectDynamic[String]("baz") + b.baz[String] + val c = b.selectDynamic[String]("baz") + val d = b.baz[String] +} diff --git a/test/files/run/t6329_repl.check b/test/files/run/t6329_repl.check new file mode 100644 index 0000000000..d4804fae37 --- /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..d4804fae37 --- /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..7e7c3d11df --- /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..7e7c3d11df --- /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/t6331.check b/test/files/run/t6331.check new file mode 100644 index 0000000000..9bf3f7823a --- /dev/null +++ b/test/files/run/t6331.check @@ -0,0 +1,23 @@ + () == () + true == true + true != false + false != true + 0.toByte == 0.toByte + 0.toByte != 1.toByte + 0.toShort == 0.toShort + 0.toShort != 1.toShort + 0 == 0 + 0 != 1 + 0L == 0L + 0L != 1L + 0.0f == 0.0f + 0.0f != -0.0f + -0.0f != 0.0f + NaNf == NaNf + 0.0d == 0.0d + 0.0d != -0.0d + -0.0d != 0.0d + NaNd == NaNd + 0 != 0.0d + 0 != 0L + 0.0d != 0.0f diff --git a/test/files/run/t6331.scala b/test/files/run/t6331.scala new file mode 100644 index 0000000000..4e43a7686e --- /dev/null +++ b/test/files/run/t6331.scala @@ -0,0 +1,71 @@ +import scala.tools.partest._ +import java.io._ +import scala.tools.nsc._ +import scala.tools.nsc.util.CommandLineParser +import scala.tools.nsc.{Global, Settings, CompilerCommand} +import scala.tools.nsc.reporters.ConsoleReporter + +// Test of Constant#equals, which must must account for floating point intricacies. +object Test extends DirectTest { + + override def code = "" + + override def show() { + val global = newCompiler() + import global._ + + def check(c1: Any, c2: Any): Unit = { + val const1 = Constant(c1) + val const2 = Constant(c2) + val equal = const1 == const2 + def show(a: Any) = "" + a + (a match { + case _: Byte => ".toByte" + case _: Short => ".toShort" + case _: Long => "L" + case _: Float => "f" + case _: Double => "d" + case _ => "" + }) + val op = if (equal) "==" else "!=" + println(f"${show(c1)}%12s $op ${show(c2)}") + + val hash1 = const1.hashCode + val hash2 = const2.hashCode + val hashesEqual = hash1 == hash2 + val hashBroken = equal && !hashesEqual + if (hashBroken) println(f"$hash1%12s != $hash2 // hash codes differ for equal objects!!") + } + + check((), ()) + + check(true, true) + check(true, false) + check(false, true) + + check(0.toByte, 0.toByte) + check(0.toByte, 1.toByte) + + check(0.toShort, 0.toShort) + check(0.toShort, 1.toShort) + + check(0, 0) + check(0, 1) + + check(0L, 0L) + check(0L, 1L) + + check(0f, 0f) + check(0f, -0f) + check(-0f, 0f) + check(Float.NaN, Float.NaN) + + check(0d, 0d) + check(0d, -0d) + check(-0d, 0d) + check(Double.NaN, Double.NaN) + + check(0, 0d) + check(0, 0L) + check(0d, 0f) + } +} diff --git a/test/files/run/t6331b.check b/test/files/run/t6331b.check new file mode 100644 index 0000000000..6ca09e3814 --- /dev/null +++ b/test/files/run/t6331b.check @@ -0,0 +1,30 @@ +trace> if (Test.this.t) + -0.0 +else + 0.0 +res: Double = -0.0 + +trace> if (Test.this.t) + 0.0 +else + -0.0 +res: Double = 0.0 + +trace> Test.this.intercept.apply[Any](if (scala.this.Predef.???) + -0.0 +else + 0.0) +res: Any = class scala.NotImplementedError + +trace> Test.this.intercept.apply[Any](if (scala.this.Predef.???) + 0.0 +else + 0.0) +res: Any = class scala.NotImplementedError + +trace> Test.this.intercept.apply[Any](if (scala.this.Predef.???) + () +else + ()) +res: Any = class scala.NotImplementedError + diff --git a/test/files/run/t6331b.scala b/test/files/run/t6331b.scala new file mode 100644 index 0000000000..f966abea51 --- /dev/null +++ b/test/files/run/t6331b.scala @@ -0,0 +1,20 @@ +import scala.tools.partest._ +import java.io._ +import scala.tools.nsc._ +import scala.tools.nsc.util.CommandLineParser +import scala.tools.nsc.{Global, Settings, CompilerCommand} +import scala.tools.nsc.reporters.ConsoleReporter + +import scala.tools.partest.trace +import scala.util.control.Exception._ + + +object Test extends App { + def intercept = allCatch.withApply(_.getClass) + val t: Boolean = true + trace(if (t) -0d else 0d) + trace(if (t) 0d else -0d) + trace(intercept(if (???) -0d else 0d)) + trace(intercept(if (???) 0d else 0d)) + trace(intercept(if (???) () else ())) +} diff --git a/test/files/run/t6333.scala b/test/files/run/t6333.scala new file mode 100644 index 0000000000..266d95ce69 --- /dev/null +++ b/test/files/run/t6333.scala @@ -0,0 +1,29 @@ +object Test extends App { + import util.Try + + val a = "apple" + def fail: String = throw new Exception("Fail!") + def argh: Try[String] = throw new Exception("Argh!") + + // No throw tests + def tryMethods(expr: => String): Unit = { + Try(expr) orElse argh + Try(expr).transform(_ => argh, _ => argh) + Try(expr).recoverWith { case e if (a == fail) => Try(a) } + Try(expr).recoverWith { case _ => argh } + Try(expr).getOrElse(a) + // TODO - Fail getOrElse? + Try(expr) orElse argh + Try(expr) orElse Try(a) + Try(expr) map (_ => fail) + Try(expr) map (_ => a) + Try(expr) flatMap (_ => argh) + Try(expr) flatMap (_ => Try(a)) + Try(expr) filter (_ => throw new Exception("O NOES")) + Try(expr) filter (_ => true) + Try(expr) recover { case _ => fail } + Try(expr).failed + } + tryMethods(a) + tryMethods(fail) +} 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/toolbox_console_reporter.scala b/test/files/run/toolbox_console_reporter.scala index c5b788550e..a57dea38a8 100644 --- a/test/files/run/toolbox_console_reporter.scala +++ b/test/files/run/toolbox_console_reporter.scala @@ -5,7 +5,7 @@ object Test extends App { // todo. and isn't affected by Console.setOut employed by partest to intercept output //val toolbox = mkToolBox(frontEnd = mkConsoleFrontEnd(), options = "-deprecation") - //toolbox.runExpr(reify{ + //toolbox.eval(reify{ // object Utils { // @deprecated("test", "2.10.0") // def foo { println("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..15f559d605 100644 --- a/test/files/run/toolbox_silent_reporter.scala +++ b/test/files/run/toolbox_silent_reporter.scala @@ -5,7 +5,7 @@ import scala.tools.reflect.ToolBox object Test extends App { val toolbox = cm.mkToolBox(options = "-deprecation") - toolbox.runExpr(reify{ + toolbox.eval(reify{ object Utils { @deprecated("test", "2.10.0") def foo { println("hello") } diff --git a/test/files/run/toolbox_typecheck_macrosdisabled.check b/test/files/run/toolbox_typecheck_macrosdisabled.check index 9cf101c69d..4d253f31fc 100644 --- a/test/files/run/toolbox_typecheck_macrosdisabled.check +++ b/test/files/run/toolbox_typecheck_macrosdisabled.check @@ -1,32 +1,41 @@ -{
- val $u: ru.type = ru;
- val $m: $u.Mirror = ru.rootMirror;
- $u.Expr.apply[Int(2)]($m, {
- final class $treecreator1 extends TreeCreator {
- def <init>(): $treecreator1 = {
- $treecreator1.super.<init>();
- ()
- };
- def apply[U <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Tree = {
- val $u: U = $m$untyped.universe;
- val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
- $u.Literal.apply($u.Constant.apply(2))
- }
- };
- new $treecreator1()
- })($u.TypeTag.apply[Int(2)]($m, {
- final class $typecreator2 extends TypeCreator {
- def <init>(): $typecreator2 = {
- $typecreator2.super.<init>();
- ()
- };
- def apply[U <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Type = {
- val $u: U = $m$untyped.universe;
- val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
- $u.ConstantType.apply($u.Constant.apply(2))
- }
- };
- new $typecreator2()
- }))
-}
-ru.reify[Int](2)
+{ + val $u: ru.type = ru; + val $m: $u.Mirror = ru.runtimeMirror({ + final class $anon extends scala.AnyRef { + def <init>(): anonymous class $anon = { + $anon.super.<init>(); + () + }; + () + }; + new $anon() +}.getClass().getClassLoader()); + $u.Expr.apply[Int(2)]($m, { + final class $treecreator1 extends TreeCreator { + def <init>(): $treecreator1 = { + $treecreator1.super.<init>(); + () + }; + def apply[U <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Tree = { + val $u: U = $m$untyped.universe; + val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; + $u.Literal.apply($u.Constant.apply(2)) + } + }; + new $treecreator1() + })($u.TypeTag.apply[Int(2)]($m, { + final class $typecreator2 extends TypeCreator { + def <init>(): $typecreator2 = { + $typecreator2.super.<init>(); + () + }; + def apply[U <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Type = { + val $u: U = $m$untyped.universe; + val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; + $u.ConstantType.apply($u.Constant.apply(2)) + } + }; + new $typecreator2() + })) +} +ru.reify[Int](2) diff --git a/test/files/run/toolbox_typecheck_macrosdisabled.scala b/test/files/run/toolbox_typecheck_macrosdisabled.scala index bcbd637e02..51eb63f294 100644 --- a/test/files/run/toolbox_typecheck_macrosdisabled.scala +++ b/test/files/run/toolbox_typecheck_macrosdisabled.scala @@ -3,12 +3,17 @@ import scala.reflect.runtime.{universe => ru} import scala.reflect.runtime.{currentMirror => cm} import scala.tools.reflect.ToolBox +// Note: If you're looking at this test and you don't know why, you may +// have accidentally changed the way type tags reify. If so, validate +// that your changes are accurate and update the check file. + object Test extends App { val toolbox = cm.mkToolBox() val rupkg = cm.staticModule("scala.reflect.runtime.package") val rusym = build.selectTerm(rupkg, "universe") val NullaryMethodType(rutpe) = rusym.typeSignature - val ru = build.newFreeTerm("ru", rutpe, scala.reflect.runtime.universe) + val ru = build.newFreeTerm("ru", scala.reflect.runtime.universe) + build.setTypeSignature(ru, rutpe) val tree1 = Apply(Select(Ident(ru), newTermName("reify")), List(Literal(Constant(2)))) val ttree1 = toolbox.typeCheck(tree1, withMacrosDisabled = false) @@ -17,4 +22,4 @@ object Test extends App { val tree2 = Apply(Select(Ident(ru), newTermName("reify")), List(Literal(Constant(2)))) val ttree2 = toolbox.typeCheck(tree2, withMacrosDisabled = true) println(ttree2) -}
\ No newline at end of file +} diff --git a/test/files/run/toolbox_typecheck_macrosdisabled2.check b/test/files/run/toolbox_typecheck_macrosdisabled2.check index d344e33180..149c3def12 100644 --- a/test/files/run/toolbox_typecheck_macrosdisabled2.check +++ b/test/files/run/toolbox_typecheck_macrosdisabled2.check @@ -1,32 +1,41 @@ -{
- val $u: ru.type = ru;
- val $m: $u.Mirror = ru.rootMirror;
- $u.Expr.apply[Array[Int]]($m, {
- final class $treecreator1 extends TreeCreator {
- def <init>(): $treecreator1 = {
- $treecreator1.super.<init>();
- ()
- };
- def apply[U <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Tree = {
- val $u: U = $m$untyped.universe;
- val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
- $u.Apply.apply($u.Select.apply($u.Select.apply($u.build.Ident($m.staticPackage("scala")), $u.newTermName("Array")), $u.newTermName("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2))))
- }
- };
- new $treecreator1()
- })($u.TypeTag.apply[Array[Int]]($m, {
- final class $typecreator2 extends TypeCreator {
- def <init>(): $typecreator2 = {
- $typecreator2.super.<init>();
- ()
- };
- def apply[U <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Type = {
- val $u: U = $m$untyped.universe;
- val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
- $u.TypeRef.apply($u.ThisType.apply($m.staticPackage("scala").asModule.moduleClass), $m.staticClass("scala.Array"), scala.collection.immutable.List.apply[$u.Type]($m.staticClass("scala.Int").asType.toTypeConstructor))
- }
- };
- new $typecreator2()
- }))
-}
-ru.reify[Array[Int]](scala.Array.apply(2))
+{ + val $u: ru.type = ru; + val $m: $u.Mirror = ru.runtimeMirror({ + final class $anon extends scala.AnyRef { + def <init>(): anonymous class $anon = { + $anon.super.<init>(); + () + }; + () + }; + new $anon() +}.getClass().getClassLoader()); + $u.Expr.apply[Array[Int]]($m, { + final class $treecreator1 extends TreeCreator { + def <init>(): $treecreator1 = { + $treecreator1.super.<init>(); + () + }; + def apply[U <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Tree = { + val $u: U = $m$untyped.universe; + val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; + $u.Apply.apply($u.Select.apply($u.Select.apply($u.build.Ident($m.staticPackage("scala")), $u.newTermName("Array")), $u.newTermName("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2)))) + } + }; + new $treecreator1() + })($u.TypeTag.apply[Array[Int]]($m, { + final class $typecreator2 extends TypeCreator { + def <init>(): $typecreator2 = { + $typecreator2.super.<init>(); + () + }; + def apply[U <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Type = { + val $u: U = $m$untyped.universe; + val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; + $u.TypeRef.apply($u.ThisType.apply($m.staticPackage("scala").asModule.moduleClass), $m.staticClass("scala.Array"), scala.collection.immutable.List.apply[$u.Type]($m.staticClass("scala.Int").asType.toTypeConstructor)) + } + }; + new $typecreator2() + })) +} +ru.reify[Array[Int]](scala.Array.apply(2)) diff --git a/test/files/run/toolbox_typecheck_macrosdisabled2.scala b/test/files/run/toolbox_typecheck_macrosdisabled2.scala index 51493ffc1c..74fd09d9fd 100644 --- a/test/files/run/toolbox_typecheck_macrosdisabled2.scala +++ b/test/files/run/toolbox_typecheck_macrosdisabled2.scala @@ -3,12 +3,17 @@ import scala.reflect.runtime.{universe => ru} import scala.reflect.runtime.{currentMirror => cm} import scala.tools.reflect.ToolBox +// Note: If you're looking at this test and you don't know why, you may +// have accidentally changed the way type tags reify. If so, validate +// that your changes are accurate and update the check file. + object Test extends App { val toolbox = cm.mkToolBox() val rupkg = cm.staticModule("scala.reflect.runtime.package") val rusym = build.selectTerm(rupkg, "universe") val NullaryMethodType(rutpe) = rusym.typeSignature - val ru = build.newFreeTerm("ru", rutpe, scala.reflect.runtime.universe) + val ru = build.newFreeTerm("ru", scala.reflect.runtime.universe) + build.setTypeSignature(ru, rutpe) val tree1 = Apply(Select(Ident(ru), newTermName("reify")), List(Apply(Select(Ident(newTermName("scala")), newTermName("Array")), List(Literal(Constant(2)))))) val ttree1 = toolbox.typeCheck(tree1, withMacrosDisabled = false) diff --git a/test/files/run/valueclasses-classtag-basic.check b/test/files/run/valueclasses-classtag-basic.check index 0c13986b32..554c75e074 100644 --- a/test/files/run/valueclasses-classtag-basic.check +++ b/test/files/run/valueclasses-classtag-basic.check @@ -1 +1 @@ -ClassTag[class Foo]
+Foo
diff --git a/test/files/run/valueclasses-classtag-existential.check b/test/files/run/valueclasses-classtag-existential.check index 95e94e7aee..15ac02630f 100644 --- a/test/files/run/valueclasses-classtag-existential.check +++ b/test/files/run/valueclasses-classtag-existential.check @@ -1 +1 @@ -ClassTag[class java.lang.Object]
+Object
diff --git a/test/files/run/valueclasses-classtag-generic.check b/test/files/run/valueclasses-classtag-generic.check index 0c13986b32..554c75e074 100644 --- a/test/files/run/valueclasses-classtag-generic.check +++ b/test/files/run/valueclasses-classtag-generic.check @@ -1 +1 @@ -ClassTag[class Foo]
+Foo
diff --git a/test/files/run/virtpatmat_typetag.check b/test/files/run/virtpatmat_typetag.check index f9800b84d0..eaa9f3361f 100644 --- a/test/files/run/virtpatmat_typetag.check +++ b/test/files/run/virtpatmat_typetag.check @@ -1,10 +1,10 @@ -1 is not a ClassTag[int]; it's a class java.lang.Integer -1 is a ClassTag[class java.lang.Integer] -1 is not a ClassTag[class java.lang.String]; it's a class java.lang.Integer -true is a ClassTag[class java.lang.Object] -woele is a ClassTag[class java.lang.String] -1 is not a ClassTag[int]; it's a class java.lang.Integer -1 is a ClassTag[class java.lang.Integer] -1 is not a ClassTag[class java.lang.String]; it's a class java.lang.Integer -true is a ClassTag[class java.lang.Object] -woele is a ClassTag[class java.lang.String] +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
diff --git a/test/files/pos/t2868.cmds b/test/flaky/pos/t2868.cmds index ed8124a9e0..ed8124a9e0 100644 --- a/test/files/pos/t2868.cmds +++ b/test/flaky/pos/t2868.cmds diff --git a/test/files/pos/t2868/Jann.java b/test/flaky/pos/t2868/Jann.java index f5b68de7b0..f5b68de7b0 100644 --- a/test/files/pos/t2868/Jann.java +++ b/test/flaky/pos/t2868/Jann.java diff --git a/test/files/pos/t2868/Nest.java b/test/flaky/pos/t2868/Nest.java index 53652291ad..53652291ad 100644 --- a/test/files/pos/t2868/Nest.java +++ b/test/flaky/pos/t2868/Nest.java diff --git a/test/files/pos/t2868/pick_1.scala b/test/flaky/pos/t2868/pick_1.scala index a211687432..a211687432 100644 --- a/test/files/pos/t2868/pick_1.scala +++ b/test/flaky/pos/t2868/pick_1.scala diff --git a/test/files/pos/t2868/t2868_src_2.scala b/test/flaky/pos/t2868/t2868_src_2.scala index f11ef0fae2..f11ef0fae2 100644 --- a/test/files/pos/t2868/t2868_src_2.scala +++ b/test/flaky/pos/t2868/t2868_src_2.scala diff --git a/test/pending/neg/reify_packed.scala b/test/pending/neg/reify_packed.scala index 2004e031d5..7bdaa41915 100644 --- a/test/pending/neg/reify_packed.scala +++ b/test/pending/neg/reify_packed.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/pending/pos/t3943/Outer_1.java b/test/pending/pos/t3943/Outer_1.java new file mode 100644 index 0000000000..56c8cc7f85 --- /dev/null +++ b/test/pending/pos/t3943/Outer_1.java @@ -0,0 +1,14 @@ +public class Outer_1<E> { + abstract class Inner { + abstract public void foo(E e); + } +} + +class Child extends Outer_1<String> { + // the implicit prefix for Inner is Outer<E> instead of Outer<String> + public Inner getInner() { + return new Inner() { + public void foo(String e) { System.out.println("meh "+e); } + }; + } +} diff --git a/test/pending/pos/t3943/test_2.scala b/test/pending/pos/t3943/test_2.scala new file mode 100644 index 0000000000..a19db8b226 --- /dev/null +++ b/test/pending/pos/t3943/test_2.scala @@ -0,0 +1,8 @@ +object Test extends App { + val x: Child = new Child + x.getInner.foo("meh") +// ^ +// error: type mismatch; +// found : java.lang.String("meh") +// required: E +} diff --git a/test/pending/run/macro-expand-implicit-macro-defeats-type-inference/Impls_1.scala b/test/pending/run/macro-expand-implicit-macro-defeats-type-inference/Impls_1.scala index 26d4a45fee..15bcb581c8 100644 --- a/test/pending/run/macro-expand-implicit-macro-defeats-type-inference/Impls_1.scala +++ b/test/pending/run/macro-expand-implicit-macro-defeats-type-inference/Impls_1.scala @@ -1,7 +1,7 @@ import scala.reflect.macros.Context object Impls { - def foo[T: c.AbsTypeTag](c: Context): c.Expr[List[T]] = c.universe.reify { + def foo[T: c.WeakTypeTag](c: Context): c.Expr[List[T]] = c.universe.reify { println("openImplicits are: " + c.literal(c.openImplicits.toString).splice) println("enclosingImplicits are: " + c.literal(c.enclosingImplicits.toString).splice) println("typetag is: " + c.literal(c.tag[T].toString).splice) diff --git a/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala b/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala index d6ebb907e5..26de70cc12 100644 --- a/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala +++ b/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala @@ -1,11 +1,11 @@ import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[T, U: c.AbsTypeTag, V](c: Ctx)(implicit T: c.AbsTypeTag[T], V: c.AbsTypeTag[V]): c.Expr[Unit] = { + def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = { import c.universe._ Block(List( Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.AbsTypeTag[U]].toString)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))), Literal(Constant(()))) } diff --git a/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala b/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala index d6ebb907e5..26de70cc12 100644 --- a/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala +++ b/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala @@ -1,11 +1,11 @@ import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[T, U: c.AbsTypeTag, V](c: Ctx)(implicit T: c.AbsTypeTag[T], V: c.AbsTypeTag[V]): c.Expr[Unit] = { + def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = { import c.universe._ Block(List( Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.AbsTypeTag[U]].toString)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))), Literal(Constant(()))) } diff --git a/test/pending/run/macro-reify-array/Macros_1.scala b/test/pending/run/macro-reify-array/Macros_1.scala index 99006c548a..f970be5caa 100644 --- a/test/pending/run/macro-reify-array/Macros_1.scala +++ b/test/pending/run/macro-reify-array/Macros_1.scala @@ -4,7 +4,7 @@ object Macros { def foo[T](s: String) = macro Impls.foo[T] object Impls { - def foo[T: c.AbsTypeTag](c: Ctx)(s: c.Expr[T]) = c.universe.reify { + def foo[T: c.WeakTypeTag](c: Ctx)(s: c.Expr[T]) = c.universe.reify { Array(s.splice) } } diff --git a/test/pending/run/macro-reify-tagful-b/Macros_1.scala b/test/pending/run/macro-reify-tagful-b/Macros_1.scala index a14187e8a7..59dbe7157b 100644 --- a/test/pending/run/macro-reify-tagful-b/Macros_1.scala +++ b/test/pending/run/macro-reify-tagful-b/Macros_1.scala @@ -4,7 +4,7 @@ object Macros { def foo[T](s: T) = macro Impls.foo[List[T]] object Impls { - def foo[T: c.AbsTypeTag](c: Ctx)(s: c.Expr[T]) = c.universe.reify { + def foo[T: c.WeakTypeTag](c: Ctx)(s: c.Expr[T]) = c.universe.reify { List(s.splice) } } diff --git a/test/pending/run/macro-reify-tagless-b/Test_2.scala b/test/pending/run/macro-reify-tagless-b/Test_2.scala index 4649963d05..ebd35ffe47 100644 --- a/test/pending/run/macro-reify-tagless-b/Test_2.scala +++ b/test/pending/run/macro-reify-tagless-b/Test_2.scala @@ -9,5 +9,5 @@ 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)))) - println(cm.mkToolBox().runExpr(tree)) + println(cm.mkToolBox().eval(tree)) } diff --git a/test/pending/run/reify_closure2b.scala b/test/pending/run/reify_closure2b.scala index 565bb03b2f..0f126c8c91 100644 --- a/test/pending/run/reify_closure2b.scala +++ b/test/pending/run/reify_closure2b.scala @@ -12,7 +12,7 @@ object Test extends App { } val toolbox = cm.mkToolBox() - val dyn = toolbox.runExpr(new Foo(y).fun.tree) + val dyn = toolbox.eval(new Foo(y).fun.tree) dyn.asInstanceOf[Int => Int] } diff --git a/test/pending/run/reify_closure3b.scala b/test/pending/run/reify_closure3b.scala index 0d806b148b..54ac52ba0b 100644 --- a/test/pending/run/reify_closure3b.scala +++ b/test/pending/run/reify_closure3b.scala @@ -14,7 +14,7 @@ object Test extends App { } val toolbox = cm.mkToolBox() - val dyn = toolbox.runExpr(new Foo(y).fun.tree) + val dyn = toolbox.eval(new Foo(y).fun.tree) dyn.asInstanceOf[Int => Int] } diff --git a/test/pending/run/reify_closure4b.scala b/test/pending/run/reify_closure4b.scala index 1a349de072..34f707e092 100644 --- a/test/pending/run/reify_closure4b.scala +++ b/test/pending/run/reify_closure4b.scala @@ -14,7 +14,7 @@ object Test extends App { } val toolbox = cm.mkToolBox() - val dyn = toolbox.runExpr(new Foo(y).fun.tree) + val dyn = toolbox.eval(new Foo(y).fun.tree) dyn.asInstanceOf[Int => Int] } diff --git a/test/pending/run/reify_closure5b.scala b/test/pending/run/reify_closure5b.scala index 3e5e1bd328..0e506bf7b5 100644 --- a/test/pending/run/reify_closure5b.scala +++ b/test/pending/run/reify_closure5b.scala @@ -12,7 +12,7 @@ object Test extends App { } val toolbox = cm.mkToolBox() - val dyn = toolbox.runExpr(new Foo(ys).fun.tree) + val dyn = toolbox.eval(new Foo(ys).fun.tree) dyn.asInstanceOf[Int => Int] } diff --git a/test/pending/run/reify_closure9a.scala b/test/pending/run/reify_closure9a.scala index dddfa3f6c2..f39ff1e2f3 100644 --- a/test/pending/run/reify_closure9a.scala +++ b/test/pending/run/reify_closure9a.scala @@ -10,7 +10,7 @@ object Test extends App { } val toolbox = cm.mkToolBox() - val dyn = toolbox.runExpr(new Foo(y).fun.tree) + val dyn = toolbox.eval(new Foo(y).fun.tree) dyn.asInstanceOf[Int] } diff --git a/test/pending/run/reify_closure9b.scala b/test/pending/run/reify_closure9b.scala index df9db9b806..a6920b4e02 100644 --- a/test/pending/run/reify_closure9b.scala +++ b/test/pending/run/reify_closure9b.scala @@ -10,7 +10,7 @@ object Test extends App { } val toolbox = cm.mkToolBox() - val dyn = toolbox.runExpr(new Foo(y).fun.tree) + val dyn = toolbox.eval(new Foo(y).fun.tree) dyn.asInstanceOf[Int] } diff --git a/test/pending/run/reify_closures11.scala b/test/pending/run/reify_closures11.scala index 4c21033cbc..9156208b40 100644 --- a/test/pending/run/reify_closures11.scala +++ b/test/pending/run/reify_closures11.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) val foo = dyn.asInstanceOf[Int] println(foo) }
\ No newline at end of file diff --git a/test/pending/run/reify_newimpl_09c.scala b/test/pending/run/reify_newimpl_09c.scala index e2f4a4923a..6bde36328e 100644 --- a/test/pending/run/reify_newimpl_09c.scala +++ b/test/pending/run/reify_newimpl_09c.scala @@ -14,7 +14,7 @@ object Test extends App { val code = foo[Int] println(code.tree.freeTypes) val W = code.tree.freeTypes(2) - cm.mkToolBox().runExpr(code.tree, Map(W -> definitions.IntTpe)) + cm.mkToolBox().eval(code.tree, Map(W -> definitions.IntTpe)) println(code.eval) } }
\ No newline at end of file diff --git a/test/pending/run/reify_newimpl_46.scala b/test/pending/run/reify_newimpl_46.scala index 239c53953b..d063be0486 100644 --- a/test/pending/run/reify_newimpl_46.scala +++ b/test/pending/run/reify_newimpl_46.scala @@ -8,7 +8,7 @@ object Test extends App { val code = reify{val x: T[String] = null; println("ima worx"); x}.tree println(code.freeTypes) val T = code.freeTypes(0) - cm.mkToolBox().runExpr(code, Map(T -> definitions.ListClass.asType)) + cm.mkToolBox().eval(code, Map(T -> definitions.ListClass.asType)) } new C[List] diff --git a/test/pending/run/reify_newimpl_53.scala b/test/pending/run/reify_newimpl_53.scala index a73a0b94cb..54fa4bec1d 100644 --- a/test/pending/run/reify_newimpl_53.scala +++ b/test/pending/run/reify_newimpl_53.scala @@ -11,7 +11,7 @@ object Test extends App { }.tree println(code.freeTypes) val T = code.freeTypes(0) - cm.mkToolBox().runExpr(code, Map(T -> definitions.StringClass.asType)) + cm.mkToolBox().eval(code, Map(T -> definitions.StringClass.asType)) } new C[String] |