Skip to content

Commit 0734ce9

Browse files
authored
Merge pull request #2872 from dotty-staging/fix-pos-assign
Fix positions in assignments
2 parents 9e1ed7a + 29a1771 commit 0734ce9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

+4-3
Original file line numberDiff line numberDiff line change
@@ -567,13 +567,14 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
567567
def typedAssign(tree: untpd.Assign, pt: Type)(implicit ctx: Context) = track("typedAssign") {
568568
tree.lhs match {
569569
case lhs @ Apply(fn, args) =>
570-
typed(cpy.Apply(lhs)(untpd.Select(fn, nme.update), args :+ tree.rhs), pt)
570+
typed(untpd.Apply(untpd.Select(fn, nme.update), args :+ tree.rhs), pt)
571571
case untpd.TypedSplice(Apply(MaybePoly(Select(fn, app), targs), args)) if app == nme.apply =>
572572
val rawUpdate: untpd.Tree = untpd.Select(untpd.TypedSplice(fn), nme.update)
573573
val wrappedUpdate =
574574
if (targs.isEmpty) rawUpdate
575575
else untpd.TypeApply(rawUpdate, targs map (untpd.TypedSplice(_)))
576-
val appliedUpdate = cpy.Apply(fn)(wrappedUpdate, (args map (untpd.TypedSplice(_))) :+ tree.rhs)
576+
val appliedUpdate =
577+
untpd.Apply(wrappedUpdate, (args map (untpd.TypedSplice(_))) :+ tree.rhs)
577578
typed(appliedUpdate, pt)
578579
case lhs =>
579580
val lhsCore = typedUnadapted(lhs, AssignProto)
@@ -604,7 +605,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
604605
val setterType = ensureAccessible(setterTypeRaw, isSuperSelection(lhsCore), tree.pos)
605606
val lhs2 = healNonvariant(
606607
untpd.rename(lhsCore, setterName).withType(setterType), WildcardType)
607-
typedUnadapted(cpy.Apply(tree)(untpd.TypedSplice(lhs2), tree.rhs :: Nil))
608+
typedUnadapted(untpd.Apply(untpd.TypedSplice(lhs2), tree.rhs :: Nil))
608609
case _ =>
609610
reassignmentToVal
610611
}

0 commit comments

Comments
 (0)