summaryrefslogtreecommitdiff
path: root/src/compiler/scala/reflect/macros/runtime/Typers.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/scala/reflect/macros/runtime/Typers.scala')
-rw-r--r--src/compiler/scala/reflect/macros/runtime/Typers.scala9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/compiler/scala/reflect/macros/runtime/Typers.scala b/src/compiler/scala/reflect/macros/runtime/Typers.scala
index 30370119fe..07d18eabe6 100644
--- a/src/compiler/scala/reflect/macros/runtime/Typers.scala
+++ b/src/compiler/scala/reflect/macros/runtime/Typers.scala
@@ -54,10 +54,13 @@ 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")
- context.firstError match {
- case Some(err) => throw new TypecheckException(err.errPos, err.errMsg)
- case None => universe.EmptyTree
+ if (!silent) {
+ val err = context.firstError
+ val errPos = err.map(_.errPos).getOrElse(pos)
+ val errMsg = err.map(_.errMsg).getOrElse("implicit search has failed. to find out the reason, turn on -Xlog-implicits")
+ throw new TypecheckException(errPos, errMsg)
}
+ universe.EmptyTree
case success =>
success.tree
}