summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2013-02-23 14:49:38 +0100
committerEugene Burmako <xeno.by@gmail.com>2013-05-11 18:37:11 +0200
commitb4da864247ccaaee4f987fbf433b312e1d744a8f (patch)
tree7b65cb8ce7884071427a7aeeefe8d1f136bdd67d /src
parentfdead2b3793fd530e05331649e655576f30e59e9 (diff)
downloadscala-b4da864247ccaaee4f987fbf433b312e1d744a8f.tar.gz
scala-b4da864247ccaaee4f987fbf433b312e1d744a8f.tar.bz2
scala-b4da864247ccaaee4f987fbf433b312e1d744a8f.zip
[nomaster] SI-7047 fixes silent for c.inferImplicitXXX
silent = true now throws a TypecheckException even if we don't know why an implicit search has failed (i.e. if context.hasErrors is false). NOTE: this commit is a part of a pull request for 2.10.x, which makes sense of implicit macros. Everything in that pull request is [nomaster] due to one reason or another. This commit would work equally well in both 2.10.x and master, but I'm marking it as [nomaster] as well, because I'm anyway going to resubmit the whole pull request into master soon, so there's no reason to introduce additional confusion.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/reflect/macros/runtime/Typers.scala5
-rw-r--r--src/compiler/scala/tools/reflect/ToolBoxFactory.scala5
2 files changed, 8 insertions, 2 deletions
diff --git a/src/compiler/scala/reflect/macros/runtime/Typers.scala b/src/compiler/scala/reflect/macros/runtime/Typers.scala
index 8dc9bdeb7a..7cfee2041c 100644
--- a/src/compiler/scala/reflect/macros/runtime/Typers.scala
+++ b/src/compiler/scala/reflect/macros/runtime/Typers.scala
@@ -52,7 +52,10 @@ trait Typers {
wrapper(universe.analyzer.inferImplicit(tree, pt, reportAmbiguous = true, isView = isView, context = context, saveAmbiguousDivergent = !silent, pos = pos)) match {
case failure if failure.tree.isEmpty =>
macroLogVerbose("implicit search has failed. to find out the reason, turn on -Xlog-implicits")
- if (context.hasErrors) throw new TypecheckException(context.errBuffer.head.errPos, context.errBuffer.head.errMsg)
+ if (!silent) {
+ if (context.hasErrors) throw new TypecheckException(context.errBuffer.head.errPos, context.errBuffer.head.errMsg)
+ else throw new TypecheckException(pos, "implicit search has failed. to find out the reason, turn on -Xlog-implicits")
+ }
universe.EmptyTree
case success =>
success.tree
diff --git a/src/compiler/scala/tools/reflect/ToolBoxFactory.scala b/src/compiler/scala/tools/reflect/ToolBoxFactory.scala
index c05c59d5ff..acfc86c1ac 100644
--- a/src/compiler/scala/tools/reflect/ToolBoxFactory.scala
+++ b/src/compiler/scala/tools/reflect/ToolBoxFactory.scala
@@ -185,7 +185,10 @@ abstract class ToolBoxFactory[U <: JavaUniverse](val u: U) { factorySelf =>
analyzer.inferImplicit(tree, pt, reportAmbiguous = true, isView = isView, context = context, saveAmbiguousDivergent = !silent, pos = pos) match {
case failure if failure.tree.isEmpty =>
trace("implicit search has failed. to find out the reason, turn on -Xlog-implicits: ")(failure.tree)
- if (context.hasErrors) throw ToolBoxError("reflective implicit search has failed: %s".format(context.errBuffer.head.errMsg))
+ if (!silent) {
+ if (context.hasErrors) throw ToolBoxError("reflective implicit search has failed: %s".format(context.errBuffer.head.errMsg))
+ else throw new ToolBoxError("reflective implicit search has failed. to find out the reason, turn on -Xlog-implicits")
+ }
EmptyTree
case success =>
success.tree