diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-02-04 19:45:08 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-02-04 19:45:08 -0800 |
commit | 75ca8693f3c8468ab35e8a4cb53d4d4981d7363c (patch) | |
tree | 2d84cedaaed9762e0310d18e6a1f01b15667c7a3 | |
parent | 893fad496965744f6e6fbfa4b5a0add3c5eff9fa (diff) | |
parent | b67f8e57f4381024c0fba109ebe11d4006472d83 (diff) | |
download | scala-75ca8693f3c8468ab35e8a4cb53d4d4981d7363c.tar.gz scala-75ca8693f3c8468ab35e8a4cb53d4d4981d7363c.tar.bz2 scala-75ca8693f3c8468ab35e8a4cb53d4d4981d7363c.zip |
Merge pull request #2063 from retronym/ticket/6667-2.10.x-revert
[nomerge] SI-6667 Demote a new ambiguity error to a lint warning.
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Implicits.scala | 7 | ||||
-rw-r--r-- | test/files/neg/t6667.check | 3 | ||||
-rw-r--r-- | test/files/neg/t6667.flags | 1 | ||||
-rw-r--r-- | test/files/neg/t6667b.check | 3 | ||||
-rw-r--r-- | test/files/neg/t6667b.flags | 1 |
5 files changed, 12 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala index ec3a0a0ef7..d1cf9b1904 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala @@ -1319,12 +1319,17 @@ trait Implicits { // `materializeImplicit` does some preprocessing for `pt` // is it only meant for manifests/tags or we need to do the same for `implicitsOfExpectedType`? - if (result.isFailure && !wasAmbigious) result = searchImplicit(implicitsOfExpectedType, false) + if (result.isFailure) result = searchImplicit(implicitsOfExpectedType, false) if (result.isFailure) { context.updateBuffer(previousErrs) if (Statistics.canEnable) Statistics.stopTimer(oftypeFailNanos, failstart) } else { + if (wasAmbigious && settings.lint.value) + reporter.warning(tree.pos, + "Search of in-scope implicits was ambiguous, and the implicit scope was searched. In Scala 2.11.0, this code will not compile. See SI-6667. \n" + + previousErrs.map(_.errMsg).mkString("\n")) + if (Statistics.canEnable) Statistics.stopTimer(oftypeSucceedNanos, succstart) if (Statistics.canEnable) Statistics.incCounter(oftypeImplicitHits) } diff --git a/test/files/neg/t6667.check b/test/files/neg/t6667.check index 43313fa4fe..b04251d7c1 100644 --- a/test/files/neg/t6667.check +++ b/test/files/neg/t6667.check @@ -1,4 +1,5 @@ -t6667.scala:8: error: ambiguous implicit values: +t6667.scala:8: error: Search of in-scope implicits was ambiguous, and the implicit scope was searched. In Scala 2.11.0, this code will not compile. See SI-6667. +ambiguous implicit values: both value inScope1 in object Test of type => C and value inScope2 in object Test of type => C match expected type C diff --git a/test/files/neg/t6667.flags b/test/files/neg/t6667.flags new file mode 100644 index 0000000000..6c1dd108ae --- /dev/null +++ b/test/files/neg/t6667.flags @@ -0,0 +1 @@ +-Xfatal-warnings -Xlint
\ No newline at end of file diff --git a/test/files/neg/t6667b.check b/test/files/neg/t6667b.check index 99cea9a47c..5d56e776c3 100644 --- a/test/files/neg/t6667b.check +++ b/test/files/neg/t6667b.check @@ -4,7 +4,8 @@ t6667b.scala:16: error: ambiguous implicit values: match expected type Test.Box new Test() ^ -t6667b.scala:19: error: ambiguous implicit values: +t6667b.scala:19: error: Search of in-scope implicits was ambiguous, and the implicit scope was searched. In Scala 2.11.0, this code will not compile. See SI-6667. +ambiguous implicit values: both value a in object Test of type => Test.Box and value b of type Test.Box match expected type Test.Box diff --git a/test/files/neg/t6667b.flags b/test/files/neg/t6667b.flags new file mode 100644 index 0000000000..6c1dd108ae --- /dev/null +++ b/test/files/neg/t6667b.flags @@ -0,0 +1 @@ +-Xfatal-warnings -Xlint
\ No newline at end of file |