aboutsummaryrefslogtreecommitdiff
path: root/tests/run
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run')
-rw-r--r--tests/run/Course-2002-01.check34
-rw-r--r--tests/run/Course-2002-01.scala239
-rw-r--r--tests/run/Course-2002-10.check46
-rw-r--r--tests/run/Course-2002-10.scala135
-rw-r--r--tests/run/NestedClasses.check9
-rw-r--r--tests/run/NestedClasses.scala97
-rw-r--r--tests/run/array-addition.check4
-rw-r--r--tests/run/array-addition.scala11
-rw-r--r--tests/run/arrayclone-new.scala109
-rw-r--r--tests/run/arrays.check1
-rw-r--r--tests/run/arrays.scala937
-rw-r--r--tests/run/classof.check23
-rw-r--r--tests/run/classof.scala37
-rw-r--r--tests/run/classtags_contextbound.check1
-rw-r--r--tests/run/classtags_contextbound.scala7
-rw-r--r--tests/run/collection-stacks.check14
-rw-r--r--tests/run/collection-stacks.scala38
-rw-r--r--tests/run/collections.check42
-rw-r--r--tests/run/collections.scala119
-rw-r--r--tests/run/constructors.check5
-rw-r--r--tests/run/constructors.scala28
-rw-r--r--tests/run/contrib674.check0
-rw-r--r--tests/run/contrib674.scala19
-rw-r--r--tests/run/emptypf.check3
-rw-r--r--tests/run/emptypf.scala14
-rw-r--r--tests/run/hashCodeBoxesRunTime.scala28
-rw-r--r--tests/run/i659.scala26
-rw-r--r--tests/run/lazy-exprs.check13
-rw-r--r--tests/run/lazy-exprs.scala95
-rw-r--r--tests/run/nothingTypeNoFramesNoDce.check0
-rw-r--r--tests/run/nothingTypeNoFramesNoDce.flags1
-rw-r--r--tests/run/nothingTypeNoFramesNoDce.scala61
-rw-r--r--tests/run/origins.check6
-rw-r--r--tests/run/origins.flags1
-rw-r--r--tests/run/origins.scala21
-rw-r--r--tests/run/shortClass.check10
-rw-r--r--tests/run/shortClass.scala26
-rw-r--r--tests/run/spec-self.check2
-rw-r--r--tests/run/spec-self.scala14
-rw-r--r--tests/run/t0807.check1
-rw-r--r--tests/run/t0807.scala5
-rw-r--r--tests/run/t2087-and-2400.scala20
-rw-r--r--tests/run/t2857.check1
-rw-r--r--tests/run/t2857.scala9
-rw-r--r--tests/run/t3038.check19
-rw-r--r--tests/run/t3038.scala68
-rw-r--r--tests/run/t3038b.check6
-rw-r--r--tests/run/t3038b.flags1
-rw-r--r--tests/run/t3038b.scala20
-rw-r--r--tests/run/t3038c.check2
-rw-r--r--tests/run/t3038c/A_1.scala83
-rw-r--r--tests/run/t3038c/B_2.scala24
-rw-r--r--tests/run/t3126.scala9
-rw-r--r--tests/run/t3452.check1
-rw-r--r--tests/run/t3452.scala21
-rw-r--r--tests/run/t3452c.check8
-rw-r--r--tests/run/t3452c.scala113
-rw-r--r--tests/run/t3452f.scala19
-rw-r--r--tests/run/t3502.scala24
-rw-r--r--tests/run/t3651.scala10
-rw-r--r--tests/run/t3670.check5
-rw-r--r--tests/run/t3670.scala31
-rw-r--r--tests/run/t3895.check2
-rw-r--r--tests/run/t3895.flags1
-rw-r--r--tests/run/t3895.scala36
-rw-r--r--tests/run/t3980.check3
-rw-r--r--tests/run/t3980.scala19
-rw-r--r--tests/run/t4742.flags1
-rw-r--r--tests/run/t4742.scala7
-rw-r--r--tests/run/t5045.check6
-rw-r--r--tests/run/t5045.scala49
-rw-r--r--tests/run/t5300.scala7
-rw-r--r--tests/run/t5328.check3
-rw-r--r--tests/run/t5328.scala5
-rw-r--r--tests/run/t5610a.check1
-rw-r--r--tests/run/t5610a.scala19
-rw-r--r--tests/run/t5629b.check10
-rw-r--r--tests/run/t5629b.scala36
-rw-r--r--tests/run/t603.check5
-rw-r--r--tests/run/t603.scala35
-rw-r--r--tests/run/t6853.scala18
-rw-r--r--tests/run/t751.scala6
-rw-r--r--tests/run/t7584.check6
-rw-r--r--tests/run/t7584.flags1
-rw-r--r--tests/run/t7584.scala14
-rw-r--r--tests/run/t7859/A_1.scala11
-rw-r--r--tests/run/t7859/B_2.scala47
-rw-r--r--tests/run/t8280.check9
-rw-r--r--tests/run/t8280.scala82
-rw-r--r--tests/run/t8570.flags1
-rw-r--r--tests/run/t8570.scala10
-rw-r--r--tests/run/t8570a.check1
-rw-r--r--tests/run/t8570a.flags1
-rw-r--r--tests/run/t8570a.scala14
-rw-r--r--tests/run/t8611b.flags1
-rw-r--r--tests/run/t8611b.scala54
-rw-r--r--tests/run/t8823.scala10
-rw-r--r--tests/run/t889.check1
-rw-r--r--tests/run/t889.scala9
-rw-r--r--tests/run/t949.scala14
-rw-r--r--tests/run/t978.scala38
-rw-r--r--tests/run/traitParamInit.scala30
-rw-r--r--tests/run/traitParams.scala32
-rwxr-xr-xtests/run/weakconform.scala4
104 files changed, 3435 insertions, 0 deletions
diff --git a/tests/run/Course-2002-01.check b/tests/run/Course-2002-01.check
new file mode 100644
index 000000000..17b30bf3c
--- /dev/null
+++ b/tests/run/Course-2002-01.check
@@ -0,0 +1,34 @@
+232
+667
+11
+10
+62.8318
+62.8318
+62.8318
+4.0
+81.0
+256.0
+25.0
+1
+737.0
+1.0
+0.0
+1.0
+76.0
+1.4142156862745097
+1.7321428571428572
+2.0000000929222947
+1.4142156862745097
+1.7321428571428572
+2.0000000929222947
+1.4142156862745097
+1.7321428571428572
+2.0000000929222947
+sqrt(2) = 1.4142135623746899
+sqrt(2) = 1.4142135623746899
+cbrt(2) = 1.2599210500177698
+1
+1 1
+1 2 1
+1 3 3 1
+1 4 6 4 1
diff --git a/tests/run/Course-2002-01.scala b/tests/run/Course-2002-01.scala
new file mode 100644
index 000000000..3426f26ee
--- /dev/null
+++ b/tests/run/Course-2002-01.scala
@@ -0,0 +1,239 @@
+//############################################################################
+// Programmation IV - 2002 - Week 01
+//############################################################################
+
+object M0 {
+
+ //##########################################################################
+
+ Console.println(87 + 145);
+ Console.println(1000 - 333);
+ Console.println(5 + 2 * 3);
+
+ //##########################################################################
+
+ def size = 2;
+ def pi = 3.14159;
+ def radius = 10;
+ def circumference = 2 * pi * radius;
+
+ Console.println(5 * size);
+ Console.println(2 * pi * radius);
+ Console.println(circumference);
+ Console.println((2 * pi) * radius);
+
+ //##########################################################################
+
+ def square(x: Double) = x * x;
+
+ Console.println(square(2));
+ Console.println(square(5 + 4));
+ Console.println(square(square(4)));
+
+ //##########################################################################
+
+ def sumOfSquares(x: Double, y: Double) = square(x) + square(y);
+
+ Console.println(sumOfSquares(3, 2+2));
+
+ //##########################################################################
+
+ def loop: Int = loop;
+ def first(x: Int, y: Int) = x;
+ def constOne(x: Int, y: => Int) = 1;
+
+ Console.println(constOne(1, loop));
+
+ //##########################################################################
+
+ def abs(x: Double) = if (x >= 0) x else -x;
+
+ Console.println(abs(737));
+ Console.println(abs(1));
+ Console.println(abs(0));
+ Console.println(abs(-1));
+ Console.println(abs(-76));
+
+ //##########################################################################
+
+ def sqrtIter0(guess: Double, x: Double): Double =
+ if (isGoodEnough0(guess, x)) guess
+ else sqrtIter0(improve0(guess, x), x);
+
+ def improve0(guess: Double, x: Double) =
+ (guess + x / guess) / 2;
+
+ def isGoodEnough0(guess: Double, x: Double) =
+ abs(square(guess) - x) < 0.001;
+
+ def sqrt0(x: Double) = sqrtIter0(1.0, x);
+
+ Console.println(sqrt0(2));
+ Console.println(sqrt0(3));
+ Console.println(sqrt0(4));
+
+ //##########################################################################
+
+ def sqrt1(x: Double) = {
+ def sqrtIter1(guess: Double, x: Double): Double =
+ if (isGoodEnough1(guess, x)) guess
+ else sqrtIter1(improve1(guess, x), x);
+
+ def improve1(guess: Double, x: Double) =
+ (guess + x / guess) / 2;
+
+ def isGoodEnough1(guess: Double, x: Double) =
+ abs(square(guess) - x) < 0.001;
+
+ sqrtIter1(1.0, x)
+ }
+
+ Console.println(sqrt1(2));
+ Console.println(sqrt1(3));
+ Console.println(sqrt1(4));
+
+ //##########################################################################
+
+ def sqrt2(x: Double) = {
+ def sqrtIter2(guess: Double): Double =
+ if (isGoodEnough2(guess)) guess
+ else sqrtIter2(improve2(guess));
+
+ def improve2(guess: Double) =
+ (guess + x / guess) / 2;
+
+ def isGoodEnough2(guess: Double) =
+ abs(square(guess) - x) < 0.001;
+
+ sqrtIter2(1.0)
+ }
+
+ Console.println(sqrt2(2));
+ Console.println(sqrt2(3));
+ Console.println(sqrt2(4));
+
+ //##########################################################################
+}
+
+//############################################################################
+
+object M1 {
+ def abs(x: Double) = if (x >= 0) x else -x;
+
+ def sqrt(x: Double): Double = {
+ def sqrtIter(prev: Double, guess: Double): Double =
+ if (isGoodEnough(prev, guess)) guess
+ else sqrtIter(guess, improve(guess));
+
+ def improve(guess: Double) = (guess + x / guess) / 2;
+
+ def isGoodEnough(prev: Double, guess: Double) =
+ abs(prev - guess) / guess < 0.001;
+
+ sqrtIter(1.0, improve(1.0))
+ }
+
+ Console.println("sqrt(2) = " + sqrt(2));
+}
+
+//############################################################################
+
+object M2 {
+ def abs(x: Double) = if (x >= 0) x else -x;
+
+ def sqrt(x:Double):Double = {
+ def sqrtIter(guess:Double):Double = {
+ val next = improve(guess);
+ if (isGoodEnough(guess,next)) next
+ else sqrtIter(next)
+ }
+
+ def improve(guess:Double) = (guess+x/guess)/2;
+
+ def isGoodEnough(prev:Double,guess:Double) = abs(prev-guess)/guess<0.001;
+
+ sqrtIter(1.0)
+ }
+
+ Console.println("sqrt(2) = " + sqrt(2));
+}
+
+//############################################################################
+
+object M3 {
+ def abs(x: Double) = if (x >= 0) x else -x;
+
+ def cbrt(x:Double):Double = {
+ def cbrtIter(guess:Double):Double = {
+ val next = improve(guess);
+ if (isGoodEnough(guess,next)) next
+ else cbrtIter(next)
+ }
+
+ def improve(y:Double) = (x/(y*y)+2*y)/3;
+
+ def isGoodEnough(prev:Double,guess:Double) = abs(prev-guess)/guess<0.001;
+
+ cbrtIter(1.0)
+ }
+
+ Console.println("cbrt(2) = " + cbrt(2));
+}
+
+//############################################################################
+
+object M4 {
+ def pascal(c: Int, l: Int): Int =
+ if (c <= 0 || c >= l) 1
+ else pascal(c - 1, l - 1) + pascal(c, l - 1);
+
+ Console.print(pascal(0,0));
+ Console.println;
+
+ Console.print(pascal(0,1));
+ Console.print(' ');
+ Console.print(pascal(1,1));
+ Console.println;
+
+ Console.print(pascal(0,2));
+ Console.print(' ');
+ Console.print(pascal(1,2));
+ Console.print(' ');
+ Console.print(pascal(2,2));
+ Console.println;
+
+ Console.print(pascal(0,3));
+ Console.print(' ');
+ Console.print(pascal(1,3));
+ Console.print(' ');
+ Console.print(pascal(2,3));
+ Console.print(' ');
+ Console.print(pascal(3,3));
+ Console.println;
+
+ Console.print(pascal(0,4));
+ Console.print(' ');
+ Console.print(pascal(1,4));
+ Console.print(' ');
+ Console.print(pascal(2,4));
+ Console.print(' ');
+ Console.print(pascal(3,4));
+ Console.print(' ');
+ Console.print(pascal(4,4));
+ Console.println;
+}
+
+//############################################################################
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ M0;
+ M1;
+ M2;
+ M3;
+ M4;
+ ()
+ }
+}
+
+//############################################################################
diff --git a/tests/run/Course-2002-10.check b/tests/run/Course-2002-10.check
new file mode 100644
index 000000000..207b671f0
--- /dev/null
+++ b/tests/run/Course-2002-10.check
@@ -0,0 +1,46 @@
+fib(0) = 0
+fib(1) = 1
+fib(2) = 1
+fib(3) = 2
+fib(4) = 3
+fib(5) = 5
+fib(6) = 8
+fib(7) = 13
+fib(8) = 21
+fib(9) = 34
+fib(10) = 55
+fib(11) = 89
+fib(12) = 144
+fib(13) = 233
+fib(14) = 377
+fib(15) = 610
+fib(16) = 987
+fib(17) = 1597
+fib(18) = 2584
+fib(19) = 4181
+
+pi(0) = 4.0 , 3.166666666666667 , 4.0
+pi(1) = 2.666666666666667 , 3.1333333333333337, 3.166666666666667
+pi(2) = 3.466666666666667 , 3.1452380952380956, 3.142105263157895
+pi(3) = 2.8952380952380956, 3.1396825396825396, 3.1415993573190044
+pi(4) = 3.33968253968254 , 3.142712842712843 , 3.141592714033778
+pi(5) = 2.976046176046176 , 3.140881340881341 , 3.1415926539752923
+pi(6) = 3.283738483738484 , 3.142071817071817 , 3.141592653591176
+pi(7) = 3.017071817071817 , 3.1412548236077646, 3.141592653589777
+pi(8) = 3.252365934718876 , 3.1418396189294024, 3.141592653589794
+pi(9) = 3.0418396189294024, 3.141406718496502 , 3.1415926535897936
+pi = 3.141592653589793 , 3.141592653589793 , 3.141592653589793
+
+ln(0) = 1.0 , 0.7 , 1.0
+ln(1) = 0.5 , 0.6904761904761905, 0.7
+ln(2) = 0.8333333333333333, 0.6944444444444444, 0.6932773109243697
+ln(3) = 0.5833333333333333, 0.6924242424242424, 0.6931488693329254
+ln(4) = 0.7833333333333333, 0.6935897435897436, 0.6931471960735491
+ln(5) = 0.6166666666666667, 0.6928571428571428, 0.6931471806635636
+ln(6) = 0.7595238095238095, 0.6933473389355742, 0.6931471805604038
+ln(7) = 0.6345238095238095, 0.6930033416875522, 0.6931471805599444
+ln(8) = 0.7456349206349207, 0.6932539682539682, 0.6931471805599426
+ln(9) = 0.6456349206349206, 0.6930657506744463, 0.6931471805599453
+ln = 0.6931471805599453, 0.6931471805599453, 0.6931471805599453
+
+prime numbers: 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113
diff --git a/tests/run/Course-2002-10.scala b/tests/run/Course-2002-10.scala
new file mode 100644
index 000000000..4cfa1deb0
--- /dev/null
+++ b/tests/run/Course-2002-10.scala
@@ -0,0 +1,135 @@
+//############################################################################
+// Programmation IV - 2002 - Week 10
+//############################################################################
+
+import math.{Pi, log}
+
+object M0 {
+
+ def addStream (s1: Stream[Int], s2: Stream[Int]): Stream[Int] =
+ Stream.cons(s1.head + s2.head, addStream(s1.tail, s2.tail));
+
+ val fib: Stream[Int] =
+ Stream.cons(0, Stream.cons(1, addStream(this.fib, this.fib.tail)));
+
+ def test = {
+ var i = 0;
+ fib.take(20).foreach(n => {Console.println("fib("+i+") = "+n); i=i+1});
+ Console.println;
+ }
+}
+
+//############################################################################
+
+object M1 {
+
+ def scale(x: Double, s: Stream[Double]): Stream[Double] =
+ s map { e: Double => e*x }
+
+ def partialSums(s: Stream[Double]): Stream[Double] =
+ Stream.cons(s.head, partialSums(s.tail) map (x => x + s.head));
+
+ def euler(s: Stream[Double]): Stream[Double] = {
+ val nm1 = s apply 0;
+ val n = s apply 1;
+ val np1 = s apply 2;
+ Stream.cons(np1 - ((np1 - n)*(np1 - n) / (nm1 - 2*n + np1)),euler(s.tail))
+ };
+
+ def better(s: Stream[Double], transform: Stream[Double] => Stream[Double])
+ : Stream[Stream[Double]] =
+ Stream.cons(s, better(transform(s), transform));
+
+ def veryGood(s: Stream[Double], transform: Stream[Double] => Stream[Double])
+ : Stream[Double] =
+ better(s, transform) map (x => x.head);
+
+ def lnSummands(n: Double): Stream[Double] =
+ Stream.cons(1.0 / n, lnSummands(n + 1.0) map { x: Double => -x })
+
+ var ln0 = partialSums(lnSummands(1.0));
+ var ln1 = euler(ln0);
+ var ln2 = veryGood(ln0, euler);
+
+ def piSummands(n: Double): Stream[Double] =
+ Stream.cons(1.0 / n, piSummands(n + 2.0) map { x: Double => -x })
+
+ var pi0 = scale(4.0, partialSums(piSummands(1.0)));
+ var pi1 = euler(pi0);
+ var pi2 = veryGood(pi0, euler);
+
+ def pad(s: String, n: Int): String =
+ if (n <= 0) s.substring(0, s.length() + n)
+ else pad(s + " ", n - 1);
+ def str(d: Double) = { val s = d.toString(); pad(s, 18 - s.length()) };
+
+ def test = {
+ var i = 0;
+ while (i < 10) {
+ Console.print("pi("+i+") = ");
+ Console.print(str(pi0.apply(i)) + ", ");
+ Console.print(str(pi1.apply(i)) + ", ");
+ Console.print(str(pi2.apply(i)) + "\n");
+ i = i + 1;
+ }
+ Console.print("pi = ");
+ Console.print(str(Pi) + ", ");
+ Console.print(str(Pi) + ", ");
+ Console.print(str(Pi) + "\n");
+ Console.println;
+ i = 0;
+ while (i < 10) {
+ Console.print("ln("+i+") = ");
+ Console.print(str(ln0.apply(i)) + ", ");
+ Console.print(str(ln1.apply(i)) + ", ");
+ Console.print(str(ln2.apply(i)) + "\n");
+ i = i + 1;
+ }
+ Console.print("ln = ");
+ Console.print(str(log(2)) + ", ");
+ Console.print(str(log(2)) + ", ");
+ Console.print(str(log(2)) + "\n");
+ Console.println;
+ }
+}
+
+//############################################################################
+
+object M2 {
+
+ class IntIterator(start: Int) extends Iterator[Int] {
+ var current: Int = start;
+ def hasNext = true;
+ def next = { current = current + 1; current - 1 };
+ }
+
+ class PrimeIterator() extends Iterator[Int] {
+ var current: Iterator[Int] = new IntIterator(2);
+ def hasNext = true;
+ def next = {
+ val p = current.next;
+ current = current filter { x => !((x % p) == 0) };
+ p
+ }
+ }
+
+ def test = {
+ val i = (new PrimeIterator()).take(30);
+ Console.print("prime numbers:");
+ while (i.hasNext) { Console.print(" " + i.next); }
+ Console.println;
+ }
+}
+
+//############################################################################
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ M0.test;
+ M1.test;
+ M2.test;
+ ()
+ }
+}
+
+//############################################################################
diff --git a/tests/run/NestedClasses.check b/tests/run/NestedClasses.check
new file mode 100644
index 000000000..a7ebc386e
--- /dev/null
+++ b/tests/run/NestedClasses.check
@@ -0,0 +1,9 @@
+e.e1 = 119
+cc.m = 3
+cc.am = 1
+cc.bm = 2
+aaa.f = 111
+bbb1.f = 42
+bbb2.f = 24
+bbb3.f = 24
+bbb4.f = 24
diff --git a/tests/run/NestedClasses.scala b/tests/run/NestedClasses.scala
new file mode 100644
index 000000000..6db713e08
--- /dev/null
+++ b/tests/run/NestedClasses.scala
@@ -0,0 +1,97 @@
+//############################################################################
+// Test nested classes
+//############################################################################
+
+// The following set of classes tests nasty references to "outer"
+// values.
+
+class A(pa : Int) {
+ def a1 = pa;
+ class B(pb : Int) {
+ def b1 = pa+pb+a1;
+ class C(pc : Int) extends A(b1) {
+ def c1 = pc+pb+pa
+ }
+ val c1 = new C(13)
+ }
+}
+
+trait M {
+ def m1 = 1
+}
+
+class A1(x : Int) extends A(x) with M {
+ class D extends B(14) {
+ val c2 = new C(15);
+ class E extends C(16) {
+ def e1 = c1+b1+a1+m1;
+ def e2 = new D();
+ }
+ }
+}
+
+// The following set of classes test qualified "this" and "super"
+// references.
+
+class AA {
+ def m = 1;
+ class BB {
+ def m = 2;
+ class CC {
+ def m = 3;
+ def am = AA.this.m;
+ def bm = BB.this.m;
+ }
+ }
+}
+
+class AAA {
+ def f = 42;
+}
+
+class BBB extends AAA {
+ override def f = 24;
+}
+
+class AAA1 extends AAA {
+ override def f = 111;
+ class BBB1 extends BBB {
+ override def f = AAA1.super.f;
+ }
+ class BBB2 extends BBB {
+ override def f = BBB2.super.f;
+ }
+ class BBB3 extends BBB {
+ override def f = super.f;
+ }
+ class BBB4 extends BBB { }
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val a = new A1(12);
+ val d = new a.D;
+ val e = new d.E;
+ Console.println("e.e1 = " + e.e1);
+
+ val aa = new AA;
+ val bb = new aa.BB;
+ val cc = new bb.CC;
+ Console.println("cc.m = " + cc.m);
+ Console.println("cc.am = " + cc.am);
+ Console.println("cc.bm = " + cc.bm);
+
+ val aaa = new AAA1;
+ val bbb1 = new aaa.BBB1;
+ val bbb2 = new aaa.BBB2;
+ val bbb3 = new aaa.BBB3;
+ val bbb4 = new aaa.BBB4;
+ Console.println("aaa.f = " + aaa.f);
+ Console.println("bbb1.f = " + bbb1.f);
+ Console.println("bbb2.f = " + bbb2.f);
+ Console.println("bbb3.f = " + bbb3.f);
+ Console.println("bbb4.f = " + bbb4.f);
+ }
+}
+
+//############################################################################
diff --git a/tests/run/array-addition.check b/tests/run/array-addition.check
new file mode 100644
index 000000000..7bfbd9c71
--- /dev/null
+++ b/tests/run/array-addition.check
@@ -0,0 +1,4 @@
+Array(1, 2, 3, 4)
+Array(1, 2, 3, 4)
+Array(1)
+Array(1)
diff --git a/tests/run/array-addition.scala b/tests/run/array-addition.scala
new file mode 100644
index 000000000..8def48e85
--- /dev/null
+++ b/tests/run/array-addition.scala
@@ -0,0 +1,11 @@
+object Test {
+ def prettyPrintArray(x: Array[_]) = println("Array(" + x.mkString(", ") + ")")
+
+ def main(args: Array[String]): Unit = {
+ prettyPrintArray(Array(1,2,3) :+ 4)
+ prettyPrintArray(1 +: Array(2,3,4))
+ prettyPrintArray(Array() :+ 1)
+ prettyPrintArray(1 +: Array())
+ }
+}
+
diff --git a/tests/run/arrayclone-new.scala b/tests/run/arrayclone-new.scala
new file mode 100644
index 000000000..8f66d1b31
--- /dev/null
+++ b/tests/run/arrayclone-new.scala
@@ -0,0 +1,109 @@
+import scala.reflect.ClassTag
+
+object Test extends dotty.runtime.LegacyApp{
+ BooleanArrayClone;
+ ByteArrayClone;
+ ShortArrayClone;
+ CharArrayClone;
+ IntArrayClone;
+ LongArrayClone;
+ FloatArrayClone;
+ DoubleArrayClone;
+ ObjectArrayClone;
+ PolymorphicArrayClone;
+}
+
+object BooleanArrayClone{
+ val it : Array[Boolean] = Array(true, false);
+ val cloned = it.clone();
+ assert(cloned.sameElements(it));
+ cloned(0) = false;
+ assert(it(0) == true)
+}
+
+object ByteArrayClone{
+ val it : Array[Byte] = Array(1, 0);
+ val cloned = it.clone();
+ assert(cloned.sameElements(it));
+ cloned(0) = 0;
+ assert(it(0) == 1)
+}
+
+object ShortArrayClone{
+ val it : Array[Short] = Array(1, 0);
+ val cloned = it.clone();
+ assert(cloned.sameElements(it));
+ cloned(0) = 0;
+ assert(it(0) == 1)
+}
+
+object CharArrayClone{
+ val it : Array[Char] = Array(1, 0);
+ val cloned = it.clone();
+ assert(cloned.sameElements(it));
+ cloned(0) = 0;
+ assert(it(0) == 1)
+}
+
+object IntArrayClone{
+ val it : Array[Int] = Array(1, 0);
+ val cloned = it.clone();
+ assert(cloned.sameElements(it));
+ cloned(0) = 0;
+ assert(it(0) == 1)
+}
+
+object LongArrayClone{
+ val it : Array[Long] = Array(1, 0);
+ val cloned = it.clone();
+ assert(cloned.sameElements(it));
+ cloned(0) = 0;
+ assert(it(0) == 1)
+}
+
+object FloatArrayClone{
+ val it : Array[Float] = Array(1, 0);
+ val cloned = it.clone();
+ assert(cloned.sameElements(it));
+ cloned(0) = 0;
+ assert(it(0) == 1)
+}
+
+object DoubleArrayClone{
+ val it : Array[Double] = Array(1, 0);
+ val cloned = it.clone();
+ assert(cloned.sameElements(it));
+ cloned(0) = 0;
+ assert(it(0) == 1)
+}
+
+object ObjectArrayClone{
+ val it : Array[String] = Array("1", "0");
+ val cloned = it.clone();
+ assert(cloned.sameElements(it));
+ cloned(0) = "0";
+ assert(it(0) == "1")
+}
+
+object PolymorphicArrayClone{
+ def testIt[T](it : Array[T], one : T, zero : T) = {
+ val cloned = it.clone();
+ assert(cloned.sameElements(it));
+ cloned(0) = zero;
+ assert(it(0) == one)
+ }
+
+ testIt(Array("one", "two"), "one", "two");
+
+ class Mangler[T: ClassTag](ts : T*){
+ // this will always be a BoxedAnyArray even after we've unboxed its contents.
+ val it = ts.toArray[T];
+ }
+
+ val mangled = new Mangler[Int](0, 1);
+
+ val y : Array[Int] = mangled.it; // make sure it's unboxed
+
+ testIt(mangled.it, 0, 1);
+}
+
diff --git a/tests/run/arrays.check b/tests/run/arrays.check
new file mode 100644
index 000000000..b1f7fae1d
--- /dev/null
+++ b/tests/run/arrays.check
@@ -0,0 +1 @@
+checks: 2302
diff --git a/tests/run/arrays.scala b/tests/run/arrays.scala
new file mode 100644
index 000000000..1a77a191c
--- /dev/null
+++ b/tests/run/arrays.scala
@@ -0,0 +1,937 @@
+//############################################################################
+// Arrays
+//############################################################################
+
+//############################################################################
+
+object Test {
+
+ //##########################################################################
+ // Types
+
+ type Strings = List[String]
+ type Map = scala.collection.Map[Int, Any]
+ type HashMap = scala.collection.mutable.HashMap[Int, Any]
+ type TreeMap = scala.collection.immutable.TreeMap[Int, Any]
+
+ //##########################################################################
+ // Identity Functions
+
+ def id_Ta_T[T <: Any ](x: T): T = x;
+ def id_Tr_T[T <: AnyRef ](x: T): T = x;
+ def id_To_T[T <: Object ](x: T): T = x;
+
+ def id_Ta_a[T <: Any ](x: T): Any = x;
+ def id_Tr_a[T <: AnyRef ](x: T): Any = x;
+ def id_To_a[T <: Object ](x: T): Any = x;
+
+ def id_Tr_r[T <: AnyRef ](x: T): AnyRef = x;
+ def id_To_r[T <: Object ](x: T): AnyRef = x;
+
+ def id_To_o[T <: Object ](x: T): Object = x;
+
+ def id_TSa_T [S <: Any , T <: Array[S]](x: T): T = x;
+ def id_TSv_T [S <: AnyVal , T <: Array[S]](x: T): T = x;
+ def id_TSr_T [S <: AnyRef , T <: Array[S]](x: T): T = x;
+ def id_TSo_T [S <: Object , T <: Array[S]](x: T): T = x;
+ def id_TSm_T [S <: Map , T <: Array[S]](x: T): T = x;
+ def id_TSn_T [S <: Strings, T <: Array[S]](x: T): T = x;
+
+ def id_TSa_Ss[S <: Any , T <: Array[S]](x: T): Array[S] = x;
+ def id_TSv_Ss[S <: AnyVal , T <: Array[S]](x: T): Array[S] = x;
+ def id_TSr_Ss[S <: AnyRef , T <: Array[S]](x: T): Array[S] = x;
+ def id_TSo_Ss[S <: Object , T <: Array[S]](x: T): Array[S] = x;
+ def id_TSm_Ss[S <: Map , T <: Array[S]](x: T): Array[S] = x;
+ def id_TSn_Ss[S <: Strings, T <: Array[S]](x: T): Array[S] = x;
+
+ def id_TSa_a [S <: Any , T <: Array[S]](x: T): Any = x;
+ def id_TSv_a [S <: AnyVal , T <: Array[S]](x: T): Any = x;
+ def id_TSr_a [S <: AnyRef , T <: Array[S]](x: T): Any = x;
+ def id_TSo_a [S <: Object , T <: Array[S]](x: T): Any = x;
+ def id_TSm_a [S <: Map , T <: Array[S]](x: T): Any = x;
+ def id_TSn_a [S <: Strings, T <: Array[S]](x: T): Any = x;
+
+ def id_TSa_r [S <: Any , T <: Array[S]](x: T): AnyRef = x;
+ def id_TSv_r [S <: AnyVal , T <: Array[S]](x: T): AnyRef = x;
+ def id_TSr_r [S <: AnyRef , T <: Array[S]](x: T): AnyRef = x;
+ def id_TSo_r [S <: Object , T <: Array[S]](x: T): AnyRef = x;
+ def id_TSm_r [S <: Map , T <: Array[S]](x: T): AnyRef = x;
+ def id_TSn_r [S <: Strings, T <: Array[S]](x: T): AnyRef = x;
+
+ def id_TSa_o [S <: Any , T <: Array[S]](x: T): Object = x;
+ def id_TSv_o [S <: AnyVal , T <: Array[S]](x: T): Object = x;
+ def id_TSr_o [S <: AnyRef , T <: Array[S]](x: T): Object = x;
+ def id_TSo_o [S <: Object , T <: Array[S]](x: T): Object = x;
+ def id_TSm_o [S <: Map , T <: Array[S]](x: T): Object = x;
+ def id_TSn_o [S <: Strings, T <: Array[S]](x: T): Object = x;
+
+ def id_Sas_Ss[S <: Any ](xs: Array[S]): Array[S] = xs;
+ def id_Svs_Ss[S <: AnyVal ](xs: Array[S]): Array[S] = xs;
+ def id_Srs_Ss[S <: AnyRef ](xs: Array[S]): Array[S] = xs;
+ def id_Sos_Ss[S <: Object ](xs: Array[S]): Array[S] = xs;
+ def id_Sms_Ss[S <: Map ](xs: Array[S]): Array[S] = xs;
+ def id_Sns_Ss[S <: Strings](xs: Array[S]): Array[S] = xs;
+
+ def id_Sas_a [S <: Any ](xs: Array[S]): Any = xs;
+ def id_Svs_a [S <: AnyVal ](xs: Array[S]): Any = xs;
+ def id_Srs_a [S <: AnyRef ](xs: Array[S]): Any = xs;
+ def id_Sos_a [S <: Object ](xs: Array[S]): Any = xs;
+ def id_Sms_a [S <: Map ](xs: Array[S]): Any = xs;
+ def id_Sns_a [S <: Strings](xs: Array[S]): Any = xs;
+
+ def id_Sas_r [S <: Any ](xs: Array[S]): AnyRef = xs;
+ def id_Svs_r [S <: AnyVal ](xs: Array[S]): AnyRef = xs;
+ def id_Srs_r [S <: AnyRef ](xs: Array[S]): AnyRef = xs;
+ def id_Sos_r [S <: Object ](xs: Array[S]): AnyRef = xs;
+ def id_Sms_r [S <: Map ](xs: Array[S]): AnyRef = xs;
+ def id_Sns_r [S <: Strings](xs: Array[S]): AnyRef = xs;
+
+ def id_Sas_o [S <: Any ](xs: Array[S]): Object = xs;
+ def id_Svs_o [S <: AnyVal ](xs: Array[S]): Object = xs;
+ def id_Srs_o [S <: AnyRef ](xs: Array[S]): Object = xs;
+ def id_Sos_o [S <: Object ](xs: Array[S]): Object = xs;
+ def id_Sms_o [S <: Map ](xs: Array[S]): Object = xs;
+ def id_Sns_o [S <: Strings](xs: Array[S]): Object = xs;
+
+ //##########################################################################
+ // Generic Checks
+
+ type Check[T] = Array[T] => Unit;
+
+ var checks: Int = 0;
+
+ def check(test0: Boolean, actual: Any, expected: Any): Unit = {
+ val test1: Boolean = actual == expected;
+ if (!test0 || !test1) {
+ val s0 = if (test0) "ok" else "KO";
+ val s1 = if (test1) "ok" else "KO";
+ val s2 = actual.toString();
+ val s3 = expected.toString();
+ sys.error(s0 + " - " + s1 + ": " + s2 + " != " + s3);
+ }
+ checks += 1
+ }
+
+ def check_Ta[T <: Any ](xs: Array[T], l: Int, x0: T, c: Check[T]): Unit = {
+ check(xs.length == l, xs.length, l);
+ check(xs(0) == x0, xs(0), x0);
+ c(xs);
+ }
+
+ def check_Tv[T <: AnyVal ](xs: Array[T], l: Int, x0: T, c: Check[T]): Unit = {
+ check(xs.length == l, xs.length, l);
+ check(xs(0) == x0, xs(0), x0);
+ check_Ta(xs, l, x0, c);
+ c(xs);
+ }
+
+ def check_Tr[T <: AnyRef ](xs: Array[T], l: Int, x0: T, c: Check[T]): Unit = {
+ check(xs.length == l, xs.length, l);
+ check(xs(0) == x0, xs(0), x0);
+ check_Ta(xs, l, x0, c);
+ c(xs);
+ }
+
+ def check_To[T <: Object ](xs: Array[T], l: Int, x0: T, c: Check[T]): Unit = {
+ check(xs.length == l, xs.length, l);
+ check(xs(0) == x0, xs(0), x0);
+ check_Ta(xs, l, x0, c);
+ check_Tr(xs, l, x0, c);
+ c(xs);
+ }
+
+ def check_Tm[T <: Map ](xs: Array[T], l: Int, x0: T, c: Check[T]): Unit = {
+ check(xs.length == l, xs.length, l)
+ check(xs(0) == x0, xs(0), x0)
+ check_Ta(xs, l, x0, c)
+ check_Tr(xs, l, x0, c)
+ check_To(xs, l, x0, c)
+ c(xs)
+ }
+
+ def check_Tn[T <: Strings](xs: Array[T], l: Int, x0: T, c: Check[T]): Unit = {
+ check(xs.length == l, xs.length, l)
+ check(xs(0) == x0, xs(0), x0)
+ check_Ta(xs, l, x0, c)
+ check_Tr(xs, l, x0, c)
+ check_To(xs, l, x0, c)
+ c(xs)
+ }
+
+ def checkT2368(): Unit = {
+ val arr = Array(1, 2, 3)
+ arr(0) += 1
+ assert(arr(0) == 2)
+ }
+
+ //##########################################################################
+ // Values
+
+ val u0: Unit = ();
+ val u1: Unit = ();
+
+ val z0: Boolean = false;
+ val z1: Boolean = true;
+
+ val b0: Byte = Byte.MinValue;
+ val b1: Byte = 1;
+ val b2: Byte = Byte.MaxValue;
+
+ val s0: Short = Short.MinValue;
+ val s1: Short = 2;
+ val s2: Short = Short.MaxValue;
+
+ val c0: Char = Char.MinValue;
+ val c1: Char = '3';
+ val c2: Char = Char.MaxValue;
+
+ val i0: Int = Int.MinValue;
+ val i1: Int = 4;
+ val i2: Int = Int.MinValue;
+
+ val l0: Long = Long.MinValue;
+ val l1: Int = 5;
+ val l2: Long = Long.MaxValue;
+
+ val f0: Float = Float.MinValue;
+ val f1: Int = 6;
+ val f2: Float = Float.MaxValue;
+
+ val d0: Double = Double.MinValue;
+ val d1: Int = 7;
+ val d2: Double = Double.MaxValue;
+
+ val a0: Unit = ();
+ val a1: Boolean = false;
+ val a2: Int = 0;
+ val a3: Null = null;
+ val a4: String = "a-z";
+ val a5: Symbol = 'token;
+ val a6: HashMap = new HashMap();
+ val a7: TreeMap = scala.collection.immutable.TreeMap.empty[Int, Any];
+ val a8: Strings = List("a", "z");
+
+ val v0: Unit = ();
+ val v1: Boolean = false;
+ val v2: Int = 0;
+ val v3: Long = l2;
+ val v4: Float = f2;
+ val v5: Double = d2;
+
+ val r0: Null = a3;
+ val r1: String = a4;
+ val r2: Symbol = a5;
+ val r3: HashMap = a6;
+ val r4: TreeMap = a7;
+ val r5: Strings = a8;
+
+ val o0: Null = r0;
+ val o1: String = r1;
+ val o2: Symbol = r2;
+ val o3: HashMap = r3;
+ val o4: TreeMap = r4;
+ val o5: Strings = r5;
+
+ val m0: Null = r0;
+ val m1: HashMap = r3;
+ val m2: TreeMap = r4;
+
+ val n0: Null = r0;
+ val n1: Strings = r5;
+ val n2: Nil.type= Nil;
+
+ //##########################################################################
+ // Specific Checks
+
+ def ucheck(xs: Array[Unit ]): Unit = {
+ check(xs.length == 2, xs.length, 2);
+ check(xs(0) == u0, xs(0), u0);
+ check(xs(1) == u1, xs(1), u1);
+ }
+
+ def zcheck(xs: Array[Boolean]): Unit = {
+ check(xs.length == 2, xs.length, 2);
+ check(xs(0) == z0, xs(0), z0);
+ check(xs(1) == z1, xs(1), z1);
+ }
+
+ def bcheck(xs: Array[Byte ]): Unit = {
+ check(xs.length == 3, xs.length, 3);
+ check(xs(0) == b0, xs(0), b0);
+ check(xs(1) == b1, xs(1), b1);
+ check(xs(2) == b2, xs(2), b2);
+ }
+
+ def scheck(xs: Array[Short ]): Unit = {
+ check(xs.length == 3, xs.length, 3);
+ check(xs(0) == s0, xs(0), s0);
+ check(xs(1) == s1, xs(1), s1);
+ check(xs(2) == s2, xs(2), s2);
+ }
+
+ def ccheck(xs: Array[Char ]): Unit = {
+ check(xs.length == 3, xs.length, 3);
+ check(xs(0) == c0, xs(0), c0);
+ check(xs(1) == c1, xs(1), c1);
+ check(xs(2) == c2, xs(2), c2);
+ }
+
+ def icheck(xs: Array[Int ]): Unit = {
+ check(xs.length == 3, xs.length, 3);
+ check(xs(0) == i0, xs(0), i0);
+ check(xs(1) == i1, xs(1), i1);
+ check(xs(2) == i2, xs(2), i2);
+ }
+
+ def lcheck(xs: Array[Long ]): Unit = {
+ check(xs.length == 3, xs.length, 3);
+ check(xs(0) == l0, xs(0), l0);
+ check(xs(1) == l1, xs(1), l1: Long); // !!! : Long
+ check(xs(2) == l2, xs(2), l2);
+ }
+
+ def fcheck(xs: Array[Float ]): Unit = {
+ check(xs.length == 3, xs.length, 3);
+ check(xs(0) == f0, xs(0), f0);
+ check(xs(1) == f1, xs(1), f1: Float); // !!! : Float
+ check(xs(2) == f2, xs(2), f2);
+ }
+
+ def dcheck(xs: Array[Double ]): Unit = {
+ check(xs.length == 3, xs.length, 3);
+ check(xs(0) == d0, xs(0), d0);
+ check(xs(1) == d1, xs(1), d1: Double); // !!! : Double
+ check(xs(2) == d2, xs(2), d2);
+ }
+
+ def rcheck(xs: Array[AnyRef ]): Unit = {
+ check(xs.length == 6, xs.length, 6);
+ check(xs(0) == r0, xs(0), r0);
+ check(xs(1) == r1, xs(1), r1);
+ check(xs(2) == r2, xs(2), r2);
+ check(xs(3) == r3, xs(3), r3);
+ check(xs(4) == r4, xs(4), r4);
+ check(xs(5) == r5, xs(5), r5);
+ }
+
+ def ocheck(xs: Array[Object ]): Unit = {
+ check(xs.length == 6, xs.length, 6);
+ check(xs(0) == o0, xs(0), o0);
+ check(xs(1) == o1, xs(1), o1);
+ check(xs(2) == o2, xs(2), o2);
+ check(xs(3) == o3, xs(3), o3);
+ check(xs(4) == o4, xs(4), o4);
+ check(xs(5) == o5, xs(5), o5);
+ }
+
+ def mcheck(xs: Array[Map ]): Unit = {
+ check(xs.length == 3, xs.length, 3);
+ check(xs(0) == m0, xs(0), m0);
+ check(xs(1) == m1, xs(1), m1);
+ check(xs(2) == m2, xs(2), m2);
+ }
+
+ def ncheck(xs: Array[Strings]): Unit = {
+ check(xs.length == 3, xs.length, 3)
+ check(xs(0) == n0, xs(0), n0)
+ check(xs(1) == n1, xs(1), n1)
+ check(xs(2) == n2, xs(2), n2)
+ }
+
+ //##########################################################################
+ // Miscellaneous checks
+
+ def checkZip: Unit = {
+ val zipped = Array("a", "b", "c").zip(Array(1, 2))
+ val expected = Array(("a",1), ("b",2))
+ check(zipped sameElements expected, zipped.toList, expected.toList)
+ }
+
+ def checkConcat: Unit = { // ticket #713
+ val x1 = Array.concat(Array(1, 2), Array(3, 4))
+ val y1 = Array(1, 2, 3, 4)
+ check(x1 sameElements y1, x1.toList, y1.toList)
+ }
+
+ //##########################################################################
+ // Arrays
+
+ val uarray: Array[Unit ] = Array(u0, u1);
+ val zarray: Array[Boolean] = Array(z0, z1);
+ val barray: Array[Byte ] = Array(b0, b1, b2);
+ val sarray: Array[Short ] = Array(s0, s1, s2);
+ val carray: Array[Char ] = Array(c0, c1, c2);
+ val iarray: Array[Int ] = Array(i0, i1, i2);
+ val larray: Array[Long ] = Array(l0, l1, l2);
+ val farray: Array[Float ] = Array(f0, f1, f2);
+ val darray: Array[Double ] = Array(d0, d1, d2);
+ val rarray: Array[AnyRef ] = Array(r0, r1, r2, r4, r4, r5);
+ val oarray: Array[Object ] = Array(o0, o1, o2, o4, o4, o5);
+ val marray: Array[Map ] = Array(m0, m1, m2);
+ val narray: Array[Strings] = Array(n0, n1, n2);
+
+ //##########################################################################
+ // Main
+
+ def main(args: Array[String]): Unit = {
+
+ //######################################################################
+
+ ucheck(uarray);
+ zcheck(zarray);
+ bcheck(barray);
+ scheck(sarray);
+ ccheck(carray);
+ icheck(iarray);
+ lcheck(larray);
+ fcheck(farray);
+ dcheck(darray);
+ rcheck(rarray);
+ ocheck(oarray);
+ mcheck(marray);
+ ncheck(narray);
+
+ //######################################################################
+
+ ucheck(id_Ta_T(uarray));
+ zcheck(id_Ta_T(zarray));
+ bcheck(id_Ta_T(barray));
+ scheck(id_Ta_T(sarray));
+ ccheck(id_Ta_T(carray));
+ icheck(id_Ta_T(iarray));
+ lcheck(id_Ta_T(larray));
+ fcheck(id_Ta_T(farray));
+ dcheck(id_Ta_T(darray));
+ rcheck(id_Ta_T(rarray));
+ ocheck(id_Ta_T(oarray));
+ mcheck(id_Ta_T(marray));
+ ncheck(id_Ta_T(narray));
+
+ ucheck(id_Tr_T(uarray));
+ zcheck(id_Tr_T(zarray));
+ bcheck(id_Tr_T(barray));
+ scheck(id_Tr_T(sarray));
+ ccheck(id_Tr_T(carray));
+ icheck(id_Tr_T(iarray));
+ lcheck(id_Tr_T(larray));
+ fcheck(id_Tr_T(farray));
+ dcheck(id_Tr_T(darray));
+ rcheck(id_Tr_T(rarray));
+ ocheck(id_Tr_T(oarray));
+ mcheck(id_Tr_T(marray));
+ ncheck(id_Tr_T(narray));
+
+ ucheck(id_To_T(uarray));
+ zcheck(id_To_T(zarray));
+ bcheck(id_To_T(barray));
+ scheck(id_To_T(sarray));
+ ccheck(id_To_T(carray));
+ icheck(id_To_T(iarray));
+ lcheck(id_To_T(larray));
+ fcheck(id_To_T(farray));
+ dcheck(id_To_T(darray));
+ rcheck(id_To_T(rarray));
+ ocheck(id_To_T(oarray));
+ mcheck(id_To_T(marray));
+ ncheck(id_To_T(narray));
+
+ ucheck(id_Ta_a(uarray).asInstanceOf[Array[Unit ]]);
+ zcheck(id_Ta_a(zarray).asInstanceOf[Array[Boolean]]);
+ bcheck(id_Ta_a(barray).asInstanceOf[Array[Byte ]]);
+ scheck(id_Ta_a(sarray).asInstanceOf[Array[Short ]]);
+ ccheck(id_Ta_a(carray).asInstanceOf[Array[Char ]]);
+ icheck(id_Ta_a(iarray).asInstanceOf[Array[Int ]]);
+ lcheck(id_Ta_a(larray).asInstanceOf[Array[Long ]]);
+ fcheck(id_Ta_a(farray).asInstanceOf[Array[Float ]]);
+ dcheck(id_Ta_a(darray).asInstanceOf[Array[Double ]]);
+ rcheck(id_Ta_a(rarray).asInstanceOf[Array[AnyRef ]]);
+ ocheck(id_Ta_a(oarray).asInstanceOf[Array[Object ]]);
+ mcheck(id_Ta_a(marray).asInstanceOf[Array[Map ]]);
+ ncheck(id_Ta_a(narray).asInstanceOf[Array[Strings]]);
+
+ ucheck(id_Tr_a(uarray).asInstanceOf[Array[Unit ]]);
+ zcheck(id_Tr_a(zarray).asInstanceOf[Array[Boolean]]);
+ bcheck(id_Tr_a(barray).asInstanceOf[Array[Byte ]]);
+ scheck(id_Tr_a(sarray).asInstanceOf[Array[Short ]]);
+ ccheck(id_Tr_a(carray).asInstanceOf[Array[Char ]]);
+ icheck(id_Tr_a(iarray).asInstanceOf[Array[Int ]]);
+ lcheck(id_Tr_a(larray).asInstanceOf[Array[Long ]]);
+ fcheck(id_Tr_a(farray).asInstanceOf[Array[Float ]]);
+ dcheck(id_Tr_a(darray).asInstanceOf[Array[Double ]]);
+ rcheck(id_Tr_a(rarray).asInstanceOf[Array[AnyRef ]]);
+ ocheck(id_Tr_a(oarray).asInstanceOf[Array[Object ]]);
+ mcheck(id_Tr_a(marray).asInstanceOf[Array[Map ]]);
+ ncheck(id_Tr_a(narray).asInstanceOf[Array[Strings]]);
+
+ ucheck(id_To_a(uarray).asInstanceOf[Array[Unit ]]);
+ zcheck(id_To_a(zarray).asInstanceOf[Array[Boolean]]);
+ bcheck(id_To_a(barray).asInstanceOf[Array[Byte ]]);
+ scheck(id_To_a(sarray).asInstanceOf[Array[Short ]]);
+ ccheck(id_To_a(carray).asInstanceOf[Array[Char ]]);
+ icheck(id_To_a(iarray).asInstanceOf[Array[Int ]]);
+ lcheck(id_To_a(larray).asInstanceOf[Array[Long ]]);
+ fcheck(id_To_a(farray).asInstanceOf[Array[Float ]]);
+ dcheck(id_To_a(darray).asInstanceOf[Array[Double ]]);
+ rcheck(id_To_a(rarray).asInstanceOf[Array[AnyRef ]]);
+ ocheck(id_To_a(oarray).asInstanceOf[Array[Object ]]);
+ mcheck(id_To_a(marray).asInstanceOf[Array[Map ]]);
+ ncheck(id_To_a(narray).asInstanceOf[Array[Strings]]);
+
+ ucheck(id_Tr_r(uarray).asInstanceOf[Array[Unit ]]);
+ zcheck(id_Tr_r(zarray).asInstanceOf[Array[Boolean]]);
+ bcheck(id_Tr_r(barray).asInstanceOf[Array[Byte ]]);
+ scheck(id_Tr_r(sarray).asInstanceOf[Array[Short ]]);
+ ccheck(id_Tr_r(carray).asInstanceOf[Array[Char ]]);
+ icheck(id_Tr_r(iarray).asInstanceOf[Array[Int ]]);
+ lcheck(id_Tr_r(larray).asInstanceOf[Array[Long ]]);
+ fcheck(id_Tr_r(farray).asInstanceOf[Array[Float ]]);
+ dcheck(id_Tr_r(darray).asInstanceOf[Array[Double ]]);
+ rcheck(id_Tr_r(rarray).asInstanceOf[Array[AnyRef ]]);
+ ocheck(id_Tr_r(oarray).asInstanceOf[Array[Object ]]);
+ mcheck(id_Tr_r(marray).asInstanceOf[Array[Map ]]);
+ ncheck(id_Tr_r(narray).asInstanceOf[Array[Strings]]);
+
+ ucheck(id_To_r(uarray).asInstanceOf[Array[Unit ]]);
+ zcheck(id_To_r(zarray).asInstanceOf[Array[Boolean]]);
+ bcheck(id_To_r(barray).asInstanceOf[Array[Byte ]]);
+ scheck(id_To_r(sarray).asInstanceOf[Array[Short ]]);
+ ccheck(id_To_r(carray).asInstanceOf[Array[Char ]]);
+ icheck(id_To_r(iarray).asInstanceOf[Array[Int ]]);
+ lcheck(id_To_r(larray).asInstanceOf[Array[Long ]]);
+ fcheck(id_To_r(farray).asInstanceOf[Array[Float ]]);
+ dcheck(id_To_r(darray).asInstanceOf[Array[Double ]]);
+ rcheck(id_To_r(rarray).asInstanceOf[Array[AnyRef ]]);
+ ocheck(id_To_r(oarray).asInstanceOf[Array[Object ]]);
+ mcheck(id_To_r(marray).asInstanceOf[Array[Map ]]);
+ ncheck(id_To_r(narray).asInstanceOf[Array[Strings]]);
+
+ ucheck(id_To_o(uarray).asInstanceOf[Array[Unit ]]);
+ zcheck(id_To_o(zarray).asInstanceOf[Array[Boolean]]);
+ bcheck(id_To_o(barray).asInstanceOf[Array[Byte ]]);
+ scheck(id_To_o(sarray).asInstanceOf[Array[Short ]]);
+ ccheck(id_To_o(carray).asInstanceOf[Array[Char ]]);
+ icheck(id_To_o(iarray).asInstanceOf[Array[Int ]]);
+ lcheck(id_To_o(larray).asInstanceOf[Array[Long ]]);
+ fcheck(id_To_o(farray).asInstanceOf[Array[Float ]]);
+ dcheck(id_To_o(darray).asInstanceOf[Array[Double ]]);
+ rcheck(id_To_o(rarray).asInstanceOf[Array[AnyRef ]]);
+ ocheck(id_To_o(oarray).asInstanceOf[Array[Object ]]);
+ mcheck(id_To_o(marray).asInstanceOf[Array[Map ]]);
+ ncheck(id_To_o(narray).asInstanceOf[Array[Strings]]);
+
+ //######################################################################
+
+ ucheck(id_TSa_T [Unit , Array[Unit ]](uarray));
+ zcheck(id_TSa_T [Boolean, Array[Boolean]](zarray));
+ bcheck(id_TSa_T [Byte , Array[Byte ]](barray));
+ scheck(id_TSa_T [Short , Array[Short ]](sarray));
+ ccheck(id_TSa_T [Char , Array[Char ]](carray));
+ icheck(id_TSa_T [Int , Array[Int ]](iarray));
+ lcheck(id_TSa_T [Long , Array[Long ]](larray));
+ fcheck(id_TSa_T [Float , Array[Float ]](farray));
+ dcheck(id_TSa_T [Double , Array[Double ]](darray));
+ rcheck(id_TSa_T [AnyRef , Array[AnyRef ]](rarray));
+ ocheck(id_TSa_T [Object , Array[Object ]](oarray));
+ mcheck(id_TSa_T [Map , Array[Map ]](marray));
+ ncheck(id_TSa_T [Strings, Array[Strings]](narray));
+
+ ucheck(id_TSv_T [Unit , Array[Unit ]](uarray));
+ zcheck(id_TSv_T [Boolean, Array[Boolean]](zarray));
+ bcheck(id_TSv_T [Byte , Array[Byte ]](barray));
+ scheck(id_TSv_T [Short , Array[Short ]](sarray));
+ ccheck(id_TSv_T [Char , Array[Char ]](carray));
+ icheck(id_TSv_T [Int , Array[Int ]](iarray));
+ lcheck(id_TSv_T [Long , Array[Long ]](larray));
+ fcheck(id_TSv_T [Float , Array[Float ]](farray));
+ dcheck(id_TSv_T [Double , Array[Double ]](darray));
+
+ rcheck(id_TSr_T [AnyRef , Array[AnyRef ]](rarray));
+ ocheck(id_TSr_T [Object , Array[Object ]](oarray));
+ mcheck(id_TSr_T [Map , Array[Map ]](marray));
+ ncheck(id_TSr_T [Strings, Array[Strings]](narray));
+
+ rcheck(id_TSo_T [AnyRef , Array[AnyRef ]](rarray));
+ ocheck(id_TSo_T [Object , Array[Object ]](oarray));
+ mcheck(id_TSo_T [Map , Array[Map ]](marray));
+ ncheck(id_TSo_T [Strings, Array[Strings]](narray));
+
+ mcheck(id_TSm_T [Map , Array[Map ]](marray));
+
+ ncheck(id_TSn_T [Strings, Array[Strings]](narray));
+
+ //######################################################################
+
+ ucheck(id_TSa_Ss[Unit , Array[Unit ]](uarray));
+ zcheck(id_TSa_Ss[Boolean, Array[Boolean]](zarray));
+ bcheck(id_TSa_Ss[Byte , Array[Byte ]](barray));
+ scheck(id_TSa_Ss[Short , Array[Short ]](sarray));
+ ccheck(id_TSa_Ss[Char , Array[Char ]](carray));
+ icheck(id_TSa_Ss[Int , Array[Int ]](iarray));
+ lcheck(id_TSa_Ss[Long , Array[Long ]](larray));
+ fcheck(id_TSa_Ss[Float , Array[Float ]](farray));
+ dcheck(id_TSa_Ss[Double , Array[Double ]](darray));
+ rcheck(id_TSa_Ss[AnyRef , Array[AnyRef ]](rarray));
+ ocheck(id_TSa_Ss[Object , Array[Object ]](oarray));
+ mcheck(id_TSa_Ss[Map , Array[Map ]](marray));
+ ncheck(id_TSa_Ss[Strings, Array[Strings]](narray));
+
+ ucheck(id_TSv_Ss[Unit , Array[Unit ]](uarray));
+ zcheck(id_TSv_Ss[Boolean, Array[Boolean]](zarray));
+ bcheck(id_TSv_Ss[Byte , Array[Byte ]](barray));
+ scheck(id_TSv_Ss[Short , Array[Short ]](sarray));
+ ccheck(id_TSv_Ss[Char , Array[Char ]](carray));
+ icheck(id_TSv_Ss[Int , Array[Int ]](iarray));
+ lcheck(id_TSv_Ss[Long , Array[Long ]](larray));
+ fcheck(id_TSv_Ss[Float , Array[Float ]](farray));
+ dcheck(id_TSv_Ss[Double , Array[Double ]](darray));
+
+ rcheck(id_TSr_Ss[AnyRef , Array[AnyRef ]](rarray));
+ ocheck(id_TSr_Ss[Object , Array[Object ]](oarray));
+ mcheck(id_TSr_Ss[Map , Array[Map ]](marray));
+ ncheck(id_TSr_Ss[Strings, Array[Strings]](narray));
+
+ rcheck(id_TSo_Ss[AnyRef , Array[AnyRef ]](rarray));
+ ocheck(id_TSo_Ss[Object , Array[Object ]](oarray));
+ mcheck(id_TSo_Ss[Map , Array[Map ]](marray));
+ ncheck(id_TSo_Ss[Strings, Array[Strings]](narray));
+
+ mcheck(id_TSm_Ss[Map , Array[Map ]](marray));
+
+ ncheck(id_TSn_Ss[Strings, Array[Strings]](narray));
+
+ //######################################################################
+
+ ucheck(id_TSa_a [Unit , Array[Unit ]](uarray).asInstanceOf[Array[Unit ]]);
+ zcheck(id_TSa_a [Boolean, Array[Boolean]](zarray).asInstanceOf[Array[Boolean]]);
+ bcheck(id_TSa_a [Byte , Array[Byte ]](barray).asInstanceOf[Array[Byte ]]);
+ scheck(id_TSa_a [Short , Array[Short ]](sarray).asInstanceOf[Array[Short ]]);
+ ccheck(id_TSa_a [Char , Array[Char ]](carray).asInstanceOf[Array[Char ]]);
+ icheck(id_TSa_a [Int , Array[Int ]](iarray).asInstanceOf[Array[Int ]]);
+ lcheck(id_TSa_a [Long , Array[Long ]](larray).asInstanceOf[Array[Long ]]);
+ fcheck(id_TSa_a [Float , Array[Float ]](farray).asInstanceOf[Array[Float ]]);
+ dcheck(id_TSa_a [Double , Array[Double ]](darray).asInstanceOf[Array[Double ]]);
+ rcheck(id_TSa_a [AnyRef , Array[AnyRef ]](rarray).asInstanceOf[Array[AnyRef ]]);
+ ocheck(id_TSa_a [Object , Array[Object ]](oarray).asInstanceOf[Array[Object ]]);
+ mcheck(id_TSa_a [Map , Array[Map ]](marray).asInstanceOf[Array[Map ]]);
+ ncheck(id_TSa_a [Strings, Array[Strings]](narray).asInstanceOf[Array[Strings]]);
+
+ ucheck(id_TSv_a [Unit , Array[Unit ]](uarray).asInstanceOf[Array[Unit ]]);
+ zcheck(id_TSv_a [Boolean, Array[Boolean]](zarray).asInstanceOf[Array[Boolean]]);
+ bcheck(id_TSv_a [Byte , Array[Byte ]](barray).asInstanceOf[Array[Byte ]]);
+ scheck(id_TSv_a [Short , Array[Short ]](sarray).asInstanceOf[Array[Short ]]);
+ ccheck(id_TSv_a [Char , Array[Char ]](carray).asInstanceOf[Array[Char ]]);
+ icheck(id_TSv_a [Int , Array[Int ]](iarray).asInstanceOf[Array[Int ]]);
+ lcheck(id_TSv_a [Long , Array[Long ]](larray).asInstanceOf[Array[Long ]]);
+ fcheck(id_TSv_a [Float , Array[Float ]](farray).asInstanceOf[Array[Float ]]);
+ dcheck(id_TSv_a [Double , Array[Double ]](darray).asInstanceOf[Array[Double ]]);
+
+ rcheck(id_TSr_a [AnyRef , Array[AnyRef ]](rarray).asInstanceOf[Array[AnyRef ]]);
+ ocheck(id_TSr_a [Object , Array[Object ]](oarray).asInstanceOf[Array[Object ]]);
+ mcheck(id_TSr_a [Map , Array[Map ]](marray).asInstanceOf[Array[Map ]]);
+ ncheck(id_TSr_a [Strings, Array[Strings]](narray).asInstanceOf[Array[Strings]]);
+
+ rcheck(id_TSo_a [AnyRef , Array[AnyRef ]](rarray).asInstanceOf[Array[AnyRef ]]);
+ ocheck(id_TSo_a [Object , Array[Object ]](oarray).asInstanceOf[Array[Object ]]);
+ mcheck(id_TSo_a [Map , Array[Map ]](marray).asInstanceOf[Array[Map ]]);
+ ncheck(id_TSo_a [Strings, Array[Strings]](narray).asInstanceOf[Array[Strings]]);
+
+ mcheck(id_TSm_a [Map , Array[Map ]](marray).asInstanceOf[Array[Map ]]);
+
+ ncheck(id_TSn_a [Strings, Array[Strings]](narray).asInstanceOf[Array[Strings]]);
+
+ //######################################################################
+
+ ucheck(id_TSa_r [Unit , Array[Unit ]](uarray).asInstanceOf[Array[Unit ]]);
+ zcheck(id_TSa_r [Boolean, Array[Boolean]](zarray).asInstanceOf[Array[Boolean]]);
+ bcheck(id_TSa_r [Byte , Array[Byte ]](barray).asInstanceOf[Array[Byte ]]);
+ scheck(id_TSa_r [Short , Array[Short ]](sarray).asInstanceOf[Array[Short ]]);
+ ccheck(id_TSa_r [Char , Array[Char ]](carray).asInstanceOf[Array[Char ]]);
+ icheck(id_TSa_r [Int , Array[Int ]](iarray).asInstanceOf[Array[Int ]]);
+ lcheck(id_TSa_r [Long , Array[Long ]](larray).asInstanceOf[Array[Long ]]);
+ fcheck(id_TSa_r [Float , Array[Float ]](farray).asInstanceOf[Array[Float ]]);
+ dcheck(id_TSa_r [Double , Array[Double ]](darray).asInstanceOf[Array[Double ]]);
+ rcheck(id_TSa_r [AnyRef , Array[AnyRef ]](rarray).asInstanceOf[Array[AnyRef ]]);
+ ocheck(id_TSa_r [Object , Array[Object ]](oarray).asInstanceOf[Array[Object ]]);
+ mcheck(id_TSa_r [Map , Array[Map ]](marray).asInstanceOf[Array[Map ]]);
+ ncheck(id_TSa_r [Strings, Array[Strings]](narray).asInstanceOf[Array[Strings]]);
+
+ ucheck(id_TSv_r [Unit , Array[Unit ]](uarray).asInstanceOf[Array[Unit ]]);
+ zcheck(id_TSv_r [Boolean, Array[Boolean]](zarray).asInstanceOf[Array[Boolean]]);
+ bcheck(id_TSv_r [Byte , Array[Byte ]](barray).asInstanceOf[Array[Byte ]]);
+ scheck(id_TSv_r [Short , Array[Short ]](sarray).asInstanceOf[Array[Short ]]);
+ ccheck(id_TSv_r [Char , Array[Char ]](carray).asInstanceOf[Array[Char ]]);
+ icheck(id_TSv_r [Int , Array[Int ]](iarray).asInstanceOf[Array[Int ]]);
+ lcheck(id_TSv_r [Long , Array[Long ]](larray).asInstanceOf[Array[Long ]]);
+ fcheck(id_TSv_r [Float , Array[Float ]](farray).asInstanceOf[Array[Float ]]);
+ dcheck(id_TSv_r [Double , Array[Double ]](darray).asInstanceOf[Array[Double ]]);
+
+ rcheck(id_TSr_r [AnyRef , Array[AnyRef ]](rarray).asInstanceOf[Array[AnyRef ]]);
+ ocheck(id_TSr_r [Object , Array[Object ]](oarray).asInstanceOf[Array[Object ]]);
+ mcheck(id_TSr_r [Map , Array[Map ]](marray).asInstanceOf[Array[Map ]]);
+ ncheck(id_TSr_r [Strings, Array[Strings]](narray).asInstanceOf[Array[Strings]]);
+
+ rcheck(id_TSo_r [AnyRef , Array[AnyRef ]](rarray).asInstanceOf[Array[AnyRef ]]);
+ ocheck(id_TSo_r [Object , Array[Object ]](oarray).asInstanceOf[Array[Object ]]);
+ mcheck(id_TSo_r [Map , Array[Map ]](marray).asInstanceOf[Array[Map ]]);
+ ncheck(id_TSo_r [Strings, Array[Strings]](narray).asInstanceOf[Array[Strings]]);
+
+ mcheck(id_TSm_r [Map , Array[Map ]](marray).asInstanceOf[Array[Map ]]);
+
+ ncheck(id_TSn_r [Strings, Array[Strings]](narray).asInstanceOf[Array[Strings]]);
+
+ //######################################################################
+
+ ucheck(id_TSa_o [Unit , Array[Unit ]](uarray).asInstanceOf[Array[Unit ]]);
+ zcheck(id_TSa_o [Boolean, Array[Boolean]](zarray).asInstanceOf[Array[Boolean]]);
+ bcheck(id_TSa_o [Byte , Array[Byte ]](barray).asInstanceOf[Array[Byte ]]);
+ scheck(id_TSa_o [Short , Array[Short ]](sarray).asInstanceOf[Array[Short ]]);
+ ccheck(id_TSa_o [Char , Array[Char ]](carray).asInstanceOf[Array[Char ]]);
+ icheck(id_TSa_o [Int , Array[Int ]](iarray).asInstanceOf[Array[Int ]]);
+ lcheck(id_TSa_o [Long , Array[Long ]](larray).asInstanceOf[Array[Long ]]);
+ fcheck(id_TSa_o [Float , Array[Float ]](farray).asInstanceOf[Array[Float ]]);
+ dcheck(id_TSa_o [Double , Array[Double ]](darray).asInstanceOf[Array[Double ]]);
+ rcheck(id_TSa_o [AnyRef , Array[AnyRef ]](rarray).asInstanceOf[Array[AnyRef ]]);
+ ocheck(id_TSa_o [Object , Array[Object ]](oarray).asInstanceOf[Array[Object ]]);
+ mcheck(id_TSa_o [Map , Array[Map ]](marray).asInstanceOf[Array[Map ]]);
+ ncheck(id_TSa_o [Strings, Array[Strings]](narray).asInstanceOf[Array[Strings]]);
+
+ ucheck(id_TSv_o [Unit , Array[Unit ]](uarray).asInstanceOf[Array[Unit ]]);
+ zcheck(id_TSv_o [Boolean, Array[Boolean]](zarray).asInstanceOf[Array[Boolean]]);
+ bcheck(id_TSv_o [Byte , Array[Byte ]](barray).asInstanceOf[Array[Byte ]]);
+ scheck(id_TSv_o [Short , Array[Short ]](sarray).asInstanceOf[Array[Short ]]);
+ ccheck(id_TSv_o [Char , Array[Char ]](carray).asInstanceOf[Array[Char ]]);
+ icheck(id_TSv_o [Int , Array[Int ]](iarray).asInstanceOf[Array[Int ]]);
+ lcheck(id_TSv_o [Long , Array[Long ]](larray).asInstanceOf[Array[Long ]]);
+ fcheck(id_TSv_o [Float , Array[Float ]](farray).asInstanceOf[Array[Float ]]);
+ dcheck(id_TSv_o [Double , Array[Double ]](darray).asInstanceOf[Array[Double ]]);
+
+ rcheck(id_TSr_o [AnyRef , Array[AnyRef ]](rarray).asInstanceOf[Array[AnyRef ]]);
+ ocheck(id_TSr_o [Object , Array[Object ]](oarray).asInstanceOf[Array[Object ]]);
+ mcheck(id_TSr_o [Map , Array[Map ]](marray).asInstanceOf[Array[Map ]]);
+ ncheck(id_TSr_o [Strings, Array[Strings]](narray).asInstanceOf[Array[Strings]]);
+
+ rcheck(id_TSo_o [AnyRef , Array[AnyRef ]](rarray).asInstanceOf[Array[AnyRef ]]);
+ ocheck(id_TSo_o [Object , Array[Object ]](oarray).asInstanceOf[Array[Object ]]);
+ mcheck(id_TSo_o [Map , Array[Map ]](marray).asInstanceOf[Array[Map ]]);
+ ncheck(id_TSo_o [Strings, Array[Strings]](narray).asInstanceOf[Array[Strings]]);
+
+ mcheck(id_TSm_o [Map , Array[Map ]](marray).asInstanceOf[Array[Map ]]);
+
+ ncheck(id_TSn_o [Strings, Array[Strings]](narray).asInstanceOf[Array[Strings]]);
+
+ //######################################################################
+
+ ucheck(id_Sas_Ss[Unit ](uarray));
+ zcheck(id_Sas_Ss[Boolean](zarray));
+ bcheck(id_Sas_Ss[Byte ](barray));
+ scheck(id_Sas_Ss[Short ](sarray));
+ ccheck(id_Sas_Ss[Char ](carray));
+ icheck(id_Sas_Ss[Int ](iarray));
+ lcheck(id_Sas_Ss[Long ](larray));
+ fcheck(id_Sas_Ss[Float ](farray));
+ dcheck(id_Sas_Ss[Double ](darray));
+ rcheck(id_Sas_Ss[AnyRef ](rarray));
+ ocheck(id_Sas_Ss[Object ](oarray));
+ mcheck(id_Sas_Ss[Map ](marray));
+ ncheck(id_Sas_Ss[Strings](narray));
+
+ ucheck(id_Svs_Ss[Unit ](uarray));
+ zcheck(id_Svs_Ss[Boolean](zarray));
+ bcheck(id_Svs_Ss[Byte ](barray));
+ scheck(id_Svs_Ss[Short ](sarray));
+ ccheck(id_Svs_Ss[Char ](carray));
+ icheck(id_Svs_Ss[Int ](iarray));
+ lcheck(id_Svs_Ss[Long ](larray));
+ fcheck(id_Svs_Ss[Float ](farray));
+ dcheck(id_Svs_Ss[Double ](darray));
+
+ rcheck(id_Srs_Ss[AnyRef ](rarray));
+ ocheck(id_Srs_Ss[Object ](oarray));
+ mcheck(id_Srs_Ss[Map ](marray));
+ ncheck(id_Srs_Ss[Strings](narray));
+
+ rcheck(id_Sos_Ss[AnyRef ](rarray));
+ ocheck(id_Sos_Ss[Object ](oarray));
+ mcheck(id_Sos_Ss[Map ](marray));
+ ncheck(id_Sos_Ss[Strings](narray));
+
+ mcheck(id_Sms_Ss[Map ](marray));
+
+ ncheck(id_Sns_Ss[Strings](narray));
+
+ //######################################################################
+
+ ucheck(id_TSa_a [Unit , Array[Unit ]](uarray).asInstanceOf[Array[Unit ]]);
+ zcheck(id_TSa_a [Boolean, Array[Boolean]](zarray).asInstanceOf[Array[Boolean]]);
+ bcheck(id_TSa_a [Byte , Array[Byte ]](barray).asInstanceOf[Array[Byte ]]);
+ scheck(id_TSa_a [Short , Array[Short ]](sarray).asInstanceOf[Array[Short ]]);
+ ccheck(id_TSa_a [Char , Array[Char ]](carray).asInstanceOf[Array[Char ]]);
+ icheck(id_TSa_a [Int , Array[Int ]](iarray).asInstanceOf[Array[Int ]]);
+ lcheck(id_TSa_a [Long , Array[Long ]](larray).asInstanceOf[Array[Long ]]);
+ fcheck(id_TSa_a [Float , Array[Float ]](farray).asInstanceOf[Array[Float ]]);
+ dcheck(id_TSa_a [Double , Array[Double ]](darray).asInstanceOf[Array[Double ]]);
+ rcheck(id_TSa_a [AnyRef , Array[AnyRef ]](rarray).asInstanceOf[Array[AnyRef ]]);
+ ocheck(id_TSa_a [Object , Array[Object ]](oarray).asInstanceOf[Array[Object ]]);
+ mcheck(id_TSa_a [Map , Array[Map ]](marray).asInstanceOf[Array[Map ]]);
+ ncheck(id_TSa_a [Strings, Array[Strings]](narray).asInstanceOf[Array[Strings]]);
+
+ ucheck(id_TSv_a [Unit , Array[Unit ]](uarray).asInstanceOf[Array[Unit ]]);
+ zcheck(id_TSv_a [Boolean, Array[Boolean]](zarray).asInstanceOf[Array[Boolean]]);
+ bcheck(id_TSv_a [Byte , Array[Byte ]](barray).asInstanceOf[Array[Byte ]]);
+ scheck(id_TSv_a [Short , Array[Short ]](sarray).asInstanceOf[Array[Short ]]);
+ ccheck(id_TSv_a [Char , Array[Char ]](carray).asInstanceOf[Array[Char ]]);
+ icheck(id_TSv_a [Int , Array[Int ]](iarray).asInstanceOf[Array[Int ]]);
+ lcheck(id_TSv_a [Long , Array[Long ]](larray).asInstanceOf[Array[Long ]]);
+ fcheck(id_TSv_a [Float , Array[Float ]](farray).asInstanceOf[Array[Float ]]);
+ dcheck(id_TSv_a [Double , Array[Double ]](darray).asInstanceOf[Array[Double ]]);
+
+ rcheck(id_TSr_a [AnyRef , Array[AnyRef ]](rarray).asInstanceOf[Array[AnyRef ]]);
+ ocheck(id_TSr_a [Object , Array[Object ]](oarray).asInstanceOf[Array[Object ]]);
+ mcheck(id_TSr_a [Map , Array[Map ]](marray).asInstanceOf[Array[Map ]]);
+ ncheck(id_TSr_a [Strings, Array[Strings]](narray).asInstanceOf[Array[Strings]]);
+
+ rcheck(id_TSo_a [AnyRef , Array[AnyRef ]](rarray).asInstanceOf[Array[AnyRef ]]);
+ ocheck(id_TSo_a [Object , Array[Object ]](oarray).asInstanceOf[Array[Object ]]);
+ mcheck(id_TSo_a [Map , Array[Map ]](marray).asInstanceOf[Array[Map ]]);
+ ncheck(id_TSo_a [Strings, Array[Strings]](narray).asInstanceOf[Array[Strings]]);
+
+ mcheck(id_TSm_a [Map , Array[Map ]](marray).asInstanceOf[Array[Map ]]);
+
+ ncheck(id_TSn_a [Strings, Array[Strings]](narray).asInstanceOf[Array[Strings]]);
+
+ //######################################################################
+
+ ucheck(id_TSa_r [Unit , Array[Unit ]](uarray).asInstanceOf[Array[Unit ]]);
+ zcheck(id_TSa_r [Boolean, Array[Boolean]](zarray).asInstanceOf[Array[Boolean]]);
+ bcheck(id_TSa_r [Byte , Array[Byte ]](barray).asInstanceOf[Array[Byte ]]);
+ scheck(id_TSa_r [Short , Array[Short ]](sarray).asInstanceOf[Array[Short ]]);
+ ccheck(id_TSa_r [Char , Array[Char ]](carray).asInstanceOf[Array[Char ]]);
+ icheck(id_TSa_r [Int , Array[Int ]](iarray).asInstanceOf[Array[Int ]]);
+ lcheck(id_TSa_r [Long , Array[Long ]](larray).asInstanceOf[Array[Long ]]);
+ fcheck(id_TSa_r [Float , Array[Float ]](farray).asInstanceOf[Array[Float ]]);
+ dcheck(id_TSa_r [Double , Array[Double ]](darray).asInstanceOf[Array[Double ]]);
+ rcheck(id_TSa_r [AnyRef , Array[AnyRef ]](rarray).asInstanceOf[Array[AnyRef ]]);
+ ocheck(id_TSa_r [Object , Array[Object ]](oarray).asInstanceOf[Array[Object ]]);
+ mcheck(id_TSa_r [Map , Array[Map ]](marray).asInstanceOf[Array[Map ]]);
+ ncheck(id_TSa_r [Strings, Array[Strings]](narray).asInstanceOf[Array[Strings]]);
+
+ ucheck(id_TSv_r [Unit , Array[Unit ]](uarray).asInstanceOf[Array[Unit ]]);
+ zcheck(id_TSv_r [Boolean, Array[Boolean]](zarray).asInstanceOf[Array[Boolean]]);
+ bcheck(id_TSv_r [Byte , Array[Byte ]](barray).asInstanceOf[Array[Byte ]]);
+ scheck(id_TSv_r [Short , Array[Short ]](sarray).asInstanceOf[Array[Short ]]);
+ ccheck(id_TSv_r [Char , Array[Char ]](carray).asInstanceOf[Array[Char ]]);
+ icheck(id_TSv_r [Int , Array[Int ]](iarray).asInstanceOf[Array[Int ]]);
+ lcheck(id_TSv_r [Long , Array[Long ]](larray).asInstanceOf[Array[Long ]]);
+ fcheck(id_TSv_r [Float , Array[Float ]](farray).asInstanceOf[Array[Float ]]);
+ dcheck(id_TSv_r [Double , Array[Double ]](darray).asInstanceOf[Array[Double ]]);
+
+ rcheck(id_TSr_r [AnyRef , Array[AnyRef ]](rarray).asInstanceOf[Array[AnyRef ]]);
+ ocheck(id_TSr_r [Object , Array[Object ]](oarray).asInstanceOf[Array[Object ]]);
+ mcheck(id_TSr_r [Map , Array[Map ]](marray).asInstanceOf[Array[Map ]]);
+ ncheck(id_TSr_r [Strings, Array[Strings]](narray).asInstanceOf[Array[Strings]]);
+
+ rcheck(id_TSo_r [AnyRef , Array[AnyRef ]](rarray).asInstanceOf[Array[AnyRef ]]);
+ ocheck(id_TSo_r [Object , Array[Object ]](oarray).asInstanceOf[Array[Object ]]);
+ mcheck(id_TSo_r [Map , Array[Map ]](marray).asInstanceOf[Array[Map ]]);
+ ncheck(id_TSo_r [Strings, Array[Strings]](narray).asInstanceOf[Array[Strings]]);
+
+ mcheck(id_TSm_r [Map , Array[Map ]](marray).asInstanceOf[Array[Map ]]);
+
+ ncheck(id_TSn_r [Strings, Array[Strings]](narray).asInstanceOf[Array[Strings]]);
+
+ //######################################################################
+
+ ucheck(id_TSa_o [Unit , Array[Unit ]](uarray).asInstanceOf[Array[Unit ]]);
+ zcheck(id_TSa_o [Boolean, Array[Boolean]](zarray).asInstanceOf[Array[Boolean]]);
+ bcheck(id_TSa_o [Byte , Array[Byte ]](barray).asInstanceOf[Array[Byte ]]);
+ scheck(id_TSa_o [Short , Array[Short ]](sarray).asInstanceOf[Array[Short ]]);
+ ccheck(id_TSa_o [Char , Array[Char ]](carray).asInstanceOf[Array[Char ]]);
+ icheck(id_TSa_o [Int , Array[Int ]](iarray).asInstanceOf[Array[Int ]]);
+ lcheck(id_TSa_o [Long , Array[Long ]](larray).asInstanceOf[Array[Long ]]);
+ fcheck(id_TSa_o [Float , Array[Float ]](farray).asInstanceOf[Array[Float ]]);
+ dcheck(id_TSa_o [Double , Array[Double ]](darray).asInstanceOf[Array[Double ]]);
+ rcheck(id_TSa_o [AnyRef , Array[AnyRef ]](rarray).asInstanceOf[Array[AnyRef ]]);
+ ocheck(id_TSa_o [Object , Array[Object ]](oarray).asInstanceOf[Array[Object ]]);
+ mcheck(id_TSa_o [Map , Array[Map ]](marray).asInstanceOf[Array[Map ]]);
+ ncheck(id_TSa_o [Strings, Array[Strings]](narray).asInstanceOf[Array[Strings]]);
+
+ ucheck(id_TSv_o [Unit , Array[Unit ]](uarray).asInstanceOf[Array[Unit ]]);
+ zcheck(id_TSv_o [Boolean, Array[Boolean]](zarray).asInstanceOf[Array[Boolean]]);
+ bcheck(id_TSv_o [Byte , Array[Byte ]](barray).asInstanceOf[Array[Byte ]]);
+ scheck(id_TSv_o [Short , Array[Short ]](sarray).asInstanceOf[Array[Short ]]);
+ ccheck(id_TSv_o [Char , Array[Char ]](carray).asInstanceOf[Array[Char ]]);
+ icheck(id_TSv_o [Int , Array[Int ]](iarray).asInstanceOf[Array[Int ]]);
+ lcheck(id_TSv_o [Long , Array[Long ]](larray).asInstanceOf[Array[Long ]]);
+ fcheck(id_TSv_o [Float , Array[Float ]](farray).asInstanceOf[Array[Float ]]);
+ dcheck(id_TSv_o [Double , Array[Double ]](darray).asInstanceOf[Array[Double ]]);
+
+ rcheck(id_TSr_o [AnyRef , Array[AnyRef ]](rarray).asInstanceOf[Array[AnyRef ]]);
+ ocheck(id_TSr_o [Object , Array[Object ]](oarray).asInstanceOf[Array[Object ]]);
+ mcheck(id_TSr_o [Map , Array[Map ]](marray).asInstanceOf[Array[Map ]]);
+ ncheck(id_TSr_o [Strings, Array[Strings]](narray).asInstanceOf[Array[Strings]]);
+
+ rcheck(id_TSo_o [AnyRef , Array[AnyRef ]](rarray).asInstanceOf[Array[AnyRef ]]);
+ ocheck(id_TSo_o [Object , Array[Object ]](oarray).asInstanceOf[Array[Object ]]);
+ mcheck(id_TSo_o [Map , Array[Map ]](marray).asInstanceOf[Array[Map ]]);
+ ncheck(id_TSo_o [Strings, Array[Strings]](narray).asInstanceOf[Array[Strings]]);
+
+ mcheck(id_TSm_o [Map , Array[Map ]](marray).asInstanceOf[Array[Map ]]);
+
+ ncheck(id_TSn_o [Strings, Array[Strings]](narray).asInstanceOf[Array[Strings]]);
+
+ //######################################################################
+
+ check_Ta(uarray, 2, u0, ucheck)
+ check_Ta(zarray, 2, z0, zcheck)
+ check_Ta(barray, 3, b0, bcheck)
+ check_Ta(sarray, 3, s0, scheck)
+ check_Ta(carray, 3, c0, ccheck)
+ check_Ta(iarray, 3, i0, icheck)
+ check_Ta(larray, 3, l0, lcheck)
+ check_Ta(farray, 3, f0, fcheck)
+ check_Ta(darray, 3, d0, dcheck)
+ check_Ta(rarray, 6, r0, rcheck)
+ check_Ta(oarray, 6, o0, ocheck)
+ check_Ta(marray, 3, m0, mcheck)
+ check_Ta(narray, 3, n0, ncheck)
+
+ check_Tv(uarray, 2, u0, ucheck)
+ check_Tv(zarray, 2, z0, zcheck)
+ check_Tv(barray, 3, b0, bcheck)
+ check_Tv(sarray, 3, s0, scheck)
+ check_Tv(carray, 3, c0, ccheck)
+ check_Tv(iarray, 3, i0, icheck)
+ check_Tv(larray, 3, l0, lcheck)
+ check_Tv(farray, 3, f0, fcheck)
+ check_Tv(darray, 3, d0, dcheck)
+
+ check_Tr(rarray, 6, r0, rcheck)
+ check_Tr(oarray, 6, o0, ocheck)
+ check_Tr(marray, 3, m0, mcheck)
+ check_Tr(narray, 3, n0, ncheck)
+
+ check_To(rarray, 6, r0, rcheck)
+ check_To(oarray, 6, o0, ocheck)
+ check_To(marray, 3, m0, mcheck)
+ check_To(narray, 3, n0, ncheck)
+
+ check_Tm(marray, 3, m0, mcheck)
+
+ check_Tn(narray, 3, n0, ncheck)
+
+ //######################################################################
+
+ checkZip
+ checkConcat
+ checkT2368()
+
+ //######################################################################
+
+ println("checks: " + checks)
+
+ //######################################################################
+ }
+
+ //##########################################################################
+}
+
diff --git a/tests/run/classof.check b/tests/run/classof.check
new file mode 100644
index 000000000..9476c014d
--- /dev/null
+++ b/tests/run/classof.check
@@ -0,0 +1,23 @@
+Value types:
+void
+boolean
+byte
+short
+char
+int
+long
+float
+double
+Class types
+class SomeClass
+class ValueClass
+class scala.collection.immutable.List
+class scala.Tuple2
+Arrays:
+class [Lscala.runtime.BoxedUnit;
+class [I
+class [D
+class [Lscala.collection.immutable.List;
+Functions:
+interface scala.Function2
+interface scala.Function1
diff --git a/tests/run/classof.scala b/tests/run/classof.scala
new file mode 100644
index 000000000..bdbcef4a1
--- /dev/null
+++ b/tests/run/classof.scala
@@ -0,0 +1,37 @@
+class ValueClass(val i: Integer) extends AnyVal
+class SomeClass
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val cls: Predef.Class[SomeClass] = classOf[SomeClass]
+ val valCls: Predef.Class[ValueClass] = classOf[ValueClass]
+ val iCls: Class[Int] = classOf[Int]
+
+ println("Value types:")
+ println(classOf[Unit])
+ println(classOf[Boolean])
+ println(classOf[Byte])
+ println(classOf[Short])
+ println(classOf[Char])
+ println(classOf[Int])
+ println(classOf[Long])
+ println(classOf[Float])
+ println(classOf[Double])
+
+ println("Class types")
+ println(classOf[SomeClass])
+ println(classOf[ValueClass])
+ println(classOf[List[Array[Float]]])
+ println(classOf[(String, Map[Int, String])])
+
+ println("Arrays:")
+ println(classOf[Array[Unit]])
+ println(classOf[Array[Int]])
+ println(classOf[Array[Double]])
+ println(classOf[Array[List[String]]])
+
+ println("Functions:")
+ println(classOf[(Int, Int) => Unit])
+ println(classOf[Int => Boolean])
+ }
+}
diff --git a/tests/run/classtags_contextbound.check b/tests/run/classtags_contextbound.check
new file mode 100644
index 000000000..604122846
--- /dev/null
+++ b/tests/run/classtags_contextbound.check
@@ -0,0 +1 @@
+class [I
diff --git a/tests/run/classtags_contextbound.scala b/tests/run/classtags_contextbound.scala
new file mode 100644
index 000000000..1edce82a2
--- /dev/null
+++ b/tests/run/classtags_contextbound.scala
@@ -0,0 +1,7 @@
+import scala.reflect.{ClassTag, classTag}
+
+object Test extends dotty.runtime.LegacyApp {
+ def mkArray[T: ClassTag] = Array[T]()
+ def foo[T: ClassTag] = mkArray[T]
+ println(foo[Int].getClass)
+}
diff --git a/tests/run/collection-stacks.check b/tests/run/collection-stacks.check
new file mode 100644
index 000000000..aa25cd1fa
--- /dev/null
+++ b/tests/run/collection-stacks.check
@@ -0,0 +1,14 @@
+3-2-1: true
+3-2-1: true
+apply
+3: true
+3: true
+1: true
+1: true
+top
+3: true
+3: true
+pop
+2-1: true
+3: true
+2-1: true
diff --git a/tests/run/collection-stacks.scala b/tests/run/collection-stacks.scala
new file mode 100644
index 000000000..a41bef37c
--- /dev/null
+++ b/tests/run/collection-stacks.scala
@@ -0,0 +1,38 @@
+import scala.collection.{ immutable, mutable }
+
+object Test extends dotty.runtime.LegacyApp {
+ def mutableStack[T](xs: T*): mutable.Stack[T] = {
+ val s = new mutable.Stack[T]
+ s.pushAll(xs)
+ s
+ }
+
+ def immutableStack[T](xs: T*): immutable.Stack[T] = {
+ immutable.Stack.empty[T] pushAll xs
+ }
+
+ def check[T](expected: T, got: T): Unit = {
+ println(got + ": " + (expected == got))
+ }
+
+ // check #957
+ check("3-2-1", immutableStack(1, 2, 3).iterator.mkString("-"))
+ check("3-2-1", mutableStack(1, 2, 3).iterator.mkString("-"))
+
+ println("apply")
+ check(3, immutableStack(1, 2, 3).apply(0))
+ check(3, mutableStack(1, 2, 3).apply(0))
+ check(1, immutableStack(1, 2, 3).apply(2))
+ check(1, mutableStack(1, 2, 3).apply(2))
+
+ println("top")
+ check(3, immutableStack(1, 2, 3).top)
+ check(3, mutableStack(1, 2, 3).top)
+
+ println("pop")
+ check("2-1", immutableStack(1, 2, 3).pop.mkString("-"))
+ check(3, mutableStack(1, 2, 3).pop())
+ check("2-1", { val s = mutableStack(1, 2, 3); s.pop(); s.toList.mkString("-") })
+}
+
+// vim: set ts=2 sw=2 et:
diff --git a/tests/run/collections.check b/tests/run/collections.check
new file mode 100644
index 000000000..c24150b24
--- /dev/null
+++ b/tests/run/collections.check
@@ -0,0 +1,42 @@
+***** mutable.HashSet:
+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
+test3: 25005003
+***** immutable.ListSet:
+test1: 14005
+test2: 25005003, iters = 5000
+test3: 25005003
+***** immutable.TreeSet:
+test1: 14005
+test2: 25005003, iters = 5000
+test3: 25005003
+***** mutable.HashMap:
+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
+test3: 25005003
+test4: 25005003
+***** immutable.TreeMap:
+test1: 14005
+test2: 25005003, iters = 5000
+test3: 25005003
+test4: 25005003
+***** immutable.ListMap:
+test1: 14005
+test2: 9007003, iters = 3000
+test3: 9007003
diff --git a/tests/run/collections.scala b/tests/run/collections.scala
new file mode 100644
index 000000000..acc2d93ff
--- /dev/null
+++ b/tests/run/collections.scala
@@ -0,0 +1,119 @@
+import scala.collection._
+import scala.compat.Platform.currentTime
+import scala.language.postfixOps
+
+object Test extends dotty.runtime.LegacyApp {
+
+ val printTime = false
+
+ def sum[A](xs: Iterable[Int]) = (0 /: xs)((x, y) => x + y)
+
+ def time(op: => Unit): Unit = {
+ val start = currentTime
+ op
+ if (printTime) println(" time = "+(currentTime - start)+"ms")
+ }
+
+ def test(msg: String, s0: collection.immutable.Set[Int], iters: Int) = {
+ println("***** "+msg+":")
+ var s = s0
+ s = s + 2
+ s = s + (3, 4000, 10000)
+ println("test1: "+sum(s))
+ time {
+ s = s ++ (List.range(0, iters) map (2*))
+ println("test2: "+sum(s)+", iters = "+iters)
+ }
+ time {
+ var x = 0
+ for (i <- 0 to 10000)
+ if (s contains i) x += i
+ println("test3: "+x)
+ }
+ }
+
+ def test(msg: String, s0: collection.mutable.Set[Int], iters: Int) = {
+ println("***** "+msg+":")
+ var s = s0
+ s = s + 2
+ s = s + (3, 4000, 10000)
+ println("test1: "+sum(s))
+ time {
+ s = s ++ (List.range(0, iters) map (2*))
+ println("test2: "+sum(s)+", iters = "+iters)
+ }
+ time {
+ var x = 0
+ for (i <- 0 to 10000)
+ if (s contains i) x += i
+ println("test3: "+x)
+ }
+ }
+
+ def test(msg: String, s0: collection.immutable.Map[Int, Int], iters: Int) = {
+ println("***** "+msg+":")
+ var s = s0
+ s = s + (2 -> 2)
+ s = s + (3 -> 3, 4000 -> 4000, 10000 -> 10000)
+ println("test1: "+sum(s map (_._2)))
+ time {
+ s = s ++ (List.range(0, iters) map (x => x * 2 -> x * 2))
+ println("test2: "+sum(s map (_._2))+", iters = "+iters)
+ }
+ time {
+ var x = 0
+ for (i <- 0 to 10000)
+ s get i match {
+ case Some(i) => x += i
+ case None =>
+ }
+ println("test3: "+x)
+ }
+ if (iters == 5000) {
+ time {
+ var s1 = s
+ var x = 0
+ for (i <- 0 to 10000) {
+ s get i match {
+ case Some(i) => x += i
+ case None =>
+ }
+ s1 = s1 + ((i + 10000) -> i)
+ }
+ println("test4: "+x)
+ }
+ }
+ }
+
+ def test(msg: String, s0: collection.mutable.Map[Int, Int], iters: Int) = {
+ println("***** "+msg+":")
+ var s = s0
+ s = s + (2 -> 2)
+ s = s + (3 -> 3, 4000 -> 4000, 10000 -> 10000)
+ println("test1: "+sum(s map (_._2)))
+ time {
+ s = s ++ (List.range(0, iters) map (x => x * 2 -> x * 2))
+ println("test2: "+sum(s map (_._2))+", iters = "+iters)
+ }
+ time {
+ var x = 0
+ for (i <- 0 to 10000)
+ s get i match {
+ case Some(i) => x += i
+ case None =>
+ }
+ println("test3: "+x)
+ }
+ }
+
+ 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/tests/run/constructors.check b/tests/run/constructors.check
new file mode 100644
index 000000000..0743b7e29
--- /dev/null
+++ b/tests/run/constructors.check
@@ -0,0 +1,5 @@
+x=1 y=2
+x=3 y=3
+x=1 y=1
+x=1 y=2 a=1 b=2 c=a
+x=3 y=3 a=3 b=3 c=b
diff --git a/tests/run/constructors.scala b/tests/run/constructors.scala
new file mode 100644
index 000000000..19afc3d67
--- /dev/null
+++ b/tests/run/constructors.scala
@@ -0,0 +1,28 @@
+// Test constructors, including multiple ones.
+
+class A(x: Int, y: Int) {
+ def this(x: Int) = this(x, x);
+ def this() = this(1);
+ override def toString() = "x=" + x + " y=" + y;
+ class B(val a: Int, b: Int, c: String) {
+ def this(str: String) = this(x, y, str);
+ val xx = a
+ override def toString() =
+ "x=" + x + " y=" + y + " a=" + a + " b=" + b + " c=" + c;
+ }
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val a1 = new A(1,2);
+ val a2 = new A(3);
+ val a3 = new A();
+ val b1 = new a1.B(1,2,"a");
+ val b2 = new a2.B("b");
+ Console.println(a1);
+ Console.println(a2);
+ Console.println(a3);
+ Console.println(b1);
+ Console.println(b2);
+ }
+}
diff --git a/tests/run/contrib674.check b/tests/run/contrib674.check
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/run/contrib674.check
diff --git a/tests/run/contrib674.scala b/tests/run/contrib674.scala
new file mode 100644
index 000000000..fe7ebcccd
--- /dev/null
+++ b/tests/run/contrib674.scala
@@ -0,0 +1,19 @@
+// causes VerifyError with scala-2.5.1
+
+object Test extends dotty.runtime.LegacyApp {
+ def bad(): Unit = {
+ try {
+ 1
+ } catch {
+ case e: Throwable =>
+ } finally {
+ try {
+ } catch {
+ case e: Throwable =>
+ }
+ }
+ 1
+ }
+
+ bad
+}
diff --git a/tests/run/emptypf.check b/tests/run/emptypf.check
new file mode 100644
index 000000000..f6c39921b
--- /dev/null
+++ b/tests/run/emptypf.check
@@ -0,0 +1,3 @@
+100
+3
+false
diff --git a/tests/run/emptypf.scala b/tests/run/emptypf.scala
new file mode 100644
index 000000000..eb3e3e638
--- /dev/null
+++ b/tests/run/emptypf.scala
@@ -0,0 +1,14 @@
+object Test {
+ val f: PartialFunction[String, Int] = {
+ PartialFunction.empty[String, Int] orElse {
+ case "abc" => 100
+ case s => s.length
+ }
+ }
+
+ def main(args: Array[String]): Unit = {
+ println(f("abc"))
+ println(f("def"))
+ println(PartialFunction.empty[String, Int] isDefinedAt "abc")
+ }
+}
diff --git a/tests/run/hashCodeBoxesRunTime.scala b/tests/run/hashCodeBoxesRunTime.scala
new file mode 100644
index 000000000..ba1a30f5f
--- /dev/null
+++ b/tests/run/hashCodeBoxesRunTime.scala
@@ -0,0 +1,28 @@
+// This only tests direct access to the methods in BoxesRunTime,
+// not the whole scheme.
+object Test
+{
+ import java.{ lang => jl }
+ import scala.runtime.BoxesRunTime.{ hashFromNumber, hashFromObject }
+
+ def allSame[T](xs: List[T]) = assert(xs.distinct.size == 1, "failed: " + xs)
+
+ def mkNumbers(x: Int): List[Number] =
+ List(x.toByte, x.toShort, x, x.toLong, x.toFloat, x.toDouble)
+
+ def testLDF(x: Long) = allSame(List[Number](x, x.toDouble, x.toFloat) map hashFromNumber)
+
+ def main(args: Array[String]): Unit = {
+ List(Byte.MinValue, -1, 0, 1, Byte.MaxValue) foreach { n =>
+ val hashes = mkNumbers(n) map hashFromNumber
+ allSame(hashes)
+ if (n >= 0) {
+ val charCode = hashFromObject(n.toChar: Character)
+ assert(charCode == hashes.head)
+ }
+ }
+
+ testLDF(Short.MaxValue.toLong)
+ testLDF(Short.MinValue.toLong)
+ }
+}
diff --git a/tests/run/i659.scala b/tests/run/i659.scala
new file mode 100644
index 000000000..d1229515d
--- /dev/null
+++ b/tests/run/i659.scala
@@ -0,0 +1,26 @@
+class Foo(val a: Int) {
+ def foo = { {case x => x + a}: PartialFunction[Int, Int]}
+ class Bar { def result(x: Int) = x + a }
+ def bar = new Bar
+}
+
+class VFoo(val a: Int) extends AnyVal {
+ def foo = { {case x => x + a}: PartialFunction[Int, Int]}
+}
+
+object Test extends dotty.runtime.LegacyApp {
+
+ def Foo(a: Int) = {
+ class Bar { def result(x: Int) = x + a }
+ new Bar().result(2)
+ }
+
+ val x1 = new Foo(1).bar.result(2)
+ assert(x1 == 3, s"x1 = $x1")
+ val x2 = Foo(1)
+ assert(x2 == 3, s"x2 = $x2")
+ val x3 = new Foo(1).foo.apply(2)
+ assert(x3 == 3, s"x3 = $x3")
+ val x4 = new VFoo(1).foo.apply(2)
+ assert(x4 == 3, s"x4 = $x4")
+}
diff --git a/tests/run/lazy-exprs.check b/tests/run/lazy-exprs.check
new file mode 100644
index 000000000..e77d20425
--- /dev/null
+++ b/tests/run/lazy-exprs.check
@@ -0,0 +1,13 @@
+forced <z1>
+lazy val in scrutinee: ok
+forced <z1>
+lazy val in case: ok
+lazy val in case: forced <z1>
+ok
+lazy val in if condition: forced <z1>
+ok
+lazy val in pattern: forced LazyField
+ok
+lazy val with patterns:
+x and y: xy(x, y)
+x1 and y1: x1y1(x1, y1)
diff --git a/tests/run/lazy-exprs.scala b/tests/run/lazy-exprs.scala
new file mode 100644
index 000000000..3ba6b46ab
--- /dev/null
+++ b/tests/run/lazy-exprs.scala
@@ -0,0 +1,95 @@
+object TestExpressions {
+
+ def patmatchScrut: Unit = {
+ lazy val z1: Option[String] = { println("forced <z1>"); Some("lazy z1") }
+
+ val res = z1 match {
+ case Some(msg) => msg
+ case None => "failed"
+ }
+ print("lazy val in scrutinee: ")
+ if (res == "lazy z1")
+ println("ok")
+ else
+ println("failed")
+ }
+
+ def patmatchCase: Unit = {
+ val t: Option[String] = Some("test")
+ val res = t match {
+ case Some(msg) =>
+ lazy val z1 = { println("forced <z1>"); "lazy z1" }
+ z1
+
+ case None => "failed"
+ }
+ print("lazy val in case: ")
+ if (res == "lazy z1")
+ println("ok")
+ else
+ println("failed")
+ }
+
+
+ def patmatchPat: Unit = {
+ lazy val Z1 = { println("forced <z1>"); "lazy Z1" }
+ print("lazy val in case: ")
+ val t: Option[String] = Some("lazy Z1")
+ t match {
+ case Some(Z1) =>
+ println("ok")
+
+ case None =>
+ println("failed")
+ }
+ }
+
+ def ifcond: Unit = {
+ lazy val z1 = { println("forced <z1>"); "lazy z1" }
+ print("lazy val in if condition: ")
+ if (z1 == "lazy z1")
+ println("ok")
+ else
+ println("failed")
+ }
+
+
+ lazy val LazyField = { println("forced LazyField"); "LazyField" }
+
+ def testPatMatchField: Unit = {
+ print("lazy val in pattern: ")
+ val t: Option[String] = Some("LazyField")
+ t match {
+ case Some(LazyField) =>
+ println("ok")
+
+ case None =>
+ println("failed")
+ }
+ }
+
+ lazy val (x, y) = ({print("x"); "x"}, {print("y"); "y"})
+ def testPatLazyVal: Unit = {
+ println("lazy val with patterns:")
+ print("x and y: ")
+ println("(" + x + ", " + y + ")")
+ lazy val (x1, y1) = ({print("x1"); "x1"}, {print("y1"); "y1"})
+ print("x1 and y1: ")
+ println("(" + x1 + ", " + y1 + ")")
+ }
+
+ def test: Unit = {
+ patmatchScrut
+ patmatchCase
+ patmatchPat
+ ifcond
+ testPatMatchField
+ testPatLazyVal
+ }
+}
+
+
+object Test extends dotty.runtime.LegacyApp {
+
+ TestExpressions.test
+}
diff --git a/tests/run/nothingTypeNoFramesNoDce.check b/tests/run/nothingTypeNoFramesNoDce.check
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/run/nothingTypeNoFramesNoDce.check
diff --git a/tests/run/nothingTypeNoFramesNoDce.flags b/tests/run/nothingTypeNoFramesNoDce.flags
new file mode 100644
index 000000000..a035c8617
--- /dev/null
+++ b/tests/run/nothingTypeNoFramesNoDce.flags
@@ -0,0 +1 @@
+-target:jvm-1.5 -Ybackend:GenBCode -Yopt:l:none -deprecation
diff --git a/tests/run/nothingTypeNoFramesNoDce.scala b/tests/run/nothingTypeNoFramesNoDce.scala
new file mode 100644
index 000000000..13c1617dd
--- /dev/null
+++ b/tests/run/nothingTypeNoFramesNoDce.scala
@@ -0,0 +1,61 @@
+// See comment in BCodeBodyBuilder
+
+// -target:jvm-1.5 -Ybackend:GenBCode -Yopt:l:none
+// target disables stack map frame generation. in this mode, the ClssWriter just emits dead code as is.
+
+class C {
+ // can't just emit a call to ???, that returns value of type Nothing$ (not Int).
+ def f1: Int = ???
+
+ def f2: Int = throw new Error("")
+
+ def f3(x: Boolean) = {
+ var y = 0
+ // cannot assign an object of type Nothing$ to Int
+ if (x) y = ???
+ else y = 1
+ y
+ }
+
+ def f4(x: Boolean) = {
+ var y = 0
+ // tests that whatever is emitted after the throw is valid (what? depends on opts, presence of stack map frames)
+ if (x) y = throw new Error("")
+ else y = 1
+ y
+ }
+
+ def f5(x: Boolean) = {
+ // stack heights need to be the smae. ??? looks to the jvm like returning a value of
+ // type Nothing$, need to drop or throw it.
+ println(
+ if (x) { ???; 10 }
+ else 20
+ )
+ }
+
+ def f6(x: Boolean) = {
+ println(
+ if (x) { throw new Error(""); 10 }
+ else 20
+ )
+ }
+
+ def f7(x: Boolean) = {
+ println(
+ if (x) throw new Error("")
+ else 20
+ )
+ }
+
+ def f8(x: Boolean) = {
+ println(
+ if (x) throw new Error("")
+ else 20
+ )
+ }
+}
+
+object Test extends dotty.runtime.LegacyApp {
+ new C()
+}
diff --git a/tests/run/origins.check b/tests/run/origins.check
new file mode 100644
index 000000000..771baf9fd
--- /dev/null
+++ b/tests/run/origins.check
@@ -0,0 +1,6 @@
+
+>> Origins tag 'boop' logged 65 calls from 3 distinguished sources.
+
+ 50 Test$.$anonfun$f3$1(origins.scala:21)
+ 10 Test$.$anonfun$f2$1(origins.scala:20)
+ 5 Test$.$anonfun$f1$1(origins.scala:19)
diff --git a/tests/run/origins.flags b/tests/run/origins.flags
new file mode 100644
index 000000000..690753d80
--- /dev/null
+++ b/tests/run/origins.flags
@@ -0,0 +1 @@
+-no-specialization -Ydelambdafy:inline \ No newline at end of file
diff --git a/tests/run/origins.scala b/tests/run/origins.scala
new file mode 100644
index 000000000..6529351d3
--- /dev/null
+++ b/tests/run/origins.scala
@@ -0,0 +1,21 @@
+import scala.reflect.internal.util.Origins
+
+package goxbox {
+ object Socks {
+ val origins = Origins("boop")
+
+ def boop(x: Int): Int = origins { 5 }
+ }
+}
+
+object Test {
+ import goxbox.Socks.boop
+
+ def f1() = 1 to 5 map boop
+ def f2() = 1 to 10 map boop
+ def f3() = 1 to 50 map boop
+
+ def main(args: Array[String]): Unit = {
+ f1() ; f2() ; f3()
+ }
+}
diff --git a/tests/run/shortClass.check b/tests/run/shortClass.check
new file mode 100644
index 000000000..0c62fb26f
--- /dev/null
+++ b/tests/run/shortClass.check
@@ -0,0 +1,10 @@
+bippity.bop.Foo
+bippity.bop.Foo$Bar
+bippity.bop.Foo$Bar$
+Test$$anon$
+Test$$anon$
+Foo
+Bar
+Bar$
+Foo with DingDongBippy
+Bar with DingDongBippy
diff --git a/tests/run/shortClass.scala b/tests/run/shortClass.scala
new file mode 100644
index 000000000..c5c2043f4
--- /dev/null
+++ b/tests/run/shortClass.scala
@@ -0,0 +1,26 @@
+import scala.reflect.internal.util._
+
+package bippity {
+ trait DingDongBippy
+
+ package bop {
+ class Foo {
+ class Bar
+ object Bar
+ }
+ }
+}
+
+object Test {
+ import bippity._
+ import bop._
+
+ def printSanitized(x: String) = println(x.filterNot(_.isDigit))
+
+ def main(args: Array[String]): Unit = {
+ val f = new Foo
+ val instances = List(f, new f.Bar, f.Bar, new Foo with DingDongBippy, new f.Bar with DingDongBippy)
+ instances map (_.getClass.getName) foreach printSanitized
+ instances map shortClassOfInstance foreach printSanitized
+ }
+}
diff --git a/tests/run/spec-self.check b/tests/run/spec-self.check
new file mode 100644
index 000000000..e981f45c9
--- /dev/null
+++ b/tests/run/spec-self.check
@@ -0,0 +1,2 @@
+5.0
+5.0
diff --git a/tests/run/spec-self.scala b/tests/run/spec-self.scala
new file mode 100644
index 000000000..1c95e0a82
--- /dev/null
+++ b/tests/run/spec-self.scala
@@ -0,0 +1,14 @@
+class Foo0 extends (() => Double) {
+ def apply() = 5.0d
+}
+
+class Foo1 extends (Double => Double) {
+ def apply(x: Double) = x
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ println((new Foo0)())
+ println((new Foo1)(5.0d))
+ }
+}
diff --git a/tests/run/t0807.check b/tests/run/t0807.check
new file mode 100644
index 000000000..c862cba6b
--- /dev/null
+++ b/tests/run/t0807.check
@@ -0,0 +1 @@
+early
diff --git a/tests/run/t0807.scala b/tests/run/t0807.scala
new file mode 100644
index 000000000..1b5bc91c5
--- /dev/null
+++ b/tests/run/t0807.scala
@@ -0,0 +1,5 @@
+trait A
+trait B extends A { val x = println("early") }
+object Test extends dotty.runtime.LegacyApp {
+ new B {}
+}
diff --git a/tests/run/t2087-and-2400.scala b/tests/run/t2087-and-2400.scala
new file mode 100644
index 000000000..19a5df26e
--- /dev/null
+++ b/tests/run/t2087-and-2400.scala
@@ -0,0 +1,20 @@
+object Test
+{
+ def negativeCharMaker = new (Short => Char) { def apply(x: Short) = x.toChar }
+ def main(args: Array[String]): Unit = {
+ // throws exception if -100 gets to Character.valueOf
+ val x = negativeCharMaker(-100)
+
+ // chars are unsigned, they should never be equal to negative values
+ assert((-100).toShort != (-100).toChar)
+ assert((-100).toChar != (-100).toShort)
+ assert((-100).toChar != (-100).toByte)
+ assert((-100).toByte != (-100).toChar)
+
+ // BoxesRunTime must agree as well
+ assert(((-100).toShort: Any) != (-100).toChar)
+ assert(((-100).toChar: Any) != (-100).toShort)
+ assert(((-100).toChar: Any) != (-100).toByte)
+ assert(((-100).toByte: Any) != (-100).toChar)
+ }
+}
diff --git a/tests/run/t2857.check b/tests/run/t2857.check
new file mode 100644
index 000000000..c508d5366
--- /dev/null
+++ b/tests/run/t2857.check
@@ -0,0 +1 @@
+false
diff --git a/tests/run/t2857.scala b/tests/run/t2857.scala
new file mode 100644
index 000000000..5df2d440e
--- /dev/null
+++ b/tests/run/t2857.scala
@@ -0,0 +1,9 @@
+object Test extends dotty.runtime.LegacyApp {
+ import collection.mutable._
+ val m = new HashMap[Int, Set[String]] with MultiMap[Int, String]
+ m.addBinding(6, "Foo")
+ m.removeBinding(6, "Foo")
+ println(m.contains(6))
+}
+
+
diff --git a/tests/run/t3038.check b/tests/run/t3038.check
new file mode 100644
index 000000000..9a325c4c1
--- /dev/null
+++ b/tests/run/t3038.check
@@ -0,0 +1,19 @@
+a1
+a2
+a3
+a4
+a5
+a6
+a7
+a8
+a9
+c1
+c2
+c3
+c4
+c5
+c6
+c7
+c8
+c9
+c10
diff --git a/tests/run/t3038.scala b/tests/run/t3038.scala
new file mode 100644
index 000000000..6c9888c78
--- /dev/null
+++ b/tests/run/t3038.scala
@@ -0,0 +1,68 @@
+class A {
+ private lazy val a1 = "a1"
+ object B
+ private lazy val a2 = "a2"
+
+
+ @transient lazy val a3 = "a3"
+ @transient private lazy val a4 = "a4"
+ @transient lazy val a5 = "a5"
+ @transient private lazy val a6 = "a6"
+
+ final val a7 = "a7"
+ private final val a8 = "a8"
+ @transient final val a9 = "a9"
+
+
+
+
+ def run = {
+ println(a1)
+ B
+ println(a2)
+ println(a3)
+ println(a4)
+ println(a5)
+ println(a6)
+ println(a7)
+ println(a8)
+ println(a9)
+ }
+}
+
+class C extends A {
+ private lazy val c1 = "c1"
+ lazy val c2 = "c2"
+
+ private lazy val c3 = "c3"
+
+ @transient lazy val c4 = "c4"
+ @transient private lazy val c5 = "c5"
+ @transient lazy val c6 = "c6"
+ @transient private lazy val c7 = "c7"
+ lazy val c8 = "c8"
+
+ final val c9 = "c9"
+ private final val c10 = "c10"
+
+
+
+ override def run = {
+ super.run
+ println(c1)
+ println(c2)
+ println(c3)
+ println(c4)
+ println(c5)
+ println(c6)
+ println(c7)
+ println(c8)
+ println(c9)
+ println(c10)
+ }
+}
+
+object Test extends dotty.runtime.LegacyApp {
+ (new C).run
+}
+
diff --git a/tests/run/t3038b.check b/tests/run/t3038b.check
new file mode 100644
index 000000000..cf0389a5a
--- /dev/null
+++ b/tests/run/t3038b.check
@@ -0,0 +1,6 @@
+1
+2
+3
+4
+5
+6 \ No newline at end of file
diff --git a/tests/run/t3038b.flags b/tests/run/t3038b.flags
new file mode 100644
index 000000000..ae0844605
--- /dev/null
+++ b/tests/run/t3038b.flags
@@ -0,0 +1 @@
+-Xcheckinit \ No newline at end of file
diff --git a/tests/run/t3038b.scala b/tests/run/t3038b.scala
new file mode 100644
index 000000000..559f754aa
--- /dev/null
+++ b/tests/run/t3038b.scala
@@ -0,0 +1,20 @@
+class A {
+ val a1 = 1
+ val a2 = 2
+ private val b1 = 3
+ private val b2 = 4
+ @transient val c1 = 5
+ @transient val c2 = 6
+ def run = {
+ println(a1)
+ println(a2)
+ println(b1)
+ println(b2)
+ println(c1)
+ println(c2)
+ }
+}
+
+object Test extends dotty.runtime.LegacyApp {
+ new A().run
+}
diff --git a/tests/run/t3038c.check b/tests/run/t3038c.check
new file mode 100644
index 000000000..a7e7ae9bd
--- /dev/null
+++ b/tests/run/t3038c.check
@@ -0,0 +1,2 @@
+List(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70)
+List(71, 72, 73, 74, 75, 76, 77, 78, 79, 80)
diff --git a/tests/run/t3038c/A_1.scala b/tests/run/t3038c/A_1.scala
new file mode 100644
index 000000000..91564e302
--- /dev/null
+++ b/tests/run/t3038c/A_1.scala
@@ -0,0 +1,83 @@
+class A {
+ lazy val a0 = 1
+ lazy val a1 = 2
+ lazy val a2 = 3
+ lazy val a3 = 4
+ lazy val a4 = 5
+ lazy val a5 = 6
+ lazy val a6 = 7
+ lazy val a7 = 8
+ lazy val a8 = 9
+ lazy val a9 = 10
+ lazy val a10 = 11
+ lazy val a11 = 12
+ lazy val a12 = 13
+ lazy val a13 = 14
+ lazy val a14 = 15
+ lazy val a15 = 16
+ lazy val a16 = 17
+ lazy val a17 = 18
+ lazy val a18 = 19
+ lazy val a19 = 20
+ lazy val a20 = 21
+ lazy val a21 = 22
+ lazy val a22 = 23
+ lazy val a23 = 24
+ lazy val a24 = 25
+ lazy val a25 = 26
+ lazy val a26 = 27
+ lazy val a27 = 28
+ lazy val a28 = 29
+ lazy val a29 = 30
+ lazy val a30 = 31
+ lazy val a31 = 32
+ lazy val a32 = 33
+ lazy val a33 = 34
+ lazy val a34 = 35
+ lazy val a35 = 36
+ lazy val a36 = 37
+ lazy val a37 = 38
+ lazy val a38 = 39
+ lazy val a39 = 40
+ lazy val a40 = 41
+ lazy val a41 = 42
+ lazy val a42 = 43
+ lazy val a43 = 44
+ lazy val a44 = 45
+ lazy val a45 = 46
+ lazy val a46 = 47
+ lazy val a47 = 48
+ lazy val a48 = 49
+ lazy val a49 = 50
+ lazy val a50 = 51
+ lazy val a51 = 52
+ lazy val a52 = 53
+ lazy val a53 = 54
+ lazy val a54 = 55
+ lazy val a55 = 56
+ lazy val a56 = 57
+ lazy val a57 = 58
+ lazy val a58 = 59
+ lazy val a59 = 60
+ private lazy val a60 = 61
+ private lazy val a61 = 62
+ private lazy val a62 = 63
+ private lazy val a63 = 64
+ private lazy val a64 = 65
+ private lazy val a65 = 66
+ private lazy val a66 = 67
+ private lazy val a67 = 68
+ private lazy val a68 = 69
+ private lazy val a69 = 70
+
+ def run = {
+ println(List(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+ a10, a11, a12, a13, a14, a15, a16, a17, a18, a19,
+ a20, a21, a22, a23, a24, a25, a26, a27, a28, a29,
+ a30, a31, a32, a33, a34, a35, a36, a37, a38, a39,
+ a40, a41, a42, a43, a44, a45, a46, a47, a48, a49,
+ a50, a51, a52, a53, a54, a55, a56, a57, a58, a59,
+ a60, a61, a62, a63, a64, a65, a66, a67, a68, a69))
+ }
+
+}
diff --git a/tests/run/t3038c/B_2.scala b/tests/run/t3038c/B_2.scala
new file mode 100644
index 000000000..d5b7baa1c
--- /dev/null
+++ b/tests/run/t3038c/B_2.scala
@@ -0,0 +1,24 @@
+
+class B extends A {
+ lazy val b0 = 71
+ lazy val b1 = 72
+ lazy val b2 = 73
+ lazy val b3 = 74
+ lazy val b4 = 75
+ lazy val b5 = 76
+ lazy val b6 = 77
+ lazy val b7 = 78
+ lazy val b8 = 79
+ lazy val b9 = 80
+ override def run = {
+ super.run
+ println(List(b0, b1, b2, b3, b4, b5, b6, b7, b8, b9))
+ }
+
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ new B().run
+ }
+}
diff --git a/tests/run/t3126.scala b/tests/run/t3126.scala
new file mode 100644
index 000000000..36322bf89
--- /dev/null
+++ b/tests/run/t3126.scala
@@ -0,0 +1,9 @@
+object Test {
+ case class C(x: Int)
+ val v: Some[Int] = null
+
+ def main(args: Array[String]): Unit = {
+ try C.unapply(null) catch { case _: MatchError => }
+ try v match { case Some(1) => } catch { case _: MatchError => }
+ }
+}
diff --git a/tests/run/t3452.check b/tests/run/t3452.check
new file mode 100644
index 000000000..b8626c4cf
--- /dev/null
+++ b/tests/run/t3452.check
@@ -0,0 +1 @@
+4
diff --git a/tests/run/t3452.scala b/tests/run/t3452.scala
new file mode 100644
index 000000000..253fc93cf
--- /dev/null
+++ b/tests/run/t3452.scala
@@ -0,0 +1,21 @@
+trait IStringPair[T] {
+ def a : String
+ def b : String
+ def build(a : String, b : String) : T
+ def cat(that : IStringPair[T]) = build(this.a + that.a, this.b + that.b)
+ override def toString = a + b
+}
+
+class StringPair(val a : String, val b : String) extends IStringPair[StringPair] {
+ def build(a : String, b : String) = new StringPair(a, b)
+ def len = a.length + b.length
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val a = new StringPair("A", "B")
+ val b = new StringPair("1", "2")
+ val c = a cat b
+ println(c.len)
+ }
+}
diff --git a/tests/run/t3452c.check b/tests/run/t3452c.check
new file mode 100644
index 000000000..ab4718119
--- /dev/null
+++ b/tests/run/t3452c.check
@@ -0,0 +1,8 @@
+3
+3
+3
+3
+3
+3
+3
+3
diff --git a/tests/run/t3452c.scala b/tests/run/t3452c.scala
new file mode 100644
index 000000000..2c55767ab
--- /dev/null
+++ b/tests/run/t3452c.scala
@@ -0,0 +1,113 @@
+trait Base[A, B, C] {
+ def f(x: A, y: B, z: C): Unit
+ def g(x: A, y: B, z: C) = f(x, y, z)
+ def h(x: A, y: B, z: C) = g(x, y, z)
+}
+
+trait D1[B, C] extends Base[String, B, C]
+trait D2[A, B] extends Base[A, B, String]
+trait D3[A, C] extends Base[A, String, C]
+trait D4[A] extends Base[A, String, String]
+trait D5[B] extends Base[String, B, String]
+trait D6[C] extends Base[String, String, C]
+trait D7 extends Base[String, String, String]
+
+trait E1[B, C] extends Base[String, B, C] { def f(x: String, y: B, z: C): Unit ; override def h(x: String, y: B, z: C) = g(x, y, z) }
+trait E2[A, B] extends Base[A, B, String] { def f(x: A, y: B, z: String): Unit ; override def h(x: A, y: B, z: String) = g(x, y, z) }
+trait E3[A, C] extends Base[A, String, C] { def f(x: A, y: String, z: C): Unit ; override def h(x: A, y: String, z: C) = g(x, y, z) }
+trait E4[A] extends Base[A, String, String] { def f(x: A, y: String, z: String): Unit ; override def h(x: A, y: String, z: String) = g(x, y, z) }
+trait E5[B] extends Base[String, B, String] { def f(x: String, y: B, z: String): Unit ; override def h(x: String, y: B, z: String) = g(x, y, z) }
+trait E6[C] extends Base[String, String, C] { def f(x: String, y: String, z: C): Unit ; override def h(x: String, y: String, z: C) = g(x, y, z) }
+trait E7 extends Base[String, String, String] { def f(x: String, y: String, z: String): Unit ; override def h(x: String, y: String, z: String) = g(x, y, z) }
+
+trait F1[B, C] extends Base[String, B, C] { def f(x: String, y: B, z: C): Unit = println(x.length) }
+trait F2[A, B] extends Base[A, B, String] { def f(x: A, y: B, z: String): Unit = println(z.length) }
+trait F3[A, C] extends Base[A, String, C] { def f(x: A, y: String, z: C): Unit = println(y.length) }
+trait F4[A] extends Base[A, String, String] { def f(x: A, y: String, z: String): Unit = println(y.length) }
+trait F5[B] extends Base[String, B, String] { def f(x: String, y: B, z: String): Unit = println(x.length) }
+trait F6[C] extends Base[String, String, C] { def f(x: String, y: String, z: C): Unit = println(x.length) }
+trait F7 extends Base[String, String, String] { def f(x: String, y: String, z: String): Unit = println(x.length) }
+
+abstract class DBag extends D1[String, String] with D2[String, String] with D3[String, String] with D4[String] with D5[String] with D6[String] with D7 {
+ def f(x: String, y: String, z: String) = println(x.length + y.length + z.length)
+}
+abstract class EBag extends E1[String, String] with E2[String, String] with E3[String, String] with E4[String] with E5[String] with E6[String] with E7 {
+ def f(x: String, y: String, z: String) = println(x.length + y.length + z.length)
+}
+abstract class FBag extends F1[String, String] with F2[String, String] with F3[String, String] with F4[String] with F5[String] with F6[String] with F7 {
+ override def f(x: String, y: String, z: String) = println(x.length + y.length + z.length)
+}
+
+abstract class GBag1[A, B] extends Base[A, B, String] with D2[A, B] {
+ def f(x: A, y: B, z: String) = println(z.length)
+}
+abstract class GBag2[A] extends GBag1[A, String] with D4[A] {
+ override def f(x: A, y: String, z: String) = println(z.length)
+}
+abstract class GBag3 extends GBag2[String] with D7 {
+ override def f(x: String, y: String, z: String) = println(z.length)
+}
+class GBag extends GBag3 with D2[String, String] with D3[String, String] with D4[String] with D5[String] with D6[String] with D7 {
+}
+
+object Test {
+ def f0(x: Base[String, String, String]) = x.f("a", "b", "c")
+ def f1(x: D1[String, String]) = x.f("a", "b", "c")
+ def f2(x: D2[String, String]) = x.f("a", "b", "c")
+ def f3(x: D3[String, String]) = x.f("a", "b", "c")
+ def f4(x: D4[String]) = x.f("a", "b", "c")
+ def f5(x: D5[String]) = x.f("a", "b", "c")
+ def f6(x: D6[String]) = x.f("a", "b", "c")
+ def f7(x: D7) = x.f("a", "b", "c")
+
+ def main(args: Array[String]): Unit = {
+ val x = new DBag { }
+ f0(x)
+ f1(x)
+ f2(x)
+ f3(x)
+ f4(x)
+ f5(x)
+ f6(x)
+ f7(x)
+ }
+}
+
+object TestE {
+ def f0(x: Base[String, String, String]) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+ def f1(x: E1[String, String]) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+ def f2(x: E2[String, String]) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+ def f3(x: E3[String, String]) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+ def f4(x: E4[String]) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+ def f5(x: E5[String]) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+ def f6(x: E6[String]) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+ def f7(x: E7) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+
+ def main(args: Array[String]): Unit = {
+ val x = new EBag { }
+ f0(x)
+ f1(x)
+ f2(x)
+ f3(x)
+ f4(x)
+ f5(x)
+ f6(x)
+ f7(x)
+ }
+}
+
+
+object TestG {
+ def f0(x: Base[String, String, String]) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+ def f1(x: GBag1[String, String]) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+ def f2(x: GBag2[String]) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+ def f3(x: GBag3) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+
+ def main(args: Array[String]): Unit = {
+ val x = new GBag { }
+ f0(x)
+ f1(x)
+ f2(x)
+ f3(x)
+ }
+}
diff --git a/tests/run/t3452f.scala b/tests/run/t3452f.scala
new file mode 100644
index 000000000..af64f5c04
--- /dev/null
+++ b/tests/run/t3452f.scala
@@ -0,0 +1,19 @@
+import language.higherKinds
+
+trait GenSet[A]
+
+trait GenSetTemplate[A, +CC[X] <: GenSet[X]] {
+ def empty: CC[A] = ???
+}
+
+trait SetLike[A, +This <: SetLike[A, This] with Set[A]] {
+ def empty: This
+}
+
+abstract class Set[A] extends GenSet[A] with SetLike[A,Set[A]] with GenSetTemplate[A,Set]
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ locally(classOf[Set[_]]) // trigger classloading to verify class
+ }
+}
diff --git a/tests/run/t3502.scala b/tests/run/t3502.scala
new file mode 100644
index 000000000..2f432e486
--- /dev/null
+++ b/tests/run/t3502.scala
@@ -0,0 +1,24 @@
+
+
+
+
+
+// ticket #3502
+object Test {
+
+ object GeneratePrimeFactorsLazy extends (Int => List[Int]) {
+ override def apply(n:Int) = {
+ val s = Stream.range(2, n / 2).filter(n % _ == 0)
+ //val s = for (i <- Stream.range(2, n / 2); if n % i == 0) yield i
+ s.headOption.map(x => x :: apply(n / x)).getOrElse(List(n))
+ }
+ }
+
+ def main(args:Array[String]): Unit = {
+ // a prime number
+ //val num = 623456789
+ val num = 2796203
+ assert(GeneratePrimeFactorsLazy(num) == List(num))
+ }
+
+}
diff --git a/tests/run/t3651.scala b/tests/run/t3651.scala
new file mode 100644
index 000000000..c4c5c2ed6
--- /dev/null
+++ b/tests/run/t3651.scala
@@ -0,0 +1,10 @@
+class Klass[@specialized(Long) A]( val a: A )
+
+class LongKlass( override val a: Long ) extends Klass[Long](a)
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val lk = new LongKlass(10)
+ val a = lk.a
+ }
+}
diff --git a/tests/run/t3670.check b/tests/run/t3670.check
new file mode 100644
index 000000000..bc49bb643
--- /dev/null
+++ b/tests/run/t3670.check
@@ -0,0 +1,5 @@
+a
+b
+1
+2
+42
diff --git a/tests/run/t3670.scala b/tests/run/t3670.scala
new file mode 100644
index 000000000..b9cee847b
--- /dev/null
+++ b/tests/run/t3670.scala
@@ -0,0 +1,31 @@
+class C {
+ val things = List("abcs")
+
+ if (things.length < 30) {
+ lazy val a = "a"
+ println(a)
+ }
+ if (things.length < 30) {
+ lazy val b = "b"
+ println(b)
+ }
+}
+
+class M extends dotty.runtime.LegacyApp {
+ def foo: Unit = {
+ lazy val a = {
+ lazy val b = 1
+ lazy val c = 2
+ println(b)
+ println(c)
+ }
+ a
+ lazy val d = 42
+ println(d)
+ }
+}
+
+object Test extends dotty.runtime.LegacyApp {
+ new C()
+ new M().foo
+}
diff --git a/tests/run/t3895.check b/tests/run/t3895.check
new file mode 100644
index 000000000..3045ebf01
--- /dev/null
+++ b/tests/run/t3895.check
@@ -0,0 +1,2 @@
+17
+17 \ No newline at end of file
diff --git a/tests/run/t3895.flags b/tests/run/t3895.flags
new file mode 100644
index 000000000..ae0844605
--- /dev/null
+++ b/tests/run/t3895.flags
@@ -0,0 +1 @@
+-Xcheckinit \ No newline at end of file
diff --git a/tests/run/t3895.scala b/tests/run/t3895.scala
new file mode 100644
index 000000000..5f83235de
--- /dev/null
+++ b/tests/run/t3895.scala
@@ -0,0 +1,36 @@
+class C extends A{
+
+ val a = 10
+ //object bb
+ lazy val bb = 17
+ val b = 12
+}
+
+abstract class A{
+ val a: Int
+ val b: Int
+ val c: Int = 12
+}
+
+class B extends A{
+
+ val a = 10
+ //object bb
+ lazy val bb = 17
+ val b = 12
+}
+
+trait T {
+ private final val a = false
+}
+
+class Impl extends T
+
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ println(new B().bb)
+ println(new C().bb)
+ }
+}
+
diff --git a/tests/run/t3980.check b/tests/run/t3980.check
new file mode 100644
index 000000000..8bb03f18b
--- /dev/null
+++ b/tests/run/t3980.check
@@ -0,0 +1,3 @@
+once
+2
+2
diff --git a/tests/run/t3980.scala b/tests/run/t3980.scala
new file mode 100644
index 000000000..dbe9644ea
--- /dev/null
+++ b/tests/run/t3980.scala
@@ -0,0 +1,19 @@
+object A {
+ def run1: Unit = {
+ lazy val x: Unit = {(); println("once")}
+ x
+ x
+ }
+ def run2: Unit = {
+ lazy val y: Int = 2
+ println(y)
+ println(y)
+ }
+}
+
+object Test {
+ def main(args: Array[String]) = {
+ A.run1
+ A.run2
+ }
+}
diff --git a/tests/run/t4742.flags b/tests/run/t4742.flags
new file mode 100644
index 000000000..ae0844605
--- /dev/null
+++ b/tests/run/t4742.flags
@@ -0,0 +1 @@
+-Xcheckinit \ No newline at end of file
diff --git a/tests/run/t4742.scala b/tests/run/t4742.scala
new file mode 100644
index 000000000..47656049b
--- /dev/null
+++ b/tests/run/t4742.scala
@@ -0,0 +1,7 @@
+trait T { val x: Int = 0 }
+object O extends T { override final val x = 1 }
+
+object Test extends dotty.runtime.LegacyApp {
+ // was throwing an UnitializedFieldError as constant 1 is folded into the accessor
+ assert((O: T).x == 1)
+}
diff --git a/tests/run/t5045.check b/tests/run/t5045.check
new file mode 100644
index 000000000..7e9c1961b
--- /dev/null
+++ b/tests/run/t5045.check
@@ -0,0 +1,6 @@
+ extract an exact match 2011-07-15 2011-07-15
+ extract from middle of string 2011-07-15 2011-07-15
+ extract from middle of string (P2) 2011-07-15 2011-07-15
+ extract from middle of string (P3) 2011-07-15 2011-07-15
+ copyright example has date Copyright 2011 Copyright 2011
+ copyright example missing date No copyright No copyright
diff --git a/tests/run/t5045.scala b/tests/run/t5045.scala
new file mode 100644
index 000000000..3778339aa
--- /dev/null
+++ b/tests/run/t5045.scala
@@ -0,0 +1,49 @@
+
+import scala.language.postfixOps
+
+object Test extends dotty.runtime.LegacyApp {
+
+ import scala.util.matching.{ Regex, UnanchoredRegex }
+
+ val dateP1 = """(\d\d\d\d)-(\d\d)-(\d\d)""".r.unanchored
+ val dateP2 = """(\d\d\d\d)-(\d\d)-(\d\d)""" r ("year", "month", "day") unanchored
+ val dateP3 = new Regex("""(\d\d\d\d)-(\d\d)-(\d\d)""", "year", "month", "day") with UnanchoredRegex
+
+ val yearStr = "2011"
+ val dateStr = List(yearStr,"07","15").mkString("-")
+
+ def test(msg: String)(strs: Seq[String]): Unit = println("%40s %s".format(msg, strs mkString " "))
+
+ test("extract an exact match") {
+ val dateP1(y,m,d) = dateStr
+ Seq(List(y,m,d).mkString("-"), dateStr)
+ }
+
+ test("extract from middle of string") {
+ val dateP1(y,m,d) = "Tested on "+dateStr+"."
+ Seq(List(y,m,d).mkString("-"), dateStr)
+ }
+
+ test("extract from middle of string (P2)") {
+ val dateP2(y,m,d) = "Tested on "+dateStr+"."
+ Seq(List(y,m,d).mkString("-"), dateStr)
+ }
+
+ test("extract from middle of string (P3)") {
+ val dateP2(y,m,d) = "Tested on "+dateStr+"."
+ Seq(List(y,m,d).mkString("-"), dateStr)
+ }
+
+ def copyright(in: String): String = in match {
+ case dateP1(year, month, day) => "Copyright "+year
+ case _ => "No copyright"
+ }
+
+ test("copyright example has date") {
+ Seq(copyright("Date of this document: "+dateStr), "Copyright "+yearStr)
+ }
+
+ test("copyright example missing date") {
+ Seq(copyright("Date of this document: unknown"), "No copyright")
+ }
+}
diff --git a/tests/run/t5300.scala b/tests/run/t5300.scala
new file mode 100644
index 000000000..0f1c80717
--- /dev/null
+++ b/tests/run/t5300.scala
@@ -0,0 +1,7 @@
+object Test {
+ val pf: PartialFunction[Any, Unit] = { case _ => () }
+
+ def main(args: Array[String]): Unit = {
+ pf orElse pf
+ }
+}
diff --git a/tests/run/t5328.check b/tests/run/t5328.check
new file mode 100644
index 000000000..77a43968c
--- /dev/null
+++ b/tests/run/t5328.check
@@ -0,0 +1,3 @@
+2
+1,2,8
+1,8,3
diff --git a/tests/run/t5328.scala b/tests/run/t5328.scala
new file mode 100644
index 000000000..74c8ace89
--- /dev/null
+++ b/tests/run/t5328.scala
@@ -0,0 +1,5 @@
+object Test extends dotty.runtime.LegacyApp {
+ println(Vector(1).view.updated(0,2).toList mkString ",")
+ println(Seq(1,2,3).view.updated(2,8).toList mkString ",")
+ println(List(1,2,3).view.updated(1,8).toList mkString ",")
+}
diff --git a/tests/run/t5610a.check b/tests/run/t5610a.check
new file mode 100644
index 000000000..2aa46b3b9
--- /dev/null
+++ b/tests/run/t5610a.check
@@ -0,0 +1 @@
+Stroke a kitten
diff --git a/tests/run/t5610a.scala b/tests/run/t5610a.scala
new file mode 100644
index 000000000..3787c0984
--- /dev/null
+++ b/tests/run/t5610a.scala
@@ -0,0 +1,19 @@
+object Test extends dotty.runtime.LegacyApp {
+ class Result(_str: => String) {
+ lazy val str = _str
+ }
+
+ def foo(str: => String)(i: Int) = new Result(str)
+
+ def bar(f: Int => Result) = f(42)
+
+ var test: String = null
+ val result = bar(foo(test))
+ test = "bar"
+
+ if (result.str == null) {
+ println("Destroy ALL THE THINGS!!!")
+ } else {
+ println("Stroke a kitten")
+ }
+}
diff --git a/tests/run/t5629b.check b/tests/run/t5629b.check
new file mode 100644
index 000000000..e0f25f0b0
--- /dev/null
+++ b/tests/run/t5629b.check
@@ -0,0 +1,10 @@
+=== pf(1):
+MySmartPF.apply entered...
+newPF.applyOrElse entered...
+default
+scala.MatchError: 1 (of class java.lang.Integer)
+=== pf(42):
+MySmartPF.apply entered...
+newPF.applyOrElse entered...
+ok
+=== done
diff --git a/tests/run/t5629b.scala b/tests/run/t5629b.scala
new file mode 100644
index 000000000..9cee18893
--- /dev/null
+++ b/tests/run/t5629b.scala
@@ -0,0 +1,36 @@
+object Test extends dotty.runtime.LegacyApp {
+
+ trait MyPF[@specialized(Int) -A] extends (A => Unit) {
+ def isDefinedAt(x: A): Boolean
+ def applyOrElse[A1 <: A](x: A1, default: A1 => Unit): Unit = {
+ println("MyPF.applyOrElse entered...")
+ if (isDefinedAt(x)) apply(x) else default(x)
+ }
+ }
+
+ trait MySmartPF[@specialized(Int) -A] extends MyPF[A] {
+ def apply(x: A): Unit = {
+ println("MySmartPF.apply entered...")
+ applyOrElse(x, { default: Any => throw new MatchError(default) })
+ }
+ }
+
+ type T = Int
+ //type T = Any
+
+ def newPF(test: T): MyPF[T] = new MySmartPF[T] {
+ def isDefinedAt(x: T): Boolean = x != test
+ override def applyOrElse[A1 <: T](x: A1, default: A1 => Unit): Unit = {
+ println("newPF.applyOrElse entered...")
+ if (x != test) { println("ok"); () } else { println("default"); default(x) }
+ }
+ }
+
+ val pf = newPF(1)
+ println("=== pf(1):")
+ try { pf(1) } catch { case x: Throwable => println(x) }
+ println("=== pf(42):")
+ pf(42)
+ println("=== done")
+
+}
diff --git a/tests/run/t603.check b/tests/run/t603.check
new file mode 100644
index 000000000..1f4082502
--- /dev/null
+++ b/tests/run/t603.check
@@ -0,0 +1,5 @@
+s = Susp(?)
+evaluating...
+s() = 3
+s = Susp(3)
+2 + s = 5
diff --git a/tests/run/t603.scala b/tests/run/t603.scala
new file mode 100644
index 000000000..84a224a40
--- /dev/null
+++ b/tests/run/t603.scala
@@ -0,0 +1,35 @@
+object forceDelay {
+ import scala.language.implicitConversions
+
+ class Susp[+A](lazyValue: => A) extends Function0[A] {
+ private var func: () => Any = () => lazyValue
+ private var value: Any = null
+
+ override def apply() = {
+ if (func != null) {
+ value = func().asInstanceOf[A]
+ func = null
+ }
+ value.asInstanceOf[A]
+ }
+
+ override def toString() =
+ if (func == null) "Susp(" + value + ")"
+ else "Susp(?)"
+ }
+
+ def delay[A](value: => A) = new Susp[A](value)
+ implicit def force[A](s: Susp[A]): A = s()
+}
+
+object Test {
+ import forceDelay._
+
+ def main(args: Array[String]) = {
+ val s: Susp[Int] = delay { Console.println("evaluating..."); 3 }
+ Console.println("s = " + s)
+ Console.println("s() = " + s())
+ Console.println("s = " + s)
+ Console.println("2 + s = " + (2 + s))
+ }
+}
diff --git a/tests/run/t6853.scala b/tests/run/t6853.scala
new file mode 100644
index 000000000..352375c99
--- /dev/null
+++ b/tests/run/t6853.scala
@@ -0,0 +1,18 @@
+// Test cases: the only place we can cut and paste without crying
+// ourself to sleep.
+object Test {
+
+ def main(args: Array[String]): Unit = {
+ // First testing the basic operations
+ val m = collection.mutable.ListMap[String, Int]()
+ var i = 0
+ while(i < 2) { m += ("foo" + i) -> i; i = i+1}
+ assert(m == Map("foo1"->1,"foo0"->0))
+ m-= "foo0"
+ assert(m == Map("foo1"->1))
+ // Now checking if it scales as described in SI-6853
+ i = 0
+ while(i < 80000) { m += ("foo" + i) -> i; i = i+1}
+ assert(m.size == 80000)
+ }
+}
diff --git a/tests/run/t751.scala b/tests/run/t751.scala
new file mode 100644
index 000000000..294d3af5c
--- /dev/null
+++ b/tests/run/t751.scala
@@ -0,0 +1,6 @@
+object Test {
+ def main(args: Array[String]): Unit = {
+ val map = Map(1 -> "a", 2 -> "b", 3 -> "c")
+ assert(map.filterKeys(_ % 2 == 0).isInstanceOf[scala.collection.immutable.Map[_,_]])
+ }
+}
diff --git a/tests/run/t7584.check b/tests/run/t7584.check
new file mode 100644
index 000000000..9f53e5dde
--- /dev/null
+++ b/tests/run/t7584.check
@@ -0,0 +1,6 @@
+no calls
+call A
+a
+call B twice
+b
+b
diff --git a/tests/run/t7584.flags b/tests/run/t7584.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/run/t7584.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/run/t7584.scala b/tests/run/t7584.scala
new file mode 100644
index 000000000..f134b04a5
--- /dev/null
+++ b/tests/run/t7584.scala
@@ -0,0 +1,14 @@
+// Test case added to show the behaviour of functions with
+// by-name parameters. The evaluation behaviour was already correct.
+//
+// We did flush out a spurious "pure expression does nothing in statement position"
+// warning, hence -Xfatal-warnings in the flags file.
+object Test extends dotty.runtime.LegacyApp {
+ def foo(f: (=> Int, => Int) => Unit) = f({println("a"); 0}, {println("b"); 1})
+ println("no calls")
+ foo((a, b) => ())
+ println("call A")
+ foo((a, b) => a)
+ println("call B twice")
+ foo((a, b) => {b; b})
+}
diff --git a/tests/run/t7859/A_1.scala b/tests/run/t7859/A_1.scala
new file mode 100644
index 000000000..74f0709d4
--- /dev/null
+++ b/tests/run/t7859/A_1.scala
@@ -0,0 +1,11 @@
+class A(private val x: Int) extends AnyVal
+
+object A {
+ val Const = new A(0)
+}
+
+class A1(protected val x: Int) extends AnyVal
+
+package p {
+ class A2(private[p] val x: Int) extends AnyVal
+}
diff --git a/tests/run/t7859/B_2.scala b/tests/run/t7859/B_2.scala
new file mode 100644
index 000000000..052322ef6
--- /dev/null
+++ b/tests/run/t7859/B_2.scala
@@ -0,0 +1,47 @@
+class B private (private val b: Int) extends AnyVal
+object B {
+ val Const = new B(0)
+}
+
+// These tests will require erasure to unbox the value class.
+// We need to test under joint and separate compilation to check
+// that the 'notPRIVATE' flag on the param accessor is pickled.
+//
+// See also SI-6601.
+object Test {
+ def main(args: Array[String]): Unit = {
+ unboxA
+ unboxA1
+ unboxA2
+ unboxB
+ }
+
+ def unboxA: Unit = {
+ val o: Some[A] = Some(A.Const)
+ val a = o.get
+ def id(a: A): A = a
+ id(a)
+ }
+
+ def unboxA1: Unit = {
+ val o: Some[A1] = Some(new A1(0))
+ val a = o.get
+ def id(a: A1): A1 = a
+ id(a)
+ }
+
+ def unboxA2: Unit = {
+ import p.A2
+ val o: Some[A2] = Some(new A2(0))
+ val a = o.get
+ def id(a: A2): A2 = a
+ id(a)
+ }
+
+ def unboxB: Unit = {
+ val o: Some[B] = Some(B.Const)
+ val b = o.get
+ def id(b: B): B = b
+ id(b)
+ }
+}
diff --git a/tests/run/t8280.check b/tests/run/t8280.check
new file mode 100644
index 000000000..ed392841c
--- /dev/null
+++ b/tests/run/t8280.check
@@ -0,0 +1,9 @@
+Int
+Int
+Int
+Int
+Int
+Int
+Int
+Int
+Int
diff --git a/tests/run/t8280.scala b/tests/run/t8280.scala
new file mode 100644
index 000000000..0734d63b6
--- /dev/null
+++ b/tests/run/t8280.scala
@@ -0,0 +1,82 @@
+import scala.language.implicitConversions
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ Moop1.ob1
+ Moop1.ob2
+ Moop1.ob3
+ Moop2.ob1
+ Moop2.ob2
+ Moop2.ob3
+ Moop3.ob1
+ Moop3.ob2
+ Moop3.ob3
+ }
+}
+
+// int object vs.
+object Moop1 {
+ object ob1 {
+ implicit object f1 extends (Int => String) { def apply(x: Int): String = "Int" }
+ implicit object f2 extends (Long => String) { def apply(x: Long): String = "Long" }
+
+ println(5: String)
+ }
+ object ob2 {
+ implicit object f1 extends (Int => String) { def apply(x: Int): String = "Int" }
+ implicit def f2(x: Long): String = "Long"
+
+ println(5: String)
+ }
+ object ob3 {
+ implicit object f1 extends (Int => String) { def apply(x: Int): String = "Int" }
+ implicit val f2: Long => String = _ => "Long"
+
+ println(5: String)
+ }
+}
+
+// int def vs.
+object Moop2 {
+ object ob1 {
+ implicit def f1(x: Int): String = "Int"
+ implicit object f2 extends (Long => String) { def apply(x: Long): String = "Long" }
+
+ println(5: String)
+ }
+ object ob2 {
+ implicit def f1(x: Int): String = "Int"
+ implicit def f2(x: Long): String = "Long"
+
+ println(5: String)
+ }
+ object ob3 {
+ implicit def f1(x: Int): String = "Int"
+ implicit val f2: Long => String = _ => "Long"
+
+ println(5: String)
+ }
+}
+
+// int val vs.
+object Moop3 {
+ object ob1 {
+ implicit val f1: Int => String = _ => "Int"
+ implicit object f2 extends (Long => String) { def apply(x: Long): String = "Long" }
+
+ println(5: String)
+ }
+ object ob2 {
+ implicit val f1: Int => String = _ => "Int"
+ implicit def f2(x: Long): String = "Long"
+
+ println(5: String)
+ }
+ object ob3 {
+ implicit val f1: Int => String = _ => "Int"
+ implicit val f2: Long => String = _ => "Long"
+
+ println(5: String)
+ }
+}
+
diff --git a/tests/run/t8570.flags b/tests/run/t8570.flags
new file mode 100644
index 000000000..3d1ee4760
--- /dev/null
+++ b/tests/run/t8570.flags
@@ -0,0 +1 @@
+-Xcheckinit
diff --git a/tests/run/t8570.scala b/tests/run/t8570.scala
new file mode 100644
index 000000000..f1f752602
--- /dev/null
+++ b/tests/run/t8570.scala
@@ -0,0 +1,10 @@
+trait Trait40_1 {
+ val value37_2 = ()
+ def run = { value37_2 }
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ (new Trait40_1 {}).run
+ }
+}
diff --git a/tests/run/t8570a.check b/tests/run/t8570a.check
new file mode 100644
index 000000000..6a452c185
--- /dev/null
+++ b/tests/run/t8570a.check
@@ -0,0 +1 @@
+()
diff --git a/tests/run/t8570a.flags b/tests/run/t8570a.flags
new file mode 100644
index 000000000..3d1ee4760
--- /dev/null
+++ b/tests/run/t8570a.flags
@@ -0,0 +1 @@
+-Xcheckinit
diff --git a/tests/run/t8570a.scala b/tests/run/t8570a.scala
new file mode 100644
index 000000000..b36c34037
--- /dev/null
+++ b/tests/run/t8570a.scala
@@ -0,0 +1,14 @@
+trait Trait40_1 {
+ val value37_2 = ()
+ def run = { value37_2 }
+}
+
+trait T1 extends Trait40_1 {
+ override val value37_2 = ()
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ println((new T1 {}).run)
+ }
+}
diff --git a/tests/run/t8611b.flags b/tests/run/t8611b.flags
new file mode 100644
index 000000000..85d8eb2ba
--- /dev/null
+++ b/tests/run/t8611b.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/tests/run/t8611b.scala b/tests/run/t8611b.scala
new file mode 100644
index 000000000..75114c2ae
--- /dev/null
+++ b/tests/run/t8611b.scala
@@ -0,0 +1,54 @@
+sealed trait KrafsDescription
+
+abstract class NotWorkingEnum extends Enumeration {
+
+ type ExtendedValue = Value with KrafsDescription
+
+ def Enum(inDescription: String): ExtendedValue = {
+ new Val(nextId) with KrafsDescription {
+ }
+ }
+}
+
+abstract class WorkingEnum extends Enumeration {
+
+ type ExtendedValue = Value
+
+ def Enum(inDescription: String): ExtendedValue = {
+ new Val(nextId) {
+ }
+ }
+}
+
+object NotWorkingTab extends NotWorkingEnum {
+ val a = Enum("A")
+ val b = Enum("B")
+}
+
+object WorkingTab extends WorkingEnum {
+ val a = Enum("A")
+ val b = Enum("B")
+}
+
+object Test extends dotty.runtime.LegacyApp {
+ testGris()
+ testWorking()
+
+ def testGris(): Unit = {
+ val pipp = NotWorkingTab.b
+ pipp match {
+ case NotWorkingTab.a => ???
+ case NotWorkingTab.b =>
+ case _ => ???
+ }
+ }
+
+ def testWorking(): Unit = {
+ val stuff = WorkingTab.a
+ stuff match {
+ case WorkingTab.a =>
+ case WorkingTab.b => ???
+ case _ => ???
+ }
+ }
+}
diff --git a/tests/run/t8823.scala b/tests/run/t8823.scala
new file mode 100644
index 000000000..06e3bff69
--- /dev/null
+++ b/tests/run/t8823.scala
@@ -0,0 +1,10 @@
+class Tuple2Int(val encoding: Long) extends AnyVal with Product2[Int, Int] {
+ def canEqual(that: Any) = false
+ def _1: Int = 1
+ def _2: Int = 2
+}
+
+object Test extends dotty.runtime.LegacyApp {
+ assert(new Tuple2Int(0)._1 == 1)
+ assert(new Tuple2Int(0)._2 == 2)
+}
diff --git a/tests/run/t889.check b/tests/run/t889.check
new file mode 100644
index 000000000..67ca2bf46
--- /dev/null
+++ b/tests/run/t889.check
@@ -0,0 +1 @@
+first: a, rest: List()
diff --git a/tests/run/t889.scala b/tests/run/t889.scala
new file mode 100644
index 000000000..8e5d82412
--- /dev/null
+++ b/tests/run/t889.scala
@@ -0,0 +1,9 @@
+object Test extends dotty.runtime.LegacyApp {
+
+ val a = List("a")
+
+ a match {
+ case Seq("a", "b", rest : _*) => println("a, b, " + rest)
+ case Seq(first, rest : _*) => println("first: " + first + ", rest: " + rest)
+ }
+}
diff --git a/tests/run/t949.scala b/tests/run/t949.scala
new file mode 100644
index 000000000..9363f60c6
--- /dev/null
+++ b/tests/run/t949.scala
@@ -0,0 +1,14 @@
+object Test extends dotty.runtime.LegacyApp {
+
+ private def f = new T { val state = State.A }
+
+ private object State extends Enumeration {
+ val A, B = Value
+ }
+
+ f
+}
+
+trait T {
+}
+
diff --git a/tests/run/t978.scala b/tests/run/t978.scala
new file mode 100644
index 000000000..e87e7054a
--- /dev/null
+++ b/tests/run/t978.scala
@@ -0,0 +1,38 @@
+class Foo(val n: Int) {
+ override def hashCode = n % 2 // pretty bad hash
+ override def equals(other: Any): Boolean = other match {
+ case f: Foo => f.n == n
+ case _ => false
+ }
+
+ override def toString = "" + n
+}
+
+object Test extends dotty.runtime.LegacyApp {
+ val set = new collection.mutable.HashSet[Foo]
+// val set = new collection.jcl.HashSet[Foo]
+
+ val max = 200
+ for (x <- 1 to max)
+ set += new Foo(x)
+
+ testRemove(2)
+ testExists(2)
+
+ def testRemove(m: Int): Unit = {
+ for (x <- 1 to max; if x % m == 0) {
+ val f = new Foo(x)
+ set -= f
+ assert(!(set contains f))
+ testExists(m)
+ }
+ }
+
+ def testExists(m: Int): Unit = {
+ for (x <- 1 to max; if x % m == 1) {
+ val f = new Foo(x)
+ assert(set contains f, "For element: " + f + " set: " + set)
+ }
+ }
+
+}
diff --git a/tests/run/traitParamInit.scala b/tests/run/traitParamInit.scala
new file mode 100644
index 000000000..37d8a425d
--- /dev/null
+++ b/tests/run/traitParamInit.scala
@@ -0,0 +1,30 @@
+object Trace {
+ private var results = List[Any]()
+ def apply[A](a: A) = {results ::= a; a}
+ def fetchAndClear(): Seq[Any] = try results.reverse finally results = Nil
+}
+trait T(a: Any) {
+ val ta = a
+ Trace(s"T.<init>($ta)")
+ val t_val = Trace("T.val")
+}
+
+trait U(a: Any) extends T {
+ val ua = a
+ Trace(s"U.<init>($ua)")
+}
+
+object Test {
+ def check(expected: Any) = {
+ val actual = Trace.fetchAndClear()
+ if (actual != expected)
+ sys.error(s"\n$actual\n$expected")
+ }
+ def main(args: Array[String]): Unit = {
+ new T(Trace("ta")) with U(Trace("ua")) {}
+ check(List("ta", "T.<init>(ta)", "T.val", "ua", "U.<init>(ua)"))
+
+ new U(Trace("ua")) with T(Trace("ta")) {}
+ check(List("ta", "T.<init>(ta)", "T.val", "ua", "U.<init>(ua)"))
+ }
+}
diff --git a/tests/run/traitParams.scala b/tests/run/traitParams.scala
new file mode 100644
index 000000000..82c176461
--- /dev/null
+++ b/tests/run/traitParams.scala
@@ -0,0 +1,32 @@
+object State {
+ var s: Int = 0
+}
+
+trait T(x: Int, val y: Int) {
+ def f = x
+}
+
+trait U extends T {
+ State.s += 1
+ override def f = super.f + y
+}
+trait U2(a: Any) extends T {
+ def d = a // okay
+ val v = a // okay
+ a // used to crash
+}
+
+import State._
+class C(x: Int) extends U with T(x, x * x + s)
+class C2(x: Int) extends T(x, x * x + s) with U
+
+class D extends C(10) with T
+class D2 extends C2(10) with T
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ assert(new D().f == 110)
+ assert(new D2().f == 111)
+ }
+}
+
diff --git a/tests/run/weakconform.scala b/tests/run/weakconform.scala
new file mode 100755
index 000000000..e13390730
--- /dev/null
+++ b/tests/run/weakconform.scala
@@ -0,0 +1,4 @@
+object Test extends dotty.runtime.LegacyApp {
+ val x: Float = 10/3
+ assert(x == 3.0)
+}