File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
src/compiler/scala/tools/nsc/typechecker Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -996,11 +996,15 @@ trait Implicits {
996996 if (divergence || DivergentImplicitRecovery .sym != null ) {
997997 if (settings.Xdivergence211 .value) DivergingImplicitExpansionError (tree, pt, DivergentImplicitRecovery .sym)(context)
998998 else throw DivergentImplicit
999- } else invalidImplicits take 1 foreach { sym =>
1000- def isSensibleAddendum = pt match {
999+ }
1000+ else if (invalidImplicits.nonEmpty) {
1001+ val sym = invalidImplicits.head
1002+ // We don't even dare look if errors are being buffered
1003+ // !sym.hasFlag(LOCKED) is a hail mary between SI-2206 and SI-7486
1004+ def isSensibleAddendum = ! sym.hasFlag(LOCKED ) && (pt match {
10011005 case Function1 (_, out) => out <:< sym.tpe.finalResultType
10021006 case _ => pt <:< sym.tpe.finalResultType
1003- }
1007+ })
10041008 // Don't pitch in with this theory unless it looks plausible that the
10051009 // implicit would have helped
10061010 setAddendum(pos, () =>
Original file line number Diff line number Diff line change 1+ object Test {
2+ var locker = 0
3+ // remove implicit, or change to `locker = locker + 1` to make it compile.
4+ implicit val davyJones0 = {
5+ locker += 0
6+ 0
7+ }
8+ }
You can’t perform that action at this time.
0 commit comments