Skip to content

Commit 9a9c40d

Browse files
committed
stripTypeVars after fullyDefinedType
1 parent 9ec5e3d commit 9a9c40d

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

compiler/src/dotty/tools/dotc/typer/Synthesizer.scala

+3-1
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,9 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
541541
if checkFormal(formal) then
542542
formal.member(tpnme.MirroredType).info match
543543
case TypeBounds(mirroredType, _) =>
544-
synth(fullyDefinedType(mirroredType, "Mirror.*Of argument", ctx.source.atSpan(span)), formal, span)
544+
val defined = fullyDefinedType(mirroredType, "Mirror.*Of argument", ctx.source.atSpan(span))
545+
val stripped = TypeOps.stripTypeVars(defined)
546+
synth(stripped, formal, span)
545547
case other => EmptyTreeNoError
546548
else EmptyTreeNoError
547549

tests/run/i13146poly.scala

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import scala.deriving.*
2+
3+
trait Functor[F[_]]
4+
5+
object Functor:
6+
given [C]: Functor[[T] =>> C]()
7+
given Functor[[T] =>> Tuple1[T]]()
8+
given t2 [T]: Functor[[U] =>> (T, U)]()
9+
given t3 [T, U]: Functor[[V] =>> (T, U, V)]()
10+
11+
def derived[F[_]](using m: Mirror { type MirroredType[X] = F[X] ; type MirroredElemTypes[_] }, r: Functor[m.MirroredElemTypes]): Functor[F] = new Functor[F] {}
12+
13+
case class Mono(i: Int) derives Functor
14+
case class Poly[A](a: A) derives Functor
15+
//case class Poly11[F[_]](fi: F[Int]) derives Functor
16+
case class Poly2[A, B](a: A, b: B) derives Functor
17+
case class Poly3[A, B, C](a: A, b: B, c: C) derives Functor
18+
19+
@main def Test = ()

0 commit comments

Comments
 (0)