diff --git a/compiler/src/dotty/tools/dotc/typer/Synthesizer.scala b/compiler/src/dotty/tools/dotc/typer/Synthesizer.scala index b20b6f10ed7f..f3098cfd673f 100644 --- a/compiler/src/dotty/tools/dotc/typer/Synthesizer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Synthesizer.scala @@ -541,7 +541,9 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context): if checkFormal(formal) then formal.member(tpnme.MirroredType).info match case TypeBounds(mirroredType, _) => - synth(fullyDefinedType(mirroredType, "Mirror.*Of argument", ctx.source.atSpan(span)), formal, span) + val defined = fullyDefinedType(mirroredType, "Mirror.*Of argument", ctx.source.atSpan(span)) + val stripped = TypeOps.stripTypeVars(defined) + synth(stripped, formal, span) case other => EmptyTreeNoError else EmptyTreeNoError diff --git a/tests/run/i13146poly.scala b/tests/run/i13146poly.scala new file mode 100644 index 000000000000..849f4dc7eb52 --- /dev/null +++ b/tests/run/i13146poly.scala @@ -0,0 +1,19 @@ +import scala.deriving.* + +trait Functor[F[_]] + +object Functor: + given [C]: Functor[[T] =>> C]() + given Functor[[T] =>> Tuple1[T]]() + given t2 [T]: Functor[[U] =>> (T, U)]() + given t3 [T, U]: Functor[[V] =>> (T, U, V)]() + + def derived[F[_]](using m: Mirror { type MirroredType[X] = F[X] ; type MirroredElemTypes[_] }, r: Functor[m.MirroredElemTypes]): Functor[F] = new Functor[F] {} + +case class Mono(i: Int) derives Functor +case class Poly[A](a: A) derives Functor +//case class Poly11[F[_]](fi: F[Int]) derives Functor +case class Poly2[A, B](a: A, b: B) derives Functor +case class Poly3[A, B, C](a: A, b: B, c: C) derives Functor + +@main def Test = ()