Skip to content

Commit f15746a

Browse files
committed
Followup #14405
Make same fix in another part of the code.
1 parent cb3a4ef commit f15746a

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

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

+13-11
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)