aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Implicits.scala
diff options
context:
space:
mode:
authorOlivier Blanvillain <olivier.blanvillain@gmail.com>2016-09-09 16:56:01 +0200
committerOlivier Blanvillain <olivier.blanvillain@gmail.com>2016-09-13 15:59:39 +0200
commitfe09615739dbc57ef068b4d04a2223ae0bb88eaa (patch)
tree899eb8aea1337673e9bb13c37939fce30df72d13 /src/dotty/tools/dotc/typer/Implicits.scala
parent75f4400a738da5e436ed65d6ba8c7fa2d8f4faee (diff)
downloaddotty-fe09615739dbc57ef068b4d04a2223ae0bb88eaa.tar.gz
dotty-fe09615739dbc57ef068b4d04a2223ae0bb88eaa.tar.bz2
dotty-fe09615739dbc57ef068b4d04a2223ae0bb88eaa.zip
Partially fix #1500: Implicit search breaks at a certain depth
The issue fixed here was introduced by 71027f15. The added `csyms.isEmpty` condition on `case nil =>` is always true, which is clearely a bug. t1500c still fails with covariant (or contravariant) type parameters on `::`, but this seams to be a more complicated issue involving the typer.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Implicits.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Implicits.scala9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/typer/Implicits.scala b/src/dotty/tools/dotc/typer/Implicits.scala
index 0a3307140..2a1c18f7d 100644
--- a/src/dotty/tools/dotc/typer/Implicits.scala
+++ b/src/dotty/tools/dotc/typer/Implicits.scala
@@ -801,14 +801,15 @@ class SearchHistory(val searchDepth: Int, val seen: Map[ClassSymbol, Int]) {
def updateMap(csyms: List[ClassSymbol], seen: Map[ClassSymbol, Int]): SearchHistory = csyms match {
case csym :: csyms1 =>
seen get csym match {
+ // proto complexity is >= than the last time it was seen → diverge
case Some(prevSize) if size >= prevSize => this
case _ => updateMap(csyms1, seen.updated(csym, size))
}
- case nil =>
- if (csyms.isEmpty) this
- else new SearchHistory(searchDepth + 1, seen)
+ case _ =>
+ new SearchHistory(searchDepth + 1, seen)
}
- updateMap(proto.classSymbols, seen)
+ if (proto.classSymbols.isEmpty) this
+ else updateMap(proto.classSymbols, seen)
}
}
}