diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2010-09-14 12:11:54 +0000 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2010-09-14 12:11:54 +0000 |
commit | 4c47e9435d8872a30f579ed451293d4772b95c31 (patch) | |
tree | ef6b15a99abca671750bc478a2f6c8257a10d369 /src/compiler | |
parent | c40a798bf0b9ebe26385d42dbd90edc61ca0896d (diff) | |
download | scala-4c47e9435d8872a30f579ed451293d4772b95c31.tar.gz scala-4c47e9435d8872a30f579ed451293d4772b95c31.tar.bz2 scala-4c47e9435d8872a30f579ed451293d4772b95c31.zip |
relax implicit divergence check
patch contributed by Mark Harrah in
http://article.gmane.org/gmane.comp.lang.scala/20700
reviewed by moors and odersky
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Contexts.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Implicits.scala | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index 42c1329edf..28c4b67db9 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala @@ -102,7 +102,7 @@ trait Contexts { self: Analyzer => // not inherited to child contexts var depth: Int = 0 var imports: List[ImportInfo] = List() // currently visible imports - var openImplicits: List[Type] = List() // types for which implicit arguments + var openImplicits: List[(Type,Symbol)] = List() // types for which implicit arguments // are currently searched // for a named application block (Tree) the corresponding NamedApplyInfo var namedApplyBlockInfo: Option[(Tree, NamedApplyInfo)] = None diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala index 63b971d2fd..adcae7d9b1 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala @@ -344,14 +344,14 @@ self: Analyzer => * @pre <code>info.tpe</code> does not contain an error */ private def typedImplicit(info: ImplicitInfo): SearchResult = - context.openImplicits find (dominates(pt, _)) match { + (context.openImplicits find { case (tp, sym) => sym == tree.symbol && dominates(pt, tp)}) match { case Some(pending) => // println("Pending implicit "+pending+" dominates "+pt+"/"+undetParams) //@MDEBUG throw DivergentImplicit SearchFailure case None => try { - context.openImplicits = pt :: context.openImplicits + context.openImplicits = (pt, tree.symbol) :: context.openImplicits // println(" "*context.openImplicits.length+"typed implicit "+info+" for "+pt) //@MDEBUG typedImplicit0(info) } catch { |