Skip to content

Commit

Permalink
stripTypeVars after fullyDefinedType
Browse files Browse the repository at this point in the history
  • Loading branch information
bishabosha committed Aug 3, 2022
1 parent 9ec5e3d commit 9a9c40d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
4 changes: 3 additions & 1 deletion compiler/src/dotty/tools/dotc/typer/Synthesizer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
19 changes: 19 additions & 0 deletions tests/run/i13146poly.scala
Original file line number Diff line number Diff line change
@@ -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 = ()

0 comments on commit 9a9c40d

Please sign in to comment.