Skip to content

Commit

Permalink
Formatter: fixed issue with named args inside [] call
Browse files Browse the repository at this point in the history
  • Loading branch information
Ary Borenszweig committed Feb 20, 2017
1 parent bdc81db commit 2bc0030
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions spec/compiler/formatter/formatter_spec.cr
Original file line number Diff line number Diff line change
@@ -1006,4 +1006,5 @@ describe Crystal::Formatter do
assert_format "Union(Int32, String)?"

assert_format "<<-HEREDOC\n \#{foo}\n H\#{bar}\n HEREDOC"
assert_format "foo[a, b: 2]"
end
2 changes: 1 addition & 1 deletion src/compiler/crystal/tools/formatter.cr
Original file line number Diff line number Diff line change
@@ -2105,7 +2105,7 @@ module Crystal
last_arg = args.pop
end

has_newlines, found_comment, _ = format_args args, true
has_newlines, found_comment, _ = format_args args, true, node.named_args
if @token.type == :"," || @token.type == :NEWLINE
if has_newlines
write ","

0 comments on commit 2bc0030

Please sign in to comment.