File tree Expand file tree Collapse file tree 2 files changed +3
-1
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -413,6 +413,7 @@ object Implicits:
413413
414414 /** A failed search */
415415 case class SearchFailure (tree : Tree ) extends SearchResult {
416+ require(tree.tpe.isInstanceOf [SearchFailureType ], s " unexpected type for ${tree}" )
416417 final def isAmbiguous : Boolean = tree.tpe.isInstanceOf [AmbiguousImplicits | TooUnspecific ]
417418 final def reason : SearchFailureType = tree.tpe.asInstanceOf [SearchFailureType ]
418419 }
Original file line number Diff line number Diff line change @@ -3663,8 +3663,9 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
36633663 val remembered = // report AmbiguousReferences as priority, otherwise last error
36643664 (errs.filter(_.msg.isInstanceOf [AmbiguousReference ]) ++ errs).take(1 )
36653665 for err <- remembered do
3666+ val tree = if app.isEmpty then qual else app
36663667 rememberSearchFailure(qual,
3667- SearchFailure (app .withType(FailedExtension (app , selectionProto, err.msg))))
3668+ SearchFailure (tree .withType(FailedExtension (tree , selectionProto, err.msg))))
36683669 catch case ex : TypeError => nestedFailure(ex)
36693670
36703671 // try an implicit conversion or given extension
You can’t perform that action at this time.
0 commit comments