diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-06-15 17:50:04 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-06-15 17:50:04 +0200 |
commit | 506a5e334d57084322fa89119d72fa96beb824b6 (patch) | |
tree | 83401f75400ac373e5ae68d633bbf9de2b6ce8d9 /tests/run | |
parent | c4c29e393afb7175422053924b7e1e5a30131c4c (diff) | |
download | dotty-506a5e334d57084322fa89119d72fa96beb824b6.tar.gz dotty-506a5e334d57084322fa89119d72fa96beb824b6.tar.bz2 dotty-506a5e334d57084322fa89119d72fa96beb824b6.zip |
Enable tests that succeed.
Diffstat (limited to 'tests/run')
78 files changed, 2537 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..16b491d6e --- /dev/null +++ b/tests/run/Course-2002-01.check @@ -0,0 +1,37 @@ +Course-2002-01.scala:41: warning: method loop in object M0 does nothing other than call itself recursively + def loop: Int = loop; + ^ +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/arrays.check b/tests/run/arrays.check new file mode 100644 index 000000000..c9a3a8726 --- /dev/null +++ b/tests/run/arrays.check @@ -0,0 +1,7 @@ +arrays.scala:248: warning: comparing values of types Unit and Unit using `==' will always yield true + check(xs(0) == u0, xs(0), u0); + ^ +arrays.scala:249: warning: comparing values of types Unit and Unit using `==' will always yield true + check(xs(1) == u1, xs(1), u1); + ^ +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/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..3a366bfcd --- /dev/null +++ b/tests/run/collection-stacks.check @@ -0,0 +1,15 @@ +warning: there was one deprecation warning; re-run with -deprecation for details +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/contrib674.check b/tests/run/contrib674.check new file mode 100644 index 000000000..78325c181 --- /dev/null +++ b/tests/run/contrib674.check @@ -0,0 +1,3 @@ +contrib674.scala:15: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 1 + ^ 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/lazy-exprs.check b/tests/run/lazy-exprs.check new file mode 100644 index 000000000..2efb8ceb4 --- /dev/null +++ b/tests/run/lazy-exprs.check @@ -0,0 +1,21 @@ +lazy-exprs.scala:38: warning: match may not be exhaustive. +It would fail on the following input: Some((x: String forSome x not in Z1)) + t match { + ^ +lazy-exprs.scala:62: warning: match may not be exhaustive. +It would fail on the following input: Some((x: String forSome x not in LazyField)) + t match { + ^ +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..b1d08b45f --- /dev/null +++ b/tests/run/nothingTypeNoFramesNoDce.check @@ -0,0 +1 @@ +warning: -target:jvm-1.5 is deprecated: use target for Java 1.6 or above. 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..b12cb6e38 --- /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.apply(origins.scala:16) + 10 Test$$anonfun$f2$1.apply(origins.scala:15) + 5 Test$$anonfun$f1$1.apply(origins.scala:14) 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/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/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/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/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/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) +} |