From 442170c5940264644d6fc09775a7cd16cdae063a Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Fri, 8 Mar 2024 11:03:49 +0100 Subject: [PATCH] Re-enable lost tests Found in https://github.com/scala/scala3/pull/7906#discussion_r1516298628 --- tests/{pos-custom-args => pos}/i4125.scala | 2 ++ tests/{pos-custom-args => pos}/i4509.scala | 2 ++ tests/{pos-custom-args => pos}/i5938.scala | 7 +++++-- tests/{pos-custom-args => pos}/i6009a.scala | 2 ++ tests/{pos-custom-args => pos}/i6009b.scala | 2 ++ tests/{pos-custom-args => pos}/i6009c.scala | 2 ++ tests/{pos-custom-args => pos}/i6419.scala | 2 ++ tests/{pos-custom-args => pos}/i7741.scala | 2 ++ .../{pos-custom-args => pos}/inline-match-gadt.scala | 2 ++ tests/{pos-custom-args => pos}/matchtype.scala | 12 +++++++----- tests/{pos-custom-args => pos}/phantom-Eq.scala | 2 ++ .../phantom-Eq2/Phantom-Eq_1.scala | 1 + .../phantom-Eq2/Phantom-Eq_2.scala | 0 .../{pos-custom-args => pos}/phantom-Evidence.scala | 4 +++- 14 files changed, 34 insertions(+), 8 deletions(-) rename tests/{pos-custom-args => pos}/i4125.scala (73%) rename tests/{pos-custom-args => pos}/i4509.scala (58%) rename tests/{pos-custom-args => pos}/i5938.scala (60%) rename tests/{pos-custom-args => pos}/i6009a.scala (63%) rename tests/{pos-custom-args => pos}/i6009b.scala (63%) rename tests/{pos-custom-args => pos}/i6009c.scala (64%) rename tests/{pos-custom-args => pos}/i6419.scala (78%) rename tests/{pos-custom-args => pos}/i7741.scala (69%) rename tests/{pos-custom-args => pos}/inline-match-gadt.scala (81%) rename tests/{pos-custom-args => pos}/matchtype.scala (86%) rename tests/{pos-custom-args => pos}/phantom-Eq.scala (93%) rename tests/{pos-custom-args => pos}/phantom-Eq2/Phantom-Eq_1.scala (93%) rename tests/{pos-custom-args => pos}/phantom-Eq2/Phantom-Eq_2.scala (100%) rename tests/{pos-custom-args => pos}/phantom-Evidence.scala (88%) diff --git a/tests/pos-custom-args/i4125.scala b/tests/pos/i4125.scala similarity index 73% rename from tests/pos-custom-args/i4125.scala rename to tests/pos/i4125.scala index 70d03fbf3d77..80634076c1b9 100644 --- a/tests/pos-custom-args/i4125.scala +++ b/tests/pos/i4125.scala @@ -1,3 +1,5 @@ +import scala.language.experimental.erasedDefinitions + object Test { def foo: ((erased x: Int, y: Int) => Int) = (erased x, y) => 1 def bar: ((erased x: Int, y: Int) ?=> Int) = (erased x, y) ?=> 1 diff --git a/tests/pos-custom-args/i4509.scala b/tests/pos/i4509.scala similarity index 58% rename from tests/pos-custom-args/i4509.scala rename to tests/pos/i4509.scala index 2e394ef296ed..400cc984c2c2 100644 --- a/tests/pos-custom-args/i4509.scala +++ b/tests/pos/i4509.scala @@ -1,3 +1,5 @@ +import scala.language.experimental.erasedDefinitions + object Main { def fun[T](op: (erased Int) ?=> T) = op(using 0) fun { } diff --git a/tests/pos-custom-args/i5938.scala b/tests/pos/i5938.scala similarity index 60% rename from tests/pos-custom-args/i5938.scala rename to tests/pos/i5938.scala index c650fca779d7..17a20dcd0f1f 100644 --- a/tests/pos-custom-args/i5938.scala +++ b/tests/pos/i5938.scala @@ -1,8 +1,11 @@ +import scala.language.experimental.erasedDefinitions + import compiletime.summonFrom +import compiletime.erasedValue trait Link[T, A] -inline def link[T] = +transparent inline def link[T] = summonFrom { case _: Link[T, s] => summonFrom { @@ -12,7 +15,7 @@ inline def link[T] = class Foo object Foo { - erased implicit val barLink: Link[Foo, Bar.type] = null + erased implicit val barLink: Link[Foo, Bar.type] = erasedValue } implicit object Bar { diff --git a/tests/pos-custom-args/i6009a.scala b/tests/pos/i6009a.scala similarity index 63% rename from tests/pos-custom-args/i6009a.scala rename to tests/pos/i6009a.scala index 41360d845116..63a6039a88a3 100644 --- a/tests/pos-custom-args/i6009a.scala +++ b/tests/pos/i6009a.scala @@ -1,3 +1,5 @@ +import scala.language.experimental.erasedDefinitions + class Foo { def foo(f: (erased Int) => Int): Int = { erased val ctx = 1 diff --git a/tests/pos-custom-args/i6009b.scala b/tests/pos/i6009b.scala similarity index 63% rename from tests/pos-custom-args/i6009b.scala rename to tests/pos/i6009b.scala index 41360d845116..63a6039a88a3 100644 --- a/tests/pos-custom-args/i6009b.scala +++ b/tests/pos/i6009b.scala @@ -1,3 +1,5 @@ +import scala.language.experimental.erasedDefinitions + class Foo { def foo(f: (erased Int) => Int): Int = { erased val ctx = 1 diff --git a/tests/pos-custom-args/i6009c.scala b/tests/pos/i6009c.scala similarity index 64% rename from tests/pos-custom-args/i6009c.scala rename to tests/pos/i6009c.scala index 02f2ced70cec..e09a56203fcf 100644 --- a/tests/pos-custom-args/i6009c.scala +++ b/tests/pos/i6009c.scala @@ -1,3 +1,5 @@ +import scala.language.experimental.erasedDefinitions + class Foo { def foo(f: (erased Int) ?=> Int): Int = { implicit erased val ctx = 1 diff --git a/tests/pos-custom-args/i6419.scala b/tests/pos/i6419.scala similarity index 78% rename from tests/pos-custom-args/i6419.scala rename to tests/pos/i6419.scala index b398e9856dee..550922f48d76 100644 --- a/tests/pos-custom-args/i6419.scala +++ b/tests/pos/i6419.scala @@ -1,3 +1,5 @@ +import scala.language.experimental.erasedDefinitions + class Foo { inline def foo: Unit = { @scala.annotation.compileTimeOnly("some message") val res = ??? diff --git a/tests/pos-custom-args/i7741.scala b/tests/pos/i7741.scala similarity index 69% rename from tests/pos-custom-args/i7741.scala rename to tests/pos/i7741.scala index 72b83b172552..237616d04d2a 100644 --- a/tests/pos-custom-args/i7741.scala +++ b/tests/pos/i7741.scala @@ -1,3 +1,5 @@ +import scala.language.experimental.erasedDefinitions + class A1 { @native private def a: Unit } diff --git a/tests/pos-custom-args/inline-match-gadt.scala b/tests/pos/inline-match-gadt.scala similarity index 81% rename from tests/pos-custom-args/inline-match-gadt.scala rename to tests/pos/inline-match-gadt.scala index f63d0fb5b68c..cf2aae00b402 100644 --- a/tests/pos-custom-args/inline-match-gadt.scala +++ b/tests/pos/inline-match-gadt.scala @@ -1,3 +1,5 @@ +import scala.language.experimental.erasedDefinitions + object `inline-match-gadt` { class Exactly[T] erased def exactType[T]: Exactly[T] = compiletime.erasedValue diff --git a/tests/pos-custom-args/matchtype.scala b/tests/pos/matchtype.scala similarity index 86% rename from tests/pos-custom-args/matchtype.scala rename to tests/pos/matchtype.scala index 746301622864..21c074deafd7 100644 --- a/tests/pos-custom-args/matchtype.scala +++ b/tests/pos/matchtype.scala @@ -1,4 +1,6 @@ -import compiletime.* +import scala.language.experimental.erasedDefinitions +import compiletime.erasedValue +import compiletime.ops.int.S object Test { type T[X] = X match { case String => Int @@ -6,7 +8,7 @@ object Test { } type Len[X] <: Int = X match { - case Unit => 0 + case EmptyTuple => 0 case x *: xs => S[Len[xs]] } @@ -28,7 +30,7 @@ object Test { erased val z1: Head[(Int, String)] = 22 type Concat[X <: Tuple, Y <: Tuple] <: Tuple = X match { - case Unit => Y + case EmptyTuple => Y case x1 *: xs1 => x1 *: Concat[xs1, Y] } @@ -55,8 +57,8 @@ object Test { erased val y4: Elem[(String, Int, Boolean), 2] = erasedValue[Boolean] erased val z4: Boolean = erasedValue[Elem[(String, Int, Boolean), 2]] - erased val y5: Concat[Unit, (String, Int)] = erasedValue[(String, Int)] - erased val z5: (String, Int) = erasedValue[Concat[Unit, (String, Int)]] + erased val y5: Concat[EmptyTuple, (String, Int)] = erasedValue[(String, Int)] + erased val z5: (String, Int) = erasedValue[Concat[EmptyTuple, (String, Int)]] erased val y6: Concat[(Boolean, Boolean), (String, Int)] = erasedValue[Boolean *: Boolean *: (String, Int)] erased val z6: Boolean *: Boolean *: (String, Int) = erasedValue[Concat[(Boolean, Boolean), (String, Int)]] erased val y7: (Boolean, Boolean, String, Int) = erasedValue[Concat[(Boolean, Boolean), String *: Int *: EmptyTuple]] diff --git a/tests/pos-custom-args/phantom-Eq.scala b/tests/pos/phantom-Eq.scala similarity index 93% rename from tests/pos-custom-args/phantom-Eq.scala rename to tests/pos/phantom-Eq.scala index 6ec5f77676ce..9f892d353b41 100644 --- a/tests/pos-custom-args/phantom-Eq.scala +++ b/tests/pos/phantom-Eq.scala @@ -1,3 +1,5 @@ +import scala.language.experimental.erasedDefinitions + object PhantomEq { import EqUtil.* diff --git a/tests/pos-custom-args/phantom-Eq2/Phantom-Eq_1.scala b/tests/pos/phantom-Eq2/Phantom-Eq_1.scala similarity index 93% rename from tests/pos-custom-args/phantom-Eq2/Phantom-Eq_1.scala rename to tests/pos/phantom-Eq2/Phantom-Eq_1.scala index cb4f8aa6821f..120c68174898 100644 --- a/tests/pos-custom-args/phantom-Eq2/Phantom-Eq_1.scala +++ b/tests/pos/phantom-Eq2/Phantom-Eq_1.scala @@ -1,3 +1,4 @@ +import scala.language.experimental.erasedDefinitions /* This is a version of ../pos/phantomEq.scala that tests phantom with separate compilation */ object EqUtil { diff --git a/tests/pos-custom-args/phantom-Eq2/Phantom-Eq_2.scala b/tests/pos/phantom-Eq2/Phantom-Eq_2.scala similarity index 100% rename from tests/pos-custom-args/phantom-Eq2/Phantom-Eq_2.scala rename to tests/pos/phantom-Eq2/Phantom-Eq_2.scala diff --git a/tests/pos-custom-args/phantom-Evidence.scala b/tests/pos/phantom-Evidence.scala similarity index 88% rename from tests/pos-custom-args/phantom-Evidence.scala rename to tests/pos/phantom-Evidence.scala index 3a82cfe0c6e8..ecdd84cbc481 100644 --- a/tests/pos-custom-args/phantom-Evidence.scala +++ b/tests/pos/phantom-Evidence.scala @@ -1,3 +1,5 @@ +import scala.language.experimental.erasedDefinitions + /** In this implementation variant of =:= (called =::=) we erase all instantiations and definitions of =::= */ object WithNormalState { import Utils.* @@ -24,5 +26,5 @@ object WithNormalState { object Utils { type =::=[From, To] - erased given tpEquals[A]: A =::= A = compiletime.erasedValue + erased given tpEquals[A]: (A =::= A) = compiletime.erasedValue }