diff --git a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala index 498a4df50387..a837ad1d03bf 100644 --- a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala +++ b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala @@ -1195,13 +1195,14 @@ trait ContextErrors { import definitions._ - def AmbiguousImplicitError(tree1: Tree, tree2: Tree, + def AmbiguousImplicitError(info1: ImplicitInfo, tree1: Tree, + info2: ImplicitInfo, tree2: Tree, pre1: String, pre2: String, trailer: String) (isView: Boolean, pt: Type, tree: Tree)(implicit context0: Context) = { - if (!tree2.tpe.isErroneous && !tree2.tpe.isErroneous) { + if (!info1.tpe.isErroneous && !info2.tpe.isErroneous) { def coreMsg = - sm"""| $pre1 ${tree1.symbol.fullLocationString} of type ${tree1.symbol.tpe} - | $pre2 ${tree2.symbol.fullLocationString} of type ${tree2.symbol.tpe} + sm"""| $pre1 ${info1.sym.fullLocationString} of type ${info1.tpe} + | $pre2 ${info2.sym.fullLocationString} of type ${info2.tpe} | $trailer""" def viewMsg = { val found :: req :: _ = pt.typeArgs diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala index 6f42a552444f..d22008c02ef7 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala @@ -930,8 +930,8 @@ trait Implicits { case Nil => () case (chosenResult, chosenInfo) :: rest => rest find { case (_, alt) => !improves(chosenInfo, alt) } match { - case Some((competingResult, _)) => - AmbiguousImplicitError(chosenResult.tree, competingResult.tree, "both", "and", "")(isView, pt, tree)(context) + case Some((competingResult, competingInfo)) => + AmbiguousImplicitError(chosenInfo, chosenResult.tree, competingInfo, competingResult.tree, "both", "and", "")(isView, pt, tree)(context) return AmbiguousSearchFailure // Stop the search once ambiguity is encountered, see t4457_2.scala case _ => if (isView) chosenInfo.useCountView += 1