From eeab89e878f8ede43b09474e455d3df528d16a0e Mon Sep 17 00:00:00 2001 From: Jan Chyb Date: Wed, 13 Aug 2025 15:11:24 +0200 Subject: [PATCH] Add regression test for i18670 --- tests/neg/i18670.check | 14 ++++++++++++++ tests/neg/i18670.scala | 11 +++++++++++ 2 files changed, 25 insertions(+) create mode 100644 tests/neg/i18670.check create mode 100644 tests/neg/i18670.scala diff --git a/tests/neg/i18670.check b/tests/neg/i18670.check new file mode 100644 index 000000000000..425cc26e4048 --- /dev/null +++ b/tests/neg/i18670.check @@ -0,0 +1,14 @@ +-- [E172] Type Error: tests/neg/i18670.scala:11:38 --------------------------------------------------------------------- +11 |case class Summary() extends Payload() // error + | ^ + | No given instance of type TC[A] was found for a context parameter of constructor Payload in class Payload. + | I found: + | + | TC.derived[A](/* missing */summon[scala.deriving.Mirror.Of[A]]) + | + | But Failed to synthesize an instance of type scala.deriving.Mirror.Of[A]: + | * class Nothing is not a generic product because it is not a case class + | * class Nothing is not a generic sum because it is not a sealed class + | + | where: A is a type variable with constraint <: Payload[A] + | . diff --git a/tests/neg/i18670.scala b/tests/neg/i18670.scala new file mode 100644 index 000000000000..7a8d7f711e05 --- /dev/null +++ b/tests/neg/i18670.scala @@ -0,0 +1,11 @@ +import scala.deriving.Mirror + +type TC[A] + +object TC: + inline given derived[A](using Mirror.Of[A]): TC[A] = ??? + +abstract class Payload[A <: Payload[A]: TC]() + +// infers Nothing and fail compilation +case class Summary() extends Payload() // error