@@ -1373,9 +1373,11 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
1373
1373
1374
1374
def typedAssign (tree : untpd.Assign , pt : Type )(using Context ): Tree =
1375
1375
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)) =>
1379
1381
val rawUpdate : untpd.Tree = untpd.Select (untpd.TypedSplice (fn), nme.update)
1380
1382
val wrappedUpdate =
1381
1383
if (targs.isEmpty) rawUpdate
@@ -1389,7 +1391,8 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
1389
1391
def lhs1 = adapt(lhsCore, LhsProto , locked)
1390
1392
1391
1393
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)
1393
1396
cpy.Assign (tree)(lhsCore, typed(tree.rhs, lhs1.tpe.widen)).withType(defn.UnitType )
1394
1397
1395
1398
def canAssign (sym : Symbol ) =
@@ -1478,8 +1481,9 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
1478
1481
typedDynamicAssign(tree, pt)
1479
1482
case tpe =>
1480
1483
reassignmentToVal
1481
- }
1484
+ }
1482
1485
}
1486
+ end typedAssign
1483
1487
1484
1488
def typedBlockStats (stats : List [untpd.Tree ])(using Context ): (List [tpd.Tree ], Context ) =
1485
1489
index(stats)
0 commit comments