aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Periods.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-07-10 14:48:42 +0200
committerMartin Odersky <odersky@gmail.com>2014-07-17 11:02:01 +0200
commit34202eb4e13921190bf4992ab33d9d69975f4940 (patch)
treef601215270c4fb45e398f5ac4465142779eee007 /src/dotty/tools/dotc/core/Periods.scala
parentcd82c859bb2fe05de257cbc81e97bedd2bbf2a4a (diff)
downloaddotty-34202eb4e13921190bf4992ab33d9d69975f4940.tar.gz
dotty-34202eb4e13921190bf4992ab33d9d69975f4940.tar.bz2
dotty-34202eb4e13921190bf4992ab33d9d69975f4940.zip
Avoid some classes of StaleSymbol errors
If a symbol is defined in phases M..N, and that symbol is then accessed in a phase before M, but in a new run, we should not issue a stale symbol error (after all, the symbol is not defined yet). Instead we now return a NoDenotation.
Diffstat (limited to 'src/dotty/tools/dotc/core/Periods.scala')
-rw-r--r--src/dotty/tools/dotc/core/Periods.scala7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/Periods.scala b/src/dotty/tools/dotc/core/Periods.scala
index 4ab04fad0..e0d9e3b5d 100644
--- a/src/dotty/tools/dotc/core/Periods.scala
+++ b/src/dotty/tools/dotc/core/Periods.scala
@@ -67,6 +67,8 @@ object Periods {
/** The first phase of this period */
def firstPhaseId = lastPhaseId - (code & PhaseMask)
+ def containsPhaseId(id: PhaseId) = firstPhaseId <= id && id <= lastPhaseId
+
/** Does this period contain given period? */
def contains(that: Period): Boolean = {
// Let this = (r1, l1, d1), that = (r2, l2, d2)
@@ -106,6 +108,11 @@ object Periods {
else
Nowhere
+ def | (that: Period): Period =
+ Period(this.runId,
+ this.firstPhaseId min that.firstPhaseId,
+ this.lastPhaseId max that.lastPhaseId)
+
override def toString = s"Period($firstPhaseId..$lastPhaseId, run = $runId)"
}