diff options
author | Martin Odersky <odersky@gmail.com> | 2014-07-08 14:21:45 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-07-17 11:02:00 +0200 |
commit | 8b1e58ffb847706cada8fc5834c5ac6bcfcd8421 (patch) | |
tree | 49bc5918ff0ef91382f825dcd5f03894ba978c3e | |
parent | 3eabbb77c8f8bd3e08b39e5335e8a67e2d68e659 (diff) | |
download | dotty-8b1e58ffb847706cada8fc5834c5ac6bcfcd8421.tar.gz dotty-8b1e58ffb847706cada8fc5834c5ac6bcfcd8421.tar.bz2 dotty-8b1e58ffb847706cada8fc5834c5ac6bcfcd8421.zip |
Add definedPeriodsString method for disgnostics.
-rw-r--r-- | src/dotty/tools/dotc/core/Denotations.scala | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/src/dotty/tools/dotc/core/Denotations.scala b/src/dotty/tools/dotc/core/Denotations.scala index 82ee6560d..a2c8af886 100644 --- a/src/dotty/tools/dotc/core/Denotations.scala +++ b/src/dotty/tools/dotc/core/Denotations.scala @@ -570,31 +570,14 @@ object Denotations { //println(s"searching: $cur at $currentPeriod, valid for ${cur.validFor}") cur = cur.nextInRun cnt += 1 - if (cnt > MaxPossiblePhaseId) { - println(s"seems to be a loop in Denotations for $this, currentPeriod = $currentPeriod") - printPeriods(this) - assert(false) - } + assert(cnt <= MaxPossiblePhaseId, + s"demanding denotation of $this outside defined interval: defined periods are${definedPeriodsString}") } cur } - } } - private def printPeriods(current: SingleDenotation): Unit = { - print(s"periods for $this:") - var cur = current - var cnt = 0 - do { - print(" " + cur.validFor) - cur = cur.nextInRun - cnt += 1 - if (cnt > MaxPossiblePhaseId) { println(" ..."); return } - } while (cur ne current) - println() - } - /** Install this denotation to be the result of the given denotation transformer. * This is the implementation of the same-named method in SymDenotations. * It's placed here because it needs access to private fields of SingleDenotation. @@ -643,6 +626,20 @@ object Denotations { if (symbol == NoSymbol) symbol.toString else s"<SingleDenotation of type $infoOrCompleter>" + + def definedPeriodsString: String = { + var sb = new StringBuilder() + var cur = this + var cnt = 0 + do { + sb.append(" " + cur.validFor) + cur = cur.nextInRun + cnt += 1 + if (cnt > MaxPossiblePhaseId) { sb.append(" ..."); cur = this } + } while (cur ne this) + sb.toString + } + // ------ PreDenotation ops ---------------------------------------------- final def first = this |