Skip to content

Commit e847e5a

Browse files
Fix #8905: break cycles in instantiateToSubType
Because MatchAliases are bounds, it's unsafe to do a traversal that recursively inspects bounds. It's kind of a pit fall...
1 parent af37d64 commit e847e5a

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

compiler/src/dotty/tools/dotc/core/TypeOps.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,9 @@ object TypeOps:
641641
if (maximize) lo else hi
642642

643643
def apply(tp: Type): Type = tp match {
644+
case _: MatchType =>
645+
tp // break cycles
646+
644647
case tp: TypeRef if isBounds(tp.underlying) =>
645648
val lo = this(tp.info.loBound)
646649
val hi = this(tp.info.hiBound)

tests/pos/8905.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
object Test {
2+
def f[T1 <: Tuple](o: Option[Tuple.Concat[T1, T1]]): Unit =
3+
o match { case Some(x) => }
4+
}

0 commit comments

Comments
 (0)