summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2009-11-09 20:10:22 +0000
committerAdriaan Moors <adriaan.moors@epfl.ch>2009-11-09 20:10:22 +0000
commitcedd41ba4a14f7f1595057edfeca5437ef674bc3 (patch)
treea1e00f4a9a9c375d65688521f5d00396dc47b0f4 /src/compiler/scala/tools/nsc/typechecker/Implicits.scala
parent7da30bf2d5195d1e7a156680b50167707f7a3d0a (diff)
downloadscala-cedd41ba4a14f7f1595057edfeca5437ef674bc3.tar.gz
scala-cedd41ba4a14f7f1595057edfeca5437ef674bc3.tar.bz2
scala-cedd41ba4a14f7f1595057edfeca5437ef674bc3.zip
fixed bug in implicit resolution that only mani...
fixed bug in implicit resolution that only manifested itself when multiple implicit arguments needed to be resolved and they were intended to instantiate type parameters two problems: - type parameters that could not be inferred where removed from undetparams erroneously - the successfully inferred parameters were not propagated to the the implicit arguments on the right (implicit resolution searches for implicit arguments from left to right, fixing type parameters in the process) this should give the green light for the addition of Zipped to TupleN
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Implicits.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Implicits.scala12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
index 75a6796be6..18831600b7 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
@@ -431,10 +431,16 @@ self: Analyzer =>
val targs = solvedTypes(tvars, undetParams, undetParams map varianceInType(pt),
false, lubDepth(List(itree2.tpe, pt)))
checkBounds(itree2.pos, NoPrefix, NoSymbol, undetParams, targs, "inferred ") // #2421
- val subst = new TreeTypeSubstituter(undetParams, targs)
+
+ // filter out failures from type inference, don't want to remove them from undetParams!
+ val uninstantiated = new ListBuffer[Symbol]
+ val detargs = adjustTypeArgs(undetParams, targs, pt, uninstantiated)
+ val (okParams, okArgs) = (undetParams zip detargs) filter {case (p, a) => !uninstantiated.contains(p)} unzip
+ // TODO: optimise above line(s?) once `zipped filter` works (oh, the irony! this line is needed to get Zipped to type check...)
+
+ val subst = new TreeTypeSubstituter(okParams, okArgs)
subst traverse itree2
- // todo: remove type params that have been instantiated to Nothing, similar
- // to methTypeArgs
+
val result = new SearchResult(itree2, subst)
if (traceImplicits) println("RESULT = "+result)
// println("RESULT = "+itree+"///"+itree1+"///"+itree2)//DEBUG