aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Implicits.scala18
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
}
}