@@ -1320,17 +1320,19 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(using Context) {
13201320 def searchImplicit (sym : TermSymbol , tpt : Tree ) = {
13211321 val evTyper = new Typer (ctx.nestingLevel + 1 )
13221322 val evCtx = ctx.fresh.setTyper(evTyper)
1323- val evidence = evTyper.inferImplicitArg(tpt.tpe, tpt.span)(using evCtx)
1324- evidence.tpe match {
1325- case fail : Implicits .AmbiguousImplicits =>
1326- report.error(evTyper.missingArgMsg(evidence, tpt.tpe, " " ), tpt.srcPos)
1327- true // hard error: return true to stop implicit search here
1328- case fail : Implicits .SearchFailureType =>
1329- false
1330- case _ =>
1331- // inlining.println(i"inferred implicit $sym: ${sym.info} with $evidence: ${evidence.tpe.widen}, ${evCtx.gadt.constraint}, ${evCtx.typerState.constraint}")
1332- newTermBinding(sym, evidence)
1333- true
1323+ inContext(evCtx) {
1324+ val evidence = evTyper.inferImplicitArg(tpt.tpe, tpt.span)
1325+ evidence.tpe match {
1326+ case fail : Implicits .AmbiguousImplicits =>
1327+ report.error(evTyper.missingArgMsg(evidence, tpt.tpe, " " ), tpt.srcPos)
1328+ true // hard error: return true to stop implicit search here
1329+ case fail : Implicits .SearchFailureType =>
1330+ false
1331+ case _ =>
1332+ // inlining.println(i"inferred implicit $sym: ${sym.info} with $evidence: ${evidence.tpe.widen}, ${evCtx.gadt.constraint}, ${evCtx.typerState.constraint}")
1333+ newTermBinding(sym, evidence)
1334+ true
1335+ }
13341336 }
13351337 }
13361338
0 commit comments