Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Formatter: fixed issue with named args inside [] call
  • Loading branch information
asterite committed Feb 20, 2017
1 parent bdc81db commit 2bc0030
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions spec/compiler/formatter/formatter_spec.cr
Expand Up @@ -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
Expand Up @@ -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 ","
Expand Down

0 comments on commit 2bc0030

Please sign in to comment.