Skip to content

Commit

Permalink
Fix formatter on call without parentheses followed by doc comment (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
straight-shoota authored Mar 10, 2024
1 parent 8fafef2 commit 15c66d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 8 additions & 0 deletions spec/compiler/formatter/formatter_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2893,6 +2893,14 @@ describe Crystal::Formatter do
end
end

# #14256
assert_format <<-CRYSTAL
foo bar # comment
# doc
def baz; end
CRYSTAL

# CVE-2021-42574
describe "Unicode bi-directional control characters" do
['\u202A', '\u202B', '\u202C', '\u202D', '\u202E', '\u2066', '\u2067', '\u2068', '\u2069'].each do |char|
Expand Down
2 changes: 0 additions & 2 deletions src/compiler/crystal/tools/formatter.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2982,8 +2982,6 @@ module Crystal
end

def finish_args(has_parentheses, has_newlines, ends_with_newline, found_comment, column)
skip_space

if has_parentheses
if @token.type.op_comma?
next_token
Expand Down

0 comments on commit 15c66d0

Please sign in to comment.