diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Implicits.scala | 8 | ||||
-rw-r--r-- | test/files/pos/t2421c.scala | 17 |
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 |