aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Denotations.scala
diff options
context:
space:
mode:
authorDmitry Petrashko <dmitry.petrashko@gmail.com>2015-04-24 11:25:48 +0200
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2015-04-30 14:26:06 +0200
commita049c82093c02c471e0cd44e9de916fd1c1c0724 (patch)
tree5c00a9da34fc3e5ddc8d27434d9b55fd30061432 /src/dotty/tools/dotc/core/Denotations.scala
parentcf4ee1dda912125f19a891062112e2c71b7fc907 (diff)
downloaddotty-a049c82093c02c471e0cd44e9de916fd1c1c0724.tar.gz
dotty-a049c82093c02c471e0cd44e9de916fd1c1c0724.tar.bz2
dotty-a049c82093c02c471e0cd44e9de916fd1c1c0724.zip
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.
Diffstat (limited to 'src/dotty/tools/dotc/core/Denotations.scala')
-rw-r--r--src/dotty/tools/dotc/core/Denotations.scala6
1 files changed, 3 insertions, 3 deletions
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