diff options
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Implicits.scala | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala index 4acda12dc0..37257b4f4e 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala @@ -929,11 +929,15 @@ trait Implicits { */ if (DivergentImplicitRecovery.sym != null) { DivergingImplicitExpansionError(tree, pt, DivergentImplicitRecovery.sym)(context) - } else invalidImplicits take 1 foreach { sym => - def isSensibleAddendum = pt match { + } + else if (invalidImplicits.nonEmpty) { + val sym = invalidImplicits.head + // We don't even dare look if errors are being buffered + // !sym.hasFlag(LOCKED) is a hail mary between SI-2206 and SI-7486 + def isSensibleAddendum = !sym.hasFlag(LOCKED) && (pt match { case Function1(_, out) => out <:< sym.tpe.finalResultType case _ => pt <:< sym.tpe.finalResultType - } + }) // Don't pitch in with this theory unless it looks plausible that the // implicit would have helped setAddendum(pos, () => |