summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2010-01-13 15:44:11 +0000
committerAdriaan Moors <adriaan.moors@epfl.ch>2010-01-13 15:44:11 +0000
commit28c75a82ea610fb5a61e53c0a031c2d64a399af5 (patch)
tree55a6f6aa47b7c51761753b42cda30919666645b0 /src/compiler/scala/tools/nsc/typechecker/Implicits.scala
parent4f2bcd1af4fc12765aea7975a97357274087d392 (diff)
downloadscala-28c75a82ea610fb5a61e53c0a031c2d64a399af5.tar.gz
scala-28c75a82ea610fb5a61e53c0a031c2d64a399af5.tar.bz2
scala-28c75a82ea610fb5a61e53c0a031c2d64a399af5.zip
closes #2421: more complete fix, now also check...
closes #2421: more complete fix, now also check validity of inferred type arguments for expressions inferred for implicit values review by odersky
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Implicits.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Implicits.scala9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
index 9657cea101..c4464010c1 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
@@ -459,7 +459,9 @@ self: Analyzer =>
if (traceImplicits) println("tvars = "+tvars+"/"+(tvars map (_.constr)))
val targs = solvedTypes(tvars, undetParams, undetParams map varianceInType(pt),
false, lubDepth(List(itree2.tpe, pt)))
- checkBounds(itree2.pos, NoPrefix, NoSymbol, undetParams, targs, "inferred ") // #2421
+
+ // #2421: check that we correctly instantiated type parameters outside of the implicit tree:
+ checkBounds(itree2.pos, NoPrefix, NoSymbol, undetParams, targs, "inferred ")
// filter out failures from type inference, don't want to remove them from undetParams!
// we must be conservative in leaving type params in undetparams
@@ -472,6 +474,11 @@ self: Analyzer =>
val subst = new TreeTypeSubstituter(okParams, okArgs)
subst traverse itree2
+ // #2421b: since type inference (which may have been performed during implicit search)
+ // does not check whether inferred arguments meet the bounds of the corresponding parameter (see note in solvedTypes),
+ // must check again here:
+ typed1(itree2, EXPRmode, wildPt)
+
val result = new SearchResult(itree2, subst)
incCounter(foundImplicits)
if (traceImplicits) println("RESULT = "+result)