Skip to content

Commit f7726a6

Browse files
Backport "Normalise mirrorType for mirror Synthesis" to LTS (#20796)
Backports #19199 to the LTS branch. PR submitted by the release tooling. [skip ci]
2 parents 48039dd + 4f488c8 commit f7726a6

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
378378
// avoid type aliases for tuples
379379
Right(MirrorSource.GenericTuple(types))
380380
case _ => reduce(tp.underlying)
381+
case tp: MatchType => reduce(tp.normalized)
381382
case _ => reduce(tp.superType)
382383
case tp @ AndType(l, r) =>
383384
for

tests/pos/i19198.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import deriving.Mirror
2+
import compiletime.summonInline
3+
4+
inline def check1[Tps <: NonEmptyTuple]: Unit =
5+
summonInline[Mirror.Of[Tuple.Head[Tps]]]
6+
7+
inline def check2[Tps <: NonEmptyTuple]: Unit =
8+
type FromType = Tuple.Head[Tps]
9+
summonInline[Mirror.Of[FromType]]
10+
11+
@main def Test: Unit =
12+
check1[Option[Int] *: EmptyTuple] // Ok
13+
check2[Option[Int] *: EmptyTuple] // Error: FromType is widened to Any in Syntheziser

0 commit comments

Comments
 (0)