diff options
author | Martin Odersky <odersky@gmail.com> | 2017-01-16 16:32:15 +1100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2017-01-16 16:32:15 +1100 |
commit | dc32420a424c04b7acb69cc30509a757e0d0b7a4 (patch) | |
tree | db1984cb7fa4688b770d235ecad565b1539e34bb /compiler | |
parent | 871de839c1dad025e2a0afb525b2e868b28048b1 (diff) | |
download | dotty-dc32420a424c04b7acb69cc30509a757e0d0b7a4.tar.gz dotty-dc32420a424c04b7acb69cc30509a757e0d0b7a4.tar.bz2 dotty-dc32420a424c04b7acb69cc30509a757e0d0b7a4.zip |
Fix another NPE when compiling under -Yno-imports
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/src/dotty/tools/dotc/typer/Implicits.scala | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/Implicits.scala b/compiler/src/dotty/tools/dotc/typer/Implicits.scala index 4ebc676ba..592e80048 100644 --- a/compiler/src/dotty/tools/dotc/typer/Implicits.scala +++ b/compiler/src/dotty/tools/dotc/typer/Implicits.scala @@ -176,15 +176,17 @@ object Implicits { if (monitored) record(s"elided eligible refs", elided(this)) eligibles case None => - val savedEphemeral = ctx.typerState.ephemeral - ctx.typerState.ephemeral = false - try { - val result = computeEligible(tp) - if (ctx.typerState.ephemeral) record("ephemeral cache miss: eligible") - else eligibleCache(tp) = result - result + if (ctx eq NoContext) Nil + else { + val savedEphemeral = ctx.typerState.ephemeral + ctx.typerState.ephemeral = false + try { + val result = computeEligible(tp) + if (ctx.typerState.ephemeral) record("ephemeral cache miss: eligible") + else eligibleCache(tp) = result + result + } finally ctx.typerState.ephemeral |= savedEphemeral } - finally ctx.typerState.ephemeral |= savedEphemeral } } |