aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Implicits.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-10-24 00:05:57 +0200
committerMartin Odersky <odersky@gmail.com>2013-10-24 00:05:57 +0200
commit935c90b1fbffb7c0b3e851a98f8b1ee441b7fb34 (patch)
tree57c1d5e3c0e9dfc423581b9058053624fbf2fe39 /src/dotty/tools/dotc/typer/Implicits.scala
parent6f4f941d09d11e9e44e1b46e1ec84da40eb399b6 (diff)
downloaddotty-935c90b1fbffb7c0b3e851a98f8b1ee441b7fb34.tar.gz
dotty-935c90b1fbffb7c0b3e851a98f8b1ee441b7fb34.tar.bz2
dotty-935c90b1fbffb7c0b3e851a98f8b1ee441b7fb34.zip
Small cleanups, plus a new test case.
map on collections now works, including associated CanBuildFrom searches.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Implicits.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Implicits.scala14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/dotty/tools/dotc/typer/Implicits.scala b/src/dotty/tools/dotc/typer/Implicits.scala
index 86dea0725..2356d4b46 100644
--- a/src/dotty/tools/dotc/typer/Implicits.scala
+++ b/src/dotty/tools/dotc/typer/Implicits.scala
@@ -42,15 +42,7 @@ object Implicits {
/** Return those references in `refs` that are compatible with type `pt`. */
protected def filterMatching(pt: Type)(implicit ctx: Context): List[TermRef] = track("filterMatching") {
def result(implicit ctx: Context) = {
- def refMatches(ref: TermRef) = ctx.traceIndented(i"refMatches ${ref.symbol}, ref = $ref, normalze = ${normalize(ref)}, pt = $pt") {
- if (ref.name.toString == "canBuildFrom") {
- val r = normalize(ref)
- println(s"r = $r, pt = $pt")
- println(TypeComparer.explained(implicit ctx => r <:< pt))
- throw new Error()
- }
- isCompatible(normalize(ref), pt)
- }
+ def refMatches(ref: TermRef) = isCompatible(normalize(ref), pt)
refs filter refMatches
}
result(ctx.fresh.withExploreTyperState) // create a defensive copy of ctx to avoid constraint pollution
@@ -321,7 +313,7 @@ trait Implicits { self: Typer =>
case fail: SearchFailure =>
rankImplicits(pending1, acc)
case best: SearchSuccess =>
- val newPending = pending1 filterNot (isAsGood(_, best.ref)(nestedContext.withExploreTyperState))
+ val newPending = pending1 filter (isAsGood(_, best.ref)(nestedContext.withExploreTyperState))
rankImplicits(newPending, best :: acc)
}
case nil => acc
@@ -353,6 +345,8 @@ trait Implicits { self: Typer =>
case _ => eligible.sortBy(-ctx.runInfo.useCount(_))
}
+ println(i"eligible: ${sort(eligible)}")
+
condense(rankImplicits(sort(eligible), Nil))
}