From de12ca6ef8071820c6b2a9403ccab9aa6ed51c0b Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Thu, 23 May 2013 16:50:45 -0700 Subject: SI-7486 Regressions in implicit search. Revert e86832d7e8 and dd33e280e2. --- .../scala/tools/nsc/typechecker/Implicits.scala | 17 +++-------------- test/files/neg/t7441.check | 6 ------ test/files/neg/t7441.scala | 7 ------- test/files/pos/t7486.scala | 8 -------- test/pending/neg/t7441.check | 6 ++++++ test/pending/neg/t7441.scala | 7 +++++++ test/pending/pos/t7486.scala | 8 ++++++++ 7 files changed, 24 insertions(+), 35 deletions(-) delete mode 100644 test/files/neg/t7441.check delete mode 100644 test/files/neg/t7441.scala delete mode 100644 test/files/pos/t7486.scala create mode 100644 test/pending/neg/t7441.check create mode 100644 test/pending/neg/t7441.scala create mode 100644 test/pending/pos/t7486.scala diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala index ef87a32c1d..35a4461ccc 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala @@ -997,22 +997,11 @@ trait Implicits { if (settings.Xdivergence211.value) DivergingImplicitExpansionError(tree, pt, DivergentImplicitRecovery.sym)(context) else throw DivergentImplicit } - else if (invalidImplicits.nonEmpty) { - val sym = invalidImplicits.head - // We don't even dare look if errors are being buffered - // !sym.hasFlag(LOCKED) is a hail mary between SI-2206 and SI-7486 - def isSensibleAddendum = !sym.hasFlag(LOCKED) && (pt match { - case Function1(_, out) => out <:< sym.tpe.finalResultType - case _ => pt <:< sym.tpe.finalResultType - }) - // Don't pitch in with this theory unless it looks plausible that the - // implicit would have helped + + if (invalidImplicits.nonEmpty) setAddendum(pos, () => - if (isSensibleAddendum) - s"\n Note: implicit $sym is not applicable here because it comes after the application point and it lacks an explicit result type" - else "" + s"\n Note: implicit ${invalidImplicits.head} is not applicable here because it comes after the application point and it lacks an explicit result type" ) - } } best diff --git a/test/files/neg/t7441.check b/test/files/neg/t7441.check deleted file mode 100644 index f259457197..0000000000 --- a/test/files/neg/t7441.check +++ /dev/null @@ -1,6 +0,0 @@ -t7441.scala:4: error: type mismatch; - found : Int(1) - required: List[Any] - def test = apply(1) - ^ -one error found diff --git a/test/files/neg/t7441.scala b/test/files/neg/t7441.scala deleted file mode 100644 index dad7421e3f..0000000000 --- a/test/files/neg/t7441.scala +++ /dev/null @@ -1,7 +0,0 @@ -object Test { - object Bar { - def apply(xs: List[Any]): Int = 0 - def test = apply(1) - } - implicit def foo = 1 -} diff --git a/test/files/pos/t7486.scala b/test/files/pos/t7486.scala deleted file mode 100644 index 6dd7f4c4ac..0000000000 --- a/test/files/pos/t7486.scala +++ /dev/null @@ -1,8 +0,0 @@ -object Test{ - var locker = 0 - // remove implicit, or change to `locker = locker + 1` to make it compile. - implicit val davyJones0 = { - locker += 0 - 0 - } -} diff --git a/test/pending/neg/t7441.check b/test/pending/neg/t7441.check new file mode 100644 index 0000000000..f259457197 --- /dev/null +++ b/test/pending/neg/t7441.check @@ -0,0 +1,6 @@ +t7441.scala:4: error: type mismatch; + found : Int(1) + required: List[Any] + def test = apply(1) + ^ +one error found diff --git a/test/pending/neg/t7441.scala b/test/pending/neg/t7441.scala new file mode 100644 index 0000000000..dad7421e3f --- /dev/null +++ b/test/pending/neg/t7441.scala @@ -0,0 +1,7 @@ +object Test { + object Bar { + def apply(xs: List[Any]): Int = 0 + def test = apply(1) + } + implicit def foo = 1 +} diff --git a/test/pending/pos/t7486.scala b/test/pending/pos/t7486.scala new file mode 100644 index 0000000000..6dd7f4c4ac --- /dev/null +++ b/test/pending/pos/t7486.scala @@ -0,0 +1,8 @@ +object Test{ + var locker = 0 + // remove implicit, or change to `locker = locker + 1` to make it compile. + implicit val davyJones0 = { + locker += 0 + 0 + } +} -- cgit v1.2.3