From 2afcf397a8143f94e9f0a2686ed0a3e8d57d01d6 Mon Sep 17 00:00:00 2001 From: Eugene Flesselle Date: Sat, 13 Apr 2024 23:13:13 +0200 Subject: [PATCH] Add regression tests Closes #19749 Closes #16208 --- 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])