summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2010-02-26 10:50:32 +0000
committerAdriaan Moors <adriaan.moors@epfl.ch>2010-02-26 10:50:32 +0000
commitd5ae4c69b0a0700fe7a35e96516eaea5e7182322 (patch)
tree5037d56ef694eb69af4c6a60f92231816a8b258f
parent0dd2f30edbb44d526be60676fef9ba05a9e3dfbf (diff)
downloadscala-d5ae4c69b0a0700fe7a35e96516eaea5e7182322.tar.gz
scala-d5ae4c69b0a0700fe7a35e96516eaea5e7182322.tar.bz2
scala-d5ae4c69b0a0700fe7a35e96516eaea5e7182322.zip
closes #2421 -- now also deals with chained imp...
closes #2421 -- now also deals with chained implicits no review
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Implicits.scala8
-rw-r--r--test/files/pos/t2421c.scala17
2 files changed, 20 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
index f8a32ab0f8..840ec1113d 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
@@ -477,12 +477,10 @@ self: Analyzer =>
// #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:
- itree2 match { // roughly equivalent to typed1(itree2, EXPRmode, wildPt),
- // since typed1 only forces checking of the outer tree and calls typed on the subtrees
- // (they have already been type checked, by the typed1(itree...) above, so the subtrees are skipped by typed)
- // inlining the essential bit here for clarity
- //TODO: verify that these subtrees don't need re-checking
+ // TODO: I would prefer to just call typed instead of duplicating the code here, but this is probably a hotspot (and you can't just call typed, need to force re-typecheck)
+ itree2 match {
case TypeApply(fun, args) => typedTypeApply(itree2, EXPRmode, fun, args)
+ case Apply(TypeApply(fun, args), _) => typedTypeApply(itree2, EXPRmode, fun, args) // t2421c
case _ =>
}
diff --git a/test/files/pos/t2421c.scala b/test/files/pos/t2421c.scala
new file mode 100644
index 0000000000..755e6a39f0
--- /dev/null
+++ b/test/files/pos/t2421c.scala
@@ -0,0 +1,17 @@
+object Test {
+ class A
+ class B
+ class C
+ class F[X]
+
+ def f(implicit aa: F[A]) = println(aa)
+
+ implicit def a : F[A] = new F[A]()
+
+ // generalised from t2421b to verify we check enough
+ class G[X]
+ implicit def g[X] = new G[X]()
+ implicit def b[X <: B](implicit mx: G[X]) = new F[X]()
+
+ f
+} \ No newline at end of file