diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-04-01 10:22:20 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-04-01 10:26:07 -0700 |
commit | d345424ecc32d7e077ebc2172e0c0cc4e338ed10 (patch) | |
tree | 8980f2b62906f5d364959ae456a0d370fd583ea0 | |
parent | 1c330e67c837ab56b208ebf827ac422b21818824 (diff) | |
download | scala-d345424ecc32d7e077ebc2172e0c0cc4e338ed10.tar.gz scala-d345424ecc32d7e077ebc2172e0c0cc4e338ed10.tar.bz2 scala-d345424ecc32d7e077ebc2172e0c0cc4e338ed10.zip |
Refactor: keep DivergentImplicitRecovery logic together.
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Implicits.scala | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala index 0538dfec7e..976581f8f4 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala @@ -839,13 +839,6 @@ trait Implicits { if (divergentError.isEmpty) divergentError = Some(err) } - def retainRemainingDivergentErrors() = { - val saved = divergentError.getOrElse(null) - context.reportBuffer.retainErrors { - case err: DivergentImplicitTypeError => err ne saved - } - } - def issueSavedDivergentError() { divergentError foreach (err => context.issue(err)) } @@ -862,7 +855,18 @@ trait Implicits { saveDivergent(DivergentImplicitTypeError(tree, pt, i.sym)) log(s"discarding divergent implicit ${i.sym} during implicit search") SearchFailure - } else search + } else { + if (search.isFailure) { + // We don't want errors that occur during checking implicit info + // to influence the check of further infos, but we should retain divergent implicit errors + // (except for the one we already squirreled away) + val saved = divergentError.getOrElse(null) + context.reportBuffer.retainErrors { + case err: DivergentImplicitTypeError => err ne saved + } + } + search + } } } @@ -898,10 +902,6 @@ trait Implicits { case sr if sr.isDivergent => Nil case sr if sr.isFailure => - // We don't want errors that occur during checking implicit info - // to influence the check of further infos, but we should retain divergent implicit errors - // (except for the one we already squirreled away) - DivergentImplicitRecovery.retainRemainingDivergentErrors() rankImplicits(is, acc) case newBest => best = newBest |