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