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/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/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 -} 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