summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Typers.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/Typers.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/Typers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 619f5324be..50627268c8 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -172,7 +172,19 @@ trait Typers { self: Analyzer =>
def applyImplicitArgs(fun: Tree): Tree = fun.tpe match {
case MethodType(params, _) =>
var positional = true
- val argResults = params map (p => inferImplicit(fun, p.tpe, true, false, context))
+ val argResultsBuff = new ListBuffer[SearchResult]()
+
+ // apply the substitutions (undet type param -> type) that were determined
+ // by implicit resolution of implicit arguments on the left of this argument
+ for(param <- params) {
+ var paramTp = param.tpe
+ for(ar <- argResultsBuff)
+ paramTp = paramTp.subst(ar.subst.from, ar.subst.to)
+
+ argResultsBuff += inferImplicit(fun, paramTp, true, false, context)
+ }
+
+ val argResults = argResultsBuff.toList
val args = argResults.zip(params) flatMap {
case (arg, param) =>
if (arg != SearchFailure) {