Skip to content
Browse files

Refactor: keep DivergentImplicitRecovery logic together.

  • Loading branch information...
1 parent 1c330e6 commit d345424ecc32d7e077ebc2172e0c0cc4e338ed10 @adriaanm adriaanm committed Apr 1, 2014
Showing with 12 additions and 12 deletions.
  1. +12 −12 src/compiler/scala/tools/nsc/typechecker/Implicits.scala
View
24 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

0 comments on commit d345424

Please sign in to comment.
Something went wrong with that request. Please try again.