Skip to content

Commit 5efacbe

Browse files
committed
Add implicit search to CyclicReference traces
1 parent cfc46e4 commit 5efacbe

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

compiler/src/dotty/tools/dotc/typer/Implicits.scala

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,10 +1084,15 @@ trait Implicits:
10841084
(searchCtx.scope eq ctx.scope) && (searchCtx.owner eq ctx.owner.owner)
10851085
do ()
10861086

1087-
try ImplicitSearch(pt, argument, span)(using searchCtx).bestImplicit
1088-
catch case ce: CyclicReference =>
1089-
ce.inImplicitSearch = true
1090-
throw ce
1087+
def searchStr =
1088+
if argument.isEmpty then i"argument of type $pt"
1089+
else i"conversion from ${argument.tpe} to $pt"
1090+
1091+
CyclicReference.trace(i"searching for an implicit $searchStr"):
1092+
try ImplicitSearch(pt, argument, span)(using searchCtx).bestImplicit
1093+
catch case ce: CyclicReference =>
1094+
ce.inImplicitSearch = true
1095+
throw ce
10911096
else NoMatchingImplicitsFailure
10921097

10931098
val result =

0 commit comments

Comments
 (0)