From 5216d76310b17bf927946f3a6c6be9b96042779f Mon Sep 17 00:00:00 2001 From: anna herlihy Date: Fri, 13 Jun 2025 12:33:02 +0200 Subject: [PATCH] Test case for regression #23095 (#23359) [Cherry-picked 4d50e5fff74c5cd40d21148ff3a2145947f089e9] --- tests/pos/i23095/defs.scala | 18 ++++++++++++++++++ tests/pos/i23095/test.scala | 3 +++ 2 files changed, 21 insertions(+) create mode 100644 tests/pos/i23095/defs.scala create mode 100644 tests/pos/i23095/test.scala diff --git a/tests/pos/i23095/defs.scala b/tests/pos/i23095/defs.scala new file mode 100644 index 000000000000..085c63019ef6 --- /dev/null +++ b/tests/pos/i23095/defs.scala @@ -0,0 +1,18 @@ +import scala.compiletime.* +import scala.deriving.* + +trait SeqStringCodec[A]: + def decode(value: Seq[String]): Either[Any, A] + +trait UrlForm +trait FormCodec[A] + +object FormCodec { + inline given derived[A](using p: Mirror.ProductOf[A]): FormCodec[A] = + val codecs = summonAll[Tuple.Map[p.MirroredElemTypes, SeqStringCodec]].toArray + val values = codecs.map { + _.asInstanceOf[SeqStringCodec[?]] + .decode(List.empty[String]) + } + ??? +} diff --git a/tests/pos/i23095/test.scala b/tests/pos/i23095/test.scala new file mode 100644 index 000000000000..cf7a321cbcdf --- /dev/null +++ b/tests/pos/i23095/test.scala @@ -0,0 +1,3 @@ +given SeqStringCodec[Int] = ??? +given SeqStringCodec[String] = ??? +final case class Form(int: Int, string: String) derives FormCodec