Skip to content

Commit 641e0de

Browse files
authored
Merge pull request #2114 from dotty-staging/fix/inline-error-pos
Fix position of errors in Inliner TreeTypeMap
2 parents 53b808f + 8497a6a commit 641e0de

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -457,16 +457,17 @@ class Inliner(call: tpd.Tree, rhs: tpd.Tree)(implicit ctx: Context) {
457457
case _ => tree
458458
}}
459459

460-
// The complete translation maps referenves to this and parameters to
460+
val inlineCtx = inlineContext(call)
461+
// The complete translation maps references to `this` and parameters to
461462
// corresponding arguments or proxies on the type and term level. It also changes
462463
// the owner from the inlined method to the current owner.
463-
val inliner = new TreeTypeMap(typeMap, treeMap, meth :: Nil, ctx.owner :: Nil)
464+
val inliner = new TreeTypeMap(typeMap, treeMap, meth :: Nil, ctx.owner :: Nil)(inlineCtx)
464465

465466
val expansion = inliner(rhs.withPos(call.pos))
466467
ctx.traceIndented(i"inlining $call\n, BINDINGS =\n${bindingsBuf.toList}%\n%\nEXPANSION =\n$expansion", inlining, show = true) {
467468

468469
// The final expansion runs a typing pass over the inlined tree. See InlineTyper for details.
469-
val expansion1 = InlineTyper.typed(expansion, pt)(inlineContext(call))
470+
val expansion1 = InlineTyper.typed(expansion, pt)(inlineCtx)
470471

471472
/** Does given definition bind a closure that will be inlined? */
472473
def bindsDeadClosure(defn: ValOrDefDef) = Ident(defn.symbol.termRef) match {

0 commit comments

Comments
 (0)