Skip to content

Commit

Permalink
Add implicit search to CyclicReference traces
Browse files Browse the repository at this point in the history
  • Loading branch information
odersky committed Apr 24, 2024
1 parent cfc46e4 commit 5efacbe
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions compiler/src/dotty/tools/dotc/typer/Implicits.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1084,10 +1084,15 @@ trait Implicits:
(searchCtx.scope eq ctx.scope) && (searchCtx.owner eq ctx.owner.owner)
do ()

try ImplicitSearch(pt, argument, span)(using searchCtx).bestImplicit
catch case ce: CyclicReference =>
ce.inImplicitSearch = true
throw ce
def searchStr =
if argument.isEmpty then i"argument of type $pt"
else i"conversion from ${argument.tpe} to $pt"

CyclicReference.trace(i"searching for an implicit $searchStr"):
try ImplicitSearch(pt, argument, span)(using searchCtx).bestImplicit
catch case ce: CyclicReference =>
ce.inImplicitSearch = true
throw ce
else NoMatchingImplicitsFailure

val result =
Expand Down

0 comments on commit 5efacbe

Please sign in to comment.