diff options
author | odersky <odersky@gmail.com> | 2017-01-16 19:15:03 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-16 19:15:03 +1100 |
commit | 6a95fef182f23a610a4e80dfd9bfcbf23364f0ee (patch) | |
tree | 531fc435a8a232016d41a2c171fde31d90863f9e /compiler/src/dotty/tools | |
parent | 2c229a696b87911d1de9c5cb18d73fae2eee848a (diff) | |
parent | dc32420a424c04b7acb69cc30509a757e0d0b7a4 (diff) | |
download | dotty-6a95fef182f23a610a4e80dfd9bfcbf23364f0ee.tar.gz dotty-6a95fef182f23a610a4e80dfd9bfcbf23364f0ee.tar.bz2 dotty-6a95fef182f23a610a4e80dfd9bfcbf23364f0ee.zip |
Merge pull request #1904 from dotty-staging/fix-npe-implicits
Fix another NPE when compiling under -Yno-imports
Diffstat (limited to 'compiler/src/dotty/tools')
-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 } } |