Skip to content

Commit

Permalink
Add failsafe for a case where prefixes in CheckUnused/prepareIndent f…
Browse files Browse the repository at this point in the history
…ormed an infinite cycle
  • Loading branch information
szymon-rd committed Mar 13, 2023
1 parent 247b2c7 commit cd36837
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions compiler/src/dotty/tools/dotc/transform/CheckUnused.scala
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class CheckUnused extends MiniPhase:
override def prepareForIdent(tree: tpd.Ident)(using Context): Context =
if tree.symbol.exists then
val prefixes = LazyList.iterate(tree.typeOpt.normalizedPrefix)(_.normalizedPrefix).takeWhile(_ != NoType)
.take(10) // Failsafe in the odd case if there were an infinite cycle
for {
prefix <- prefixes
} {
Expand Down

0 comments on commit cd36837

Please sign in to comment.