Skip to content

Commit c278af7

Browse files
smarterWojciechMazur
authored andcommitted
Fix infinite loop in Mirror synthesis of unreducible match type
This regressed in f7e2e7c (present in 3.4.0). [Cherry-picked 5d0c47a]
1 parent acda88c commit c278af7

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -378,7 +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)
381+
case tp: MatchType => reduce(tp.tryNormalize.orElse(tp.superType))
382382
case _ => reduce(tp.superType)
383383
case tp @ AndType(l, r) =>
384384
for

tests/neg/i19198.scala

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import deriving.Mirror
2+
import compiletime.summonInline
3+
4+
type DoesNotReduce[T] = T match
5+
case String => Any
6+
7+
class Foo
8+
@main def Test: Unit =
9+
summonInline[Mirror.Of[DoesNotReduce[Option[Int]]]] // error

0 commit comments

Comments
 (0)