Skip to content

Commit

Permalink
Type addImplicitsArgs result with the first failure
Browse files Browse the repository at this point in the history
  • Loading branch information
mbovel committed Apr 25, 2024
1 parent fc06435 commit 0890e7a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3902,7 +3902,8 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
case _ => ()

val args = implicitArgs(wtp.paramInfos, 0, pt)
if (args.tpes.exists(_.isInstanceOf[SearchFailureType])) {
val firstFailure = args.tpes.find(_.isInstanceOf[SearchFailureType])
if (firstFailure.isDefined) {
// If there are several arguments, some arguments might already
// have influenced the context, binding variables, but later ones
// might fail. In that case the constraint and instantiated variables
Expand Down Expand Up @@ -3938,10 +3939,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer

retyped
else
val firstNonAmbiguous = args.tpes.find(tp => tp.isError && !tp.isInstanceOf[AmbiguousImplicits])
def firstError = args.tpes.find(_.isError)
val errorType = firstNonAmbiguous.orElse(firstError).getOrElse(NoType)
val res = untpd.Apply(tree, args).withType(errorType)
val res = untpd.Apply(tree, args).withType(firstFailure.get)
reportErrors(res, wtp)
res
}
Expand Down

0 comments on commit 0890e7a

Please sign in to comment.