From e1dc0b46a81a507ca040dca05a98f49fd6520d25 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Wed, 24 Aug 2016 13:48:26 +0200 Subject: Move tests to right directory --- tests/disabled/not-representable/pos/t3999b.scala | 20 ++++++ .../not-representable/pos/t5544/Api_1.scala | 9 +++ .../not-representable/pos/t5544/Test_2.scala | 3 + tests/disabled/not-representable/pos/t7035.scala | 17 +++++ tests/disabled/not-representable/pos/t7228.scala | 76 ++++++++++++++++++++++ tests/disabled/not-representable/t3999b.scala | 20 ------ tests/disabled/not-representable/t7035.scala | 17 ----- tests/disabled/not-representable/t7228.scala | 76 ---------------------- tests/pending/neg/i533/Compat.scala | 7 ++ tests/pending/neg/i533/JA.java | 5 ++ tests/run/t5544/Api_1.scala | 8 --- tests/run/t5544/Test_2.scala | 3 - 12 files changed, 137 insertions(+), 124 deletions(-) create mode 100644 tests/disabled/not-representable/pos/t3999b.scala create mode 100644 tests/disabled/not-representable/pos/t5544/Api_1.scala create mode 100644 tests/disabled/not-representable/pos/t5544/Test_2.scala create mode 100644 tests/disabled/not-representable/pos/t7035.scala create mode 100644 tests/disabled/not-representable/pos/t7228.scala delete mode 100644 tests/disabled/not-representable/t3999b.scala delete mode 100644 tests/disabled/not-representable/t7035.scala delete mode 100644 tests/disabled/not-representable/t7228.scala create mode 100644 tests/pending/neg/i533/Compat.scala create mode 100644 tests/pending/neg/i533/JA.java delete mode 100644 tests/run/t5544/Api_1.scala delete mode 100644 tests/run/t5544/Test_2.scala diff --git a/tests/disabled/not-representable/pos/t3999b.scala b/tests/disabled/not-representable/pos/t3999b.scala new file mode 100644 index 000000000..0f3f7d642 --- /dev/null +++ b/tests/disabled/not-representable/pos/t3999b.scala @@ -0,0 +1,20 @@ +object `package` { + trait Score { def toString : String } + trait Test[+T <: Score] { def apply(s : String) : T } + + case class FT(f : Float) extends Score + implicit object FT extends Test[FT] { def apply(s : String) : FT = new FT(s.toFloat) } + + case class IT(i : Int) extends Score + implicit object IT extends Test[IT] { def apply(s : String) : IT = new IT(s.toInt) } +} + +class TT[+T <: Score](implicit val tb : Test[T]) { + def read(s : String) : T = tb(s) +} + +object Tester { + val tt = new TT[FT] + val r = tt.read("1.0") + r.toString +} diff --git a/tests/disabled/not-representable/pos/t5544/Api_1.scala b/tests/disabled/not-representable/pos/t5544/Api_1.scala new file mode 100644 index 000000000..30994fa07 --- /dev/null +++ b/tests/disabled/not-representable/pos/t5544/Api_1.scala @@ -0,0 +1,9 @@ +// Uses structural types; therefore not expressible in dotty +import scala.annotation.StaticAnnotation + +class ann(val bar: Any) extends StaticAnnotation + +object Api { + @ann({def foo = "foo!!"}) + def foo = println("foo") +} diff --git a/tests/disabled/not-representable/pos/t5544/Test_2.scala b/tests/disabled/not-representable/pos/t5544/Test_2.scala new file mode 100644 index 000000000..ea9232221 --- /dev/null +++ b/tests/disabled/not-representable/pos/t5544/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends dotty.runtime.LegacyApp { + Api.foo +} diff --git a/tests/disabled/not-representable/pos/t7035.scala b/tests/disabled/not-representable/pos/t7035.scala new file mode 100644 index 000000000..b1ce66cc6 --- /dev/null +++ b/tests/disabled/not-representable/pos/t7035.scala @@ -0,0 +1,17 @@ +// no longer works because dotty uses name-nased pattern matching for case classes + +case class Y(final var x: Int, final private var y: String, final val z1: Boolean, final private val z2: Any) { + + import Test.{y => someY} + List(someY.x: Int, someY.y: String, someY.z1: Boolean, someY.z2: Any) + someY.y = "" +} + +object Test { + val y = Y(0, "", true, new {}) + val unapp: Option[(Int, String, Boolean, Any)] = // was (Int, Boolean, String, Any) !! + Y.unapply(y) + + val Y(a, b, c, d) = y + List(a: Int, b: String, c: Boolean, d: Any) +} diff --git a/tests/disabled/not-representable/pos/t7228.scala b/tests/disabled/not-representable/pos/t7228.scala new file mode 100644 index 000000000..525327857 --- /dev/null +++ b/tests/disabled/not-representable/pos/t7228.scala @@ -0,0 +1,76 @@ +// no longer works because dotty does not have a concept of weak conformance +object AdaptWithWeaklyConformantType { + implicit class D(d: Double) { def double = d*2 } + + val x1: Int = 1 + var x2: Int = 2 + val x3 = 3 + var x4 = 4 + final val x5 = 5 + final var x6 = 6 + + def f1 = x1.double + def f2 = x2.double + def f3 = x3.double + def f4 = x4.double + def f5 = x5.double + def f6 = x6.double +} + +object AdaptAliasWithWeaklyConformantType { + implicit class D(d: Double) { def double = d*2 } + type T = Int + + val x1: T = 1 + var x2: T = 2 + val x3 = (3: T) + var x4 = (4: T) + final val x5 = (5: T) + final var x6 = (6: T) + + def f1 = x1.double + def f2 = x2.double + def f3 = x3.double + def f4 = x4.double + def f5 = x5.double + def f6 = x6.double +} + +object AdaptToAliasWithWeaklyConformantType { + type U = Double + implicit class D(d: U) { def double = d*2 } + + val x1: Int = 1 + var x2: Int = 2 + val x3 = (3: Int) + var x4 = (4: Int) + final val x5 = (5: Int) + final var x6 = (6: Int) + + def f1 = x1.double + def f2 = x2.double + def f3 = x3.double + def f4 = x4.double + def f5 = x5.double + def f6 = x6.double +} + +object AdaptAliasToAliasWithWeaklyConformantType { + type U = Double + type T = Int + implicit class D(d: U) { def double = d*2 } + + val x1: T = 1 + var x2: T = 2 + val x3 = (3: T) + var x4 = (4: T) + final val x5 = (5: T) + final var x6 = (6: T) + + def f1 = x1.double + def f2 = x2.double + def f3 = x3.double + def f4 = x4.double + def f5 = x5.double + def f6 = x6.double +} diff --git a/tests/disabled/not-representable/t3999b.scala b/tests/disabled/not-representable/t3999b.scala deleted file mode 100644 index 0f3f7d642..000000000 --- a/tests/disabled/not-representable/t3999b.scala +++ /dev/null @@ -1,20 +0,0 @@ -object `package` { - trait Score { def toString : String } - trait Test[+T <: Score] { def apply(s : String) : T } - - case class FT(f : Float) extends Score - implicit object FT extends Test[FT] { def apply(s : String) : FT = new FT(s.toFloat) } - - case class IT(i : Int) extends Score - implicit object IT extends Test[IT] { def apply(s : String) : IT = new IT(s.toInt) } -} - -class TT[+T <: Score](implicit val tb : Test[T]) { - def read(s : String) : T = tb(s) -} - -object Tester { - val tt = new TT[FT] - val r = tt.read("1.0") - r.toString -} diff --git a/tests/disabled/not-representable/t7035.scala b/tests/disabled/not-representable/t7035.scala deleted file mode 100644 index b1ce66cc6..000000000 --- a/tests/disabled/not-representable/t7035.scala +++ /dev/null @@ -1,17 +0,0 @@ -// no longer works because dotty uses name-nased pattern matching for case classes - -case class Y(final var x: Int, final private var y: String, final val z1: Boolean, final private val z2: Any) { - - import Test.{y => someY} - List(someY.x: Int, someY.y: String, someY.z1: Boolean, someY.z2: Any) - someY.y = "" -} - -object Test { - val y = Y(0, "", true, new {}) - val unapp: Option[(Int, String, Boolean, Any)] = // was (Int, Boolean, String, Any) !! - Y.unapply(y) - - val Y(a, b, c, d) = y - List(a: Int, b: String, c: Boolean, d: Any) -} diff --git a/tests/disabled/not-representable/t7228.scala b/tests/disabled/not-representable/t7228.scala deleted file mode 100644 index 525327857..000000000 --- a/tests/disabled/not-representable/t7228.scala +++ /dev/null @@ -1,76 +0,0 @@ -// no longer works because dotty does not have a concept of weak conformance -object AdaptWithWeaklyConformantType { - implicit class D(d: Double) { def double = d*2 } - - val x1: Int = 1 - var x2: Int = 2 - val x3 = 3 - var x4 = 4 - final val x5 = 5 - final var x6 = 6 - - def f1 = x1.double - def f2 = x2.double - def f3 = x3.double - def f4 = x4.double - def f5 = x5.double - def f6 = x6.double -} - -object AdaptAliasWithWeaklyConformantType { - implicit class D(d: Double) { def double = d*2 } - type T = Int - - val x1: T = 1 - var x2: T = 2 - val x3 = (3: T) - var x4 = (4: T) - final val x5 = (5: T) - final var x6 = (6: T) - - def f1 = x1.double - def f2 = x2.double - def f3 = x3.double - def f4 = x4.double - def f5 = x5.double - def f6 = x6.double -} - -object AdaptToAliasWithWeaklyConformantType { - type U = Double - implicit class D(d: U) { def double = d*2 } - - val x1: Int = 1 - var x2: Int = 2 - val x3 = (3: Int) - var x4 = (4: Int) - final val x5 = (5: Int) - final var x6 = (6: Int) - - def f1 = x1.double - def f2 = x2.double - def f3 = x3.double - def f4 = x4.double - def f5 = x5.double - def f6 = x6.double -} - -object AdaptAliasToAliasWithWeaklyConformantType { - type U = Double - type T = Int - implicit class D(d: U) { def double = d*2 } - - val x1: T = 1 - var x2: T = 2 - val x3 = (3: T) - var x4 = (4: T) - final val x5 = (5: T) - final var x6 = (6: T) - - def f1 = x1.double - def f2 = x2.double - def f3 = x3.double - def f4 = x4.double - def f5 = x5.double - def f6 = x6.double -} diff --git a/tests/pending/neg/i533/Compat.scala b/tests/pending/neg/i533/Compat.scala new file mode 100644 index 000000000..16613cf5b --- /dev/null +++ b/tests/pending/neg/i533/Compat.scala @@ -0,0 +1,7 @@ +object Compat { + def main(args: Array[String]): Unit = { + val x = new Array[Int](1) + x(0) = 10 + println(JA.get(x)) + } +} diff --git a/tests/pending/neg/i533/JA.java b/tests/pending/neg/i533/JA.java new file mode 100644 index 000000000..92421e5b1 --- /dev/null +++ b/tests/pending/neg/i533/JA.java @@ -0,0 +1,5 @@ +class JA { + public static T get(T[] arr) { + return arr[0]; + } +} \ No newline at end of file diff --git a/tests/run/t5544/Api_1.scala b/tests/run/t5544/Api_1.scala deleted file mode 100644 index b4c92864d..000000000 --- a/tests/run/t5544/Api_1.scala +++ /dev/null @@ -1,8 +0,0 @@ -import scala.annotation.StaticAnnotation - -class ann(val bar: Any) extends StaticAnnotation - -object Api { - @ann({def foo = "foo!!"}) - def foo = println("foo") -} diff --git a/tests/run/t5544/Test_2.scala b/tests/run/t5544/Test_2.scala deleted file mode 100644 index ea9232221..000000000 --- a/tests/run/t5544/Test_2.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test extends dotty.runtime.LegacyApp { - Api.foo -} -- cgit v1.2.3