Skip to content

Commit

Permalink
Fix infinite loop in Mirror synthesis of unreducible match type
Browse files Browse the repository at this point in the history
This regressed in f7e2e7c (present in 3.4.0).
  • Loading branch information
smarter committed Apr 8, 2024
1 parent 133e709 commit 5d0c47a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/Synthesizer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +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 tp: MatchType => reduce(tp.tryNormalize.orElse(tp.superType))
case _ => reduce(tp.superType)
case tp @ AndType(l, r) =>
for
Expand Down
9 changes: 9 additions & 0 deletions tests/neg/i19198.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import deriving.Mirror
import compiletime.summonInline

type DoesNotReduce[T] = T match
case String => Any

class Foo
@main def Test: Unit =
summonInline[Mirror.Of[DoesNotReduce[Option[Int]]]] // error

0 comments on commit 5d0c47a

Please sign in to comment.