@@ -141,20 +141,26 @@ object ErrorReporting {
141141 if Feature .migrateTo3 then " \n This patch can be inserted automatically under -rewrite."
142142 else " "
143143
144+ def whyFailedStr (fail : FailedExtension ) =
145+ i """ failed with
146+ |
147+ | ${fail.whyFailed.message.indented(8 )}"""
148+
144149 def selectErrorAddendum
145150 (tree : untpd.RefTree , qual1 : Tree , qualType : Type , suggestImports : Type => String )
146151 (using Context ): String =
147152
148- val attempts = mutable.ListBuffer [(Tree , FailedExtension )]()
153+ val attempts = mutable.ListBuffer [(Tree , String )]()
149154 val nested = mutable.ListBuffer [NestedFailure ]()
150155 for
151156 failures <- qual1.getAttachment(Typer .HiddenSearchFailure )
152157 failure <- failures
153158 do
154159 failure.reason match
155160 case fail : NestedFailure => nested += fail
156- case fail : FailedExtension => attempts += ((failure.tree, fail))
157- case _ =>
161+ case fail : FailedExtension => attempts += ((failure.tree, whyFailedStr(fail)))
162+ case fail : Implicits .NoMatchingImplicits => // do nothing
163+ case _ => attempts += ((failure.tree, " " ))
158164 if qualType.derivesFrom(defn.DynamicClass ) then
159165 " \n possible cause: maybe a wrong Dynamic method signature?"
160166 else if attempts.nonEmpty then
@@ -164,9 +170,7 @@ object ErrorReporting {
164170 .distinctBy(_._1)
165171 .map((treeStr, whyFailed) =>
166172 i """
167- | $treeStr failed with
168- |
169- | ${whyFailed.whyFailed.message.indented(8 )}""" )
173+ | $treeStr$whyFailed""" )
170174 val extMethods =
171175 if attemptStrings.length > 1 then " Extension methods were"
172176 else " An extension method was"
0 commit comments