Skip to content

Commit 72954eb

Browse files
oderskyWojciechMazur
authored andcommitted
Add implicit search to CyclicReference traces
[Cherry-picked 5efacbe]
1 parent d4833c7 commit 72954eb

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
@@ -1058,10 +1058,15 @@ trait Implicits:
10581058
(searchCtx.scope eq ctx.scope) && (searchCtx.owner eq ctx.owner.owner)
10591059
do ()
10601060

1061-
try ImplicitSearch(pt, argument, span)(using searchCtx).bestImplicit
1062-
catch case ce: CyclicReference =>
1063-
ce.inImplicitSearch = true
1064-
throw ce
1061+
def searchStr =
1062+
if argument.isEmpty then i"argument of type $pt"
1063+
else i"conversion from ${argument.tpe} to $pt"
1064+
1065+
CyclicReference.trace(i"searching for an implicit $searchStr"):
1066+
try ImplicitSearch(pt, argument, span)(using searchCtx).bestImplicit
1067+
catch case ce: CyclicReference =>
1068+
ce.inImplicitSearch = true
1069+
throw ce
10651070
else NoMatchingImplicitsFailure
10661071

10671072
val result =

0 commit comments

Comments
 (0)