Skip to content

Commit 7f5aa62

Browse files
committed
Add failsafe for a case where prefixes in CheckUnused/prepareIndent formed an infinite cycle
1 parent 247b2c7 commit 7f5aa62

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

compiler/src/dotty/tools/dotc/transform/CheckUnused.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ class CheckUnused extends MiniPhase:
7878
override def prepareForIdent(tree: tpd.Ident)(using Context): Context =
7979
if tree.symbol.exists then
8080
val prefixes = LazyList.iterate(tree.typeOpt.normalizedPrefix)(_.normalizedPrefix).takeWhile(_ != NoType)
81+
.take(10) // Failsafe for the odd case if there was an infinite cycle
8182
for {
8283
prefix <- prefixes
8384
} {

0 commit comments

Comments
 (0)