@@ -715,7 +715,11 @@ object Parsers {
715
715
val t = enclosed(INDENT , body)
716
716
if needsBraces(t) then
717
717
patch(source, Span (startOpening, endOpening), " {" )
718
- patch(source, Span (closingOffset(source.nextLine(in.lastOffset))), indentWidth.toPrefix ++ " }\n " )
718
+ val next = in.next
719
+ def closedByEndMarker =
720
+ next.token == END && (next.offset - next.lineOffset) == indentWidth.toPrefix.size
721
+ if closedByEndMarker then patch(source, Span (next.offset), " } // " )
722
+ else patch(source, Span (closingOffset(source.nextLine(in.lastOffset))), indentWidth.toPrefix ++ " }\n " )
719
723
t
720
724
end indentedToBraces
721
725
@@ -1422,9 +1426,6 @@ object Parsers {
1422
1426
val start = in.skipToken()
1423
1427
if stats.isEmpty || ! matchesAndSetEnd(stats.last) then
1424
1428
syntaxError(em " misaligned end marker " , Span (start, in.lastCharOffset))
1425
- else if overlapsPatch(source, Span (start, start)) then
1426
- patch(source, Span (start, start), " " )
1427
- patch(source, Span (start, in.lastCharOffset), s " } // end $endName" )
1428
1429
in.token = IDENTIFIER // Leaving it as the original token can confuse newline insertion
1429
1430
in.nextToken()
1430
1431
end checkEndMarker
0 commit comments