Skip to content

Commit 0206e57

Browse files
committed
Add comment on agrument span
1 parent 649fd92 commit 0206e57

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -444,18 +444,19 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) {
444444
case _ => tree
445445
}
446446
case tree: Ident =>
447-
def span =
447+
/* Span of the argument. Used when the argument is inlined directly without a binding */
448+
def argSpan =
448449
if (tree.name == nme.WILDCARD) tree.span // From type match
449450
else if (tree.symbol.isTypeParam && tree.symbol.owner.isClass) tree.span // TODO is this the correct span?
450451
else paramSpan(tree.name)
451452
paramProxy.get(tree.tpe) match {
452453
case Some(t) if tree.isTerm && t.isSingleton =>
453454
t.dealias match {
454-
case tp: ConstantType => Inlined(EmptyTree, Nil, singleton(tp).withSpan(span)).withSpan(tree.span)
455-
case tp => singleton(tp).withSpan(span)
455+
case tp: ConstantType => Inlined(EmptyTree, Nil, singleton(tp).withSpan(argSpan)).withSpan(tree.span)
456+
case tp => singleton(tp).withSpan(argSpan)
456457
}
457458
case Some(t) if tree.isType =>
458-
TypeTree(t).withSpan(span)
459+
TypeTree(t).withSpan(argSpan)
459460
case _ => tree
460461
}
461462
case tree => tree

0 commit comments

Comments
 (0)