diff --git a/compiler/src/dotty/tools/dotc/typer/Synthesizer.scala b/compiler/src/dotty/tools/dotc/typer/Synthesizer.scala index 67853001d8f0..c94724faf4d4 100644 --- a/compiler/src/dotty/tools/dotc/typer/Synthesizer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Synthesizer.scala @@ -379,6 +379,7 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context): // avoid type aliases for tuples Right(MirrorSource.GenericTuple(types)) case _ => reduce(tp.underlying) + case tp: MatchType => reduce(tp.normalized) case _ => reduce(tp.superType) case tp @ AndType(l, r) => for diff --git a/tests/pos/i19198.scala b/tests/pos/i19198.scala new file mode 100644 index 000000000000..23550aac807f --- /dev/null +++ b/tests/pos/i19198.scala @@ -0,0 +1,13 @@ +import deriving.Mirror +import compiletime.summonInline + +inline def check1[Tps <: NonEmptyTuple]: Unit = + summonInline[Mirror.Of[Tuple.Head[Tps]]] + +inline def check2[Tps <: NonEmptyTuple]: Unit = + type FromType = Tuple.Head[Tps] + summonInline[Mirror.Of[FromType]] + +@main def Test: Unit = + check1[Option[Int] *: EmptyTuple] // Ok + check2[Option[Int] *: EmptyTuple] // Error: FromType is widened to Any in Syntheziser