From b8786aa5693934121630fbf60bdb6910eb12d617 Mon Sep 17 00:00:00 2001 From: Eugene Flesselle Date: Sat, 13 Apr 2024 23:13:13 +0200 Subject: [PATCH 1/2] Add regression tests Closes #19749 Closes #16208 [Cherry-picked 2afcf397a8143f94e9f0a2686ed0a3e8d57d01d6] --- tests/pos/i16208.scala | 12 ++++++++++++ tests/pos/i19749.scala | 15 +++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 tests/pos/i16208.scala create mode 100644 tests/pos/i19749.scala diff --git a/tests/pos/i16208.scala b/tests/pos/i16208.scala new file mode 100644 index 000000000000..18455f2e698c --- /dev/null +++ b/tests/pos/i16208.scala @@ -0,0 +1,12 @@ + +class Ann(x: Any) extends annotation.Annotation +object Message: + implicit def toNoExplanation(str: String): Message @Ann(str) = ??? +class Message + +object report: + def error(x: Message): Unit = ??? + +def test = + report.error("a") // works + report.error("a".stripMargin) // was an error diff --git a/tests/pos/i19749.scala b/tests/pos/i19749.scala new file mode 100644 index 000000000000..367c5f61bdce --- /dev/null +++ b/tests/pos/i19749.scala @@ -0,0 +1,15 @@ +import scala.deriving.Mirror + +case class A(x: Int, y: String) + +trait SomeTrait[T] + +object SomeTrait: + given [T]: SomeTrait[T] with {} + +def f1[T](using p: Mirror.ProductOf[T]): Tuple.Elem[p.MirroredElemTypes, 0] = ??? + +def f2[T, R](f: T => R)(using SomeTrait[R]) = ??? + +// Scala3.3 is fine, 3.4 has compilation errors, p MirroredElemTypes type is missing and has been changed to Nothing +val x = f2(_ => f1[A]) From cfcdbbb97f8170702419a05c9f7443945d091590 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Fri, 5 Jul 2024 20:09:56 +0200 Subject: [PATCH 2/2] Revert adding test pos/i16208 - not fixed yet in the LTS --- tests/pos/i16208.scala | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 tests/pos/i16208.scala diff --git a/tests/pos/i16208.scala b/tests/pos/i16208.scala deleted file mode 100644 index 18455f2e698c..000000000000 --- a/tests/pos/i16208.scala +++ /dev/null @@ -1,12 +0,0 @@ - -class Ann(x: Any) extends annotation.Annotation -object Message: - implicit def toNoExplanation(str: String): Message @Ann(str) = ??? -class Message - -object report: - def error(x: Message): Unit = ??? - -def test = - report.error("a") // works - report.error("a".stripMargin) // was an error