From a049c82093c02c471e0cd44e9de916fd1c1c0724 Mon Sep 17 00:00:00 2001 From: Dmitry Petrashko Date: Fri, 24 Apr 2015 11:25:48 +0200 Subject: Fix two infinite cycles in transformAfter. if symbol is defining starting from this phase current.validFor.firstPhaseId < phase.id is always true. If additionally f changes the initial symbol, (current ne symbol.current) will always be true. Else if a symbol has a single denotation that spawns all periods, which is changed, second cycle becomes infinite. --- src/dotty/tools/dotc/core/Denotations.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/dotty/tools') diff --git a/src/dotty/tools/dotc/core/Denotations.scala b/src/dotty/tools/dotc/core/Denotations.scala index aa1442769..fc8bbc84f 100644 --- a/src/dotty/tools/dotc/core/Denotations.scala +++ b/src/dotty/tools/dotc/core/Denotations.scala @@ -637,9 +637,9 @@ object Denotations { */ protected def transformAfter(phase: DenotTransformer, f: SymDenotation => SymDenotation)(implicit ctx: Context): Unit = { var current = symbol.current - while (current.validFor.firstPhaseId < phase.id && (current ne symbol.current)) + while (current.validFor.firstPhaseId < phase.id && (current.nextInRun.validFor.code > current.validFor.code)) current = current.nextInRun - while (current.validFor.firstPhaseId >= phase.id) { + while ((current.validFor.firstPhaseId >= phase.id) && (current.nextInRun.validFor.code > current.validFor.code)) { val current1: SingleDenotation = f(current.asSymDenotation) if (current1 ne current) { current1.validFor = current.validFor @@ -648,7 +648,7 @@ object Denotations { current = current.nextInRun } } - + private def replaceDenotation(current: SingleDenotation): Unit = { var prev = current while (prev.nextInRun ne current) prev = prev.nextInRun -- cgit v1.2.3