Closed
Description
Compiler version
3.2.2, 3.3.0-RC3
Minimized code
//> using scala "3.3.0-RC3"
import scala.deriving.Mirror
import scala.compiletime.*
trait Reader[-In, Out]
trait A:
type T
type F[X]
type Q = F[T]
object Reader:
given [X]: Reader[A { type Q = X }, X] with {}
type Map2[Tup1 <: Tuple, Tup2 <: Tuple, F[_, _]] <: Tuple = (Tup1, Tup2) match
case (h1 *: t1, h2 *: t2) => F[h1, h2] *: Map2[t1, t2, F]
case (EmptyTuple, EmptyTuple) => EmptyTuple
inline given productReader[In <: Product, Out <: Product](using mi: Mirror.ProductOf[In])(using mo: Mirror.ProductOf[Out]): Reader[In, Out] =
summonAll[Map2[mi.MirroredElemTypes, mo.MirroredElemTypes, Reader]]
???
object Test:
trait B[X] extends A:
type T = X
trait C extends A:
type F[X] = X
val bc = new B[Int] with C
summon[Reader[(bc.type, bc.type), (Int, Int)]] // fails
Output
Compiling project (Scala 3.3.0-RC3, JVM)
[error] .\fails.scala:35:49: No given instance of type Reader[(Test.bc : Test.B[Int] & Test.C), Int] was found.
[error] I found:
[error]
[error] Reader.productReader[In, Out](/* missing */summon[deriving.Mirror.ProductOf[In]]
[error] )
[error]
[error] But Failed to synthesize an instance of type deriving.Mirror.ProductOf[In]: class Nothing is not a generic product because it is not a case class.
[error] summon[Reader[(bc.type, bc.type), (Int, Int)]] // fails
[error] ^
Error compiling project (Scala 3.3.0-RC3, JVM)
Compilation failed
Expectation
Successful compilation