File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -319,7 +319,7 @@ object Trees {
319319 extension (mdef : untpd.DefTree ) def mods : untpd.Modifiers = mdef.rawMods
320320
321321 sealed trait WithEndMarker [+ T <: Untyped ]:
322- self : PackageDef [T ] | NamedDefTree [T ] =>
322+ self : PackageDef [T ] | NamedDefTree [T ] | Apply [ T ] =>
323323
324324 import WithEndMarker .*
325325
@@ -521,6 +521,16 @@ object Trees {
521521 extends GenericApply [T ] with WithEndMarker [T ] {
522522 type ThisTree [+ T <: Untyped ] = Apply [T ]
523523
524+ protected def srcName (using Context ): Name =
525+ // Prefer stored method name when present (handles nested Apply cases)
526+ this .attachmentOrElse(untpd.MethodName , null ) match
527+ case name : Name => name
528+ case _ =>
529+ fun match
530+ case Select (_, name) => name
531+ case Ident (name) => name
532+ case _ => nme.EMPTY
533+
524534 def setApplyKind (kind : ApplyKind ) =
525535 putAttachment(untpd.KindOfApply , kind)
526536 this
Original file line number Diff line number Diff line change @@ -1544,7 +1544,7 @@ object Parsers {
15441544 def updateSpanOfLast (last : T ): Unit =
15451545 last match
15461546 case last : WithEndMarker [t] => last.withEndMarker()
1547- case apply : Apply if sourceVersion.enablesMethodBlockEndMarkers => apply.setEndMarker ()
1547+ case apply : Apply if sourceVersion.enablesMethodBlockEndMarkers => apply.withEndMarker ()
15481548 case _ =>
15491549 last.span = last.span.withEnd(in.lastCharOffset)
15501550
You can’t perform that action at this time.
0 commit comments