Skip to content

Commit 6eb54f8

Browse files
committed
Set positions of inline bindings
Align position of binding and position of its defined symbol. This avoids some test-pickler errors observed with the new inliner.
1 parent a0a184e commit 6eb54f8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,10 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) {
242242
if (isByName) (Method | InlineProxy, ExprType(argtpe.widen))
243243
else (inlineFlag, argtpe.widen)
244244
val boundSym = newSym(name, bindingFlags, bindingType).asTerm
245-
val binding =
245+
val binding = {
246246
if (isByName) DefDef(boundSym, arg.changeOwner(ctx.owner, boundSym))
247247
else ValDef(boundSym, arg)
248+
}.withPos(boundSym.pos)
248249
boundSym.defTree = binding
249250
bindingsBuf += binding
250251
binding
@@ -297,7 +298,7 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) {
297298
ref(rhsClsSym.sourceModule)
298299
else
299300
inlineCallPrefix
300-
val binding = ValDef(selfSym.asTerm, rhs)
301+
val binding = ValDef(selfSym.asTerm, rhs).withPos(selfSym.pos)
301302
bindingsBuf += binding
302303
selfSym.defTree = binding
303304
inlining.println(i"proxy at $level: $selfSym = ${bindingsBuf.last}")

0 commit comments

Comments
 (0)