Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compiler/src/dotty/tools/dotc/typer/Implicits.scala
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ object Implicits:

/** A failed search */
case class SearchFailure(tree: Tree) extends SearchResult {
require(tree.tpe.isInstanceOf[SearchFailureType], s"unexpected type for ${tree}")
final def isAmbiguous: Boolean = tree.tpe.isInstanceOf[AmbiguousImplicits | TooUnspecific]
final def reason: SearchFailureType = tree.tpe.asInstanceOf[SearchFailureType]
}
Expand Down
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3663,8 +3663,9 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
val remembered = // report AmbiguousReferences as priority, otherwise last error
(errs.filter(_.msg.isInstanceOf[AmbiguousReference]) ++ errs).take(1)
for err <- remembered do
val tree = if app.isEmpty then qual else app
rememberSearchFailure(qual,
SearchFailure(app.withType(FailedExtension(app, selectionProto, err.msg))))
SearchFailure(tree.withType(FailedExtension(tree, selectionProto, err.msg))))
catch case ex: TypeError => nestedFailure(ex)

// try an implicit conversion or given extension
Expand Down