summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
diff options
context:
space:
mode:
authorHubert Plociniczak <hubert.plociniczak@gmail.com>2013-04-23 22:22:25 +0200
committerHubert Plociniczak <hubert.plociniczak@gmail.com>2013-04-26 16:20:38 +0200
commit71581425746e9d3239998569d6f85c710efbf17b (patch)
treebf243f80f644cd49f1c10050dff831845fcceb47 /src/compiler/scala/tools/nsc/typechecker/Implicits.scala
parentaccaa314f3473553d9ffaff8c37e3c5b29f0f2e3 (diff)
downloadscala-71581425746e9d3239998569d6f85c710efbf17b.tar.gz
scala-71581425746e9d3239998569d6f85c710efbf17b.tar.bz2
scala-71581425746e9d3239998569d6f85c710efbf17b.zip
SI-7291: Remove error kinds.
What seemed like a good idea initially (since potentially there were many different kinds of errors that could be treated specially), started to complicate the error logic. So let's just match on the specific instance of an error to manipulate the buffer.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Implicits.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Implicits.scala15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
index 59ed64ac03..875aa5a9d3 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
@@ -81,7 +81,10 @@ trait Implicits {
val implicitSearchContext = context.makeImplicit(reportAmbiguous)
val result = new ImplicitSearch(tree, pt, isView, implicitSearchContext, pos).bestImplicit
if (result.isFailure && saveAmbiguousDivergent && implicitSearchContext.hasErrors) {
- context.updateBuffer(implicitSearchContext.reportBuffer.errors.filter(err => err.kind == ErrorKinds.Ambiguous || err.kind == ErrorKinds.Divergent))
+ context.updateBuffer(implicitSearchContext.reportBuffer.errors.collect {
+ case dte: DivergentImplicitTypeError => dte
+ case ate: AmbiguousImplicitTypeError => ate
+ })
debuglog("update buffer: " + implicitSearchContext.reportBuffer.errors)
}
printInference("[infer implicit] inferred " + result)
@@ -590,7 +593,7 @@ trait Implicits {
case Some(err) =>
log("implicit adapt failed: " + err.errMsg)
return fail(err.errMsg)
- case None =>
+ case None =>
}
if (Statistics.canEnable) Statistics.incCounter(typedImplicits)
@@ -639,7 +642,7 @@ trait Implicits {
context.firstError match {
case Some(err) =>
return fail("type parameters weren't correctly instantiated outside of the implicit tree: " + err.errMsg)
- case None =>
+ case None =>
}
// filter out failures from type inference, don't want to remove them from undetParams!
@@ -678,7 +681,7 @@ trait Implicits {
context.firstError match {
case Some(err) =>
fail("typing TypeApply reported errors for the implicit tree: " + err.errMsg)
- case None =>
+ case None =>
val result = new SearchResult(itree2, subst)
if (Statistics.canEnable) Statistics.incCounter(foundImplicits)
printInference("[success] found %s for pt %s".format(result, ptInstantiated))
@@ -839,7 +842,9 @@ trait Implicits {
case sr if sr.isFailure =>
// We don't want errors that occur during checking implicit info
// to influence the check of further infos.
- context.reportBuffer.retainErrors(ErrorKinds.Divergent)
+ context.reportBuffer.retainErrors {
+ case err: DivergentImplicitTypeError => true
+ }
rankImplicits(is, acc)
case newBest =>
best = newBest