@@ -704,7 +704,11 @@ object Parsers {
704
704
val t = enclosed(INDENT , body)
705
705
if needsBraces(t) then
706
706
patch(source, Span (startOpening, endOpening), " {" )
707
- patch(source, Span (closingOffset(source.nextLine(in.lastOffset))), indentWidth.toPrefix ++ " }\n " )
707
+ val next = in.next
708
+ def closedByEndMarker =
709
+ next.token == END && (next.offset - next.lineOffset) == indentWidth.toPrefix.size
710
+ if closedByEndMarker then patch(source, Span (next.offset), " } // " )
711
+ else patch(source, Span (closingOffset(source.nextLine(in.lastOffset))), indentWidth.toPrefix ++ " }\n " )
708
712
t
709
713
end indentedToBraces
710
714
@@ -1411,9 +1415,6 @@ object Parsers {
1411
1415
val start = in.skipToken()
1412
1416
if stats.isEmpty || ! matchesAndSetEnd(stats.last) then
1413
1417
syntaxError(em " misaligned end marker " , Span (start, in.lastCharOffset))
1414
- else if overlapsPatch(source, Span (start, start)) then
1415
- patch(source, Span (start, start), " " )
1416
- patch(source, Span (start, in.lastCharOffset), s " } // end $endName" )
1417
1418
in.token = IDENTIFIER // Leaving it as the original token can confuse newline insertion
1418
1419
in.nextToken()
1419
1420
end checkEndMarker
0 commit comments