aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/src/dotty/tools')
-rw-r--r--compiler/src/dotty/tools/dotc/core/Phases.scala5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/Phases.scala b/compiler/src/dotty/tools/dotc/core/Phases.scala
index 222e2235d..6a53e1b30 100644
--- a/compiler/src/dotty/tools/dotc/core/Phases.scala
+++ b/compiler/src/dotty/tools/dotc/core/Phases.scala
@@ -26,7 +26,10 @@ trait Phases {
def phasesStack: List[Phase] =
if ((this eq NoContext) || !phase.exists) Nil
- else phase :: outersIterator.dropWhile(_.phase == phase).next.phasesStack
+ else {
+ val rest = outersIterator.dropWhile(_.phase == phase)
+ phase :: (if (rest.hasNext) rest.next.phasesStack else Nil)
+ }
/** Execute `op` at given phase */
def atPhase[T](phase: Phase)(op: Context => T): T =