From 209ac19c454c7d81fa381c7a732888d214ae48c9 Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Thu, 11 Jan 2018 00:19:41 +0100 Subject: [PATCH 1/2] Fix #686: Move testcase to neg/ The corresponding feature in scalac only ever worked under -Xexperimental and was dropped in https://github.com/scala/scala/pull/3938 --- tests/{pending/run => neg}/t8764.scala | 4 ++-- tests/pending/run/t8764.check | 5 ----- tests/pending/run/t8764.flags | 1 - 3 files changed, 2 insertions(+), 8 deletions(-) rename tests/{pending/run => neg}/t8764.scala (75%) delete mode 100644 tests/pending/run/t8764.check delete mode 100644 tests/pending/run/t8764.flags diff --git a/tests/pending/run/t8764.scala b/tests/neg/t8764.scala similarity index 75% rename from tests/pending/run/t8764.scala rename to tests/neg/t8764.scala index fc4c23e450b4..0284794f45b6 100644 --- a/tests/pending/run/t8764.scala +++ b/tests/neg/t8764.scala @@ -3,14 +3,14 @@ case class IntOnly(i: Int, j: Int) println("IntOnly: should return an unboxed int") val a = IntOnly(1, 2) -val i: Int = a.productElement(0) +val i: Int = a.productElement(0) // error: found Any, required Int println(s"Int: ${a.productElement(0).getClass}") case class IntAndDouble(i: Int, d: Double) println("IntAndDouble: should just box and return Anyval") val b = IntAndDouble(1, 2.0) -val j: AnyVal = b.productElement(0) +val j: AnyVal = b.productElement(0) // error: found Any, required AnyVal println(s"Double: ${b.productElement(1).getClass}") println(s"Int: ${b.productElement(0).getClass}") } diff --git a/tests/pending/run/t8764.check b/tests/pending/run/t8764.check deleted file mode 100644 index 6260069602ae..000000000000 --- a/tests/pending/run/t8764.check +++ /dev/null @@ -1,5 +0,0 @@ -IntOnly: should return an unboxed int -Int: int -IntAndDouble: should just box and return Anyval -Double: class java.lang.Double -Int: class java.lang.Integer diff --git a/tests/pending/run/t8764.flags b/tests/pending/run/t8764.flags deleted file mode 100644 index 48fd867160ba..000000000000 --- a/tests/pending/run/t8764.flags +++ /dev/null @@ -1 +0,0 @@ --Xexperimental From 256ab15b83d2c776e6564414d83e3472f1c13f80 Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Thu, 11 Jan 2018 00:27:37 +0100 Subject: [PATCH 2/2] Fix #692: Move testcase to neg-no-optimise/ I don't think the `def run` in the original testcase should work given that the added `def run2` doesn't in either scalac or dotty. The testcase is in neg-no-optimise because of #3805. --- tests/neg-no-optimise/t7868.scala | 13 +++++++++++++ tests/pending/run/t7868.scala | 13 ------------- 2 files changed, 13 insertions(+), 13 deletions(-) create mode 100644 tests/neg-no-optimise/t7868.scala delete mode 100644 tests/pending/run/t7868.scala diff --git a/tests/neg-no-optimise/t7868.scala b/tests/neg-no-optimise/t7868.scala new file mode 100644 index 000000000000..e64ccb43c140 --- /dev/null +++ b/tests/neg-no-optimise/t7868.scala @@ -0,0 +1,13 @@ +object A { + def unapply(n: Int): Option[Int] = Some(n) + + def run = (0: Short) match { + case A(_) => // error: this case is unreachable since class Short is not a subclass of class Int + case _ => + } + + def run2 = (0: Short) match { + case x: Int => // error: this case is unreachable since class Short is not a subclass of class Int + case _ => + } +} diff --git a/tests/pending/run/t7868.scala b/tests/pending/run/t7868.scala deleted file mode 100644 index 799447f1ef1d..000000000000 --- a/tests/pending/run/t7868.scala +++ /dev/null @@ -1,13 +0,0 @@ -object A { - def unapply(n: Int): Option[Int] = Some(n) - - def run = (0: Short) match { - case A(_) => - case _ => - } -} - - -object Test extends dotty.runtime.LegacyApp { - A.run -}