@@ -1373,9 +1373,11 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
13731373
13741374 def typedAssign (tree : untpd.Assign , pt : Type )(using Context ): Tree =
13751375 tree.lhs match {
1376- case lhs @ Apply (fn, args) =>
1377- typed(untpd.Apply (untpd.Select (fn, nme.update), args :+ tree.rhs), pt)
1378- case untpd.TypedSplice (Apply (MaybePoly (Select (fn, app), targs), args)) if app == nme.apply =>
1376+ case Apply (fn, args) =>
1377+ val appliedUpdate =
1378+ untpd.Apply (untpd.Select (fn, nme.update), args :+ tree.rhs)
1379+ typed(appliedUpdate, pt)
1380+ case untpd.TypedSplice (Apply (MaybePoly (Select (fn, nme.apply), targs), args)) =>
13791381 val rawUpdate : untpd.Tree = untpd.Select (untpd.TypedSplice (fn), nme.update)
13801382 val wrappedUpdate =
13811383 if (targs.isEmpty) rawUpdate
@@ -1389,7 +1391,8 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
13891391 def lhs1 = adapt(lhsCore, LhsProto , locked)
13901392
13911393 def reassignmentToVal =
1392- report.error(ReassignmentToVal (lhsCore.symbol.name), tree.srcPos)
1394+ val name = lhs match { case nt : NameTree => nt.name case _ => nme.NO_NAME }
1395+ report.error(ReassignmentToVal (lhs1.symbol, name), tree.srcPos)
13931396 cpy.Assign (tree)(lhsCore, typed(tree.rhs, lhs1.tpe.widen)).withType(defn.UnitType )
13941397
13951398 def canAssign (sym : Symbol ) =
@@ -1478,8 +1481,9 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
14781481 typedDynamicAssign(tree, pt)
14791482 case tpe =>
14801483 reassignmentToVal
1481- }
1484+ }
14821485 }
1486+ end typedAssign
14831487
14841488 def typedBlockStats (stats : List [untpd.Tree ])(using Context ): (List [tpd.Tree ], Context ) =
14851489 index(stats)
0 commit comments