Skip to content

Commit cd36837

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

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

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

+1
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 in the odd case if there were an infinite cycle
8182
for {
8283
prefix <- prefixes
8384
} {

0 commit comments

Comments
 (0)