Skip to content

Commit

Permalink
Fix issue of whitespace lost on empty while-loop body before trailing…
Browse files Browse the repository at this point in the history
… semi-colon (#583)
  • Loading branch information
kunli2 authored Jan 9, 2024
1 parent 10052ef commit 666bc77
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1623,7 +1623,8 @@ public J visitWhileExpression(KtWhileExpression expression, ExecutionContext dat
deepPrefix(expression),
Markers.EMPTY,
mapControlParentheses(requireNonNull(expression.getCondition()), data).withPrefix(prefix(expression.getLeftParenthesis())),
expression.getBody() == null ? JRightPadded.build(new J.Empty(randomId(), Space.EMPTY, Markers.EMPTY)) : JRightPadded.build(requireNonNull(expression.getBody()).accept(this, data).withPrefix(prefix(expression.getBody().getParent())))
expression.getBody() == null ? JRightPadded.build(new J.Empty(randomId(), suffix(expression.getRightParenthesis()), Markers.EMPTY)) :
JRightPadded.build(requireNonNull(expression.getBody()).accept(this, data).withPrefix(prefix(expression.getBody().getParent())))
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void noBody() {
kotlin(
"""
fun test ( ) {
while ( true );
while ( true ) ;
}
"""
)
Expand Down

0 comments on commit 666bc77

Please sign in to comment.