Skip to content

Commit 2bc0030

Browse files
author
Ary Borenszweig
committedFeb 20, 2017
Formatter: fixed issue with named args inside [] call
1 parent bdc81db commit 2bc0030

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed
 

‎spec/compiler/formatter/formatter_spec.cr

+1
Original file line numberDiff line numberDiff line change
@@ -1006,4 +1006,5 @@ describe Crystal::Formatter do
10061006
assert_format "Union(Int32, String)?"
10071007

10081008
assert_format "<<-HEREDOC\n \#{foo}\n H\#{bar}\n HEREDOC"
1009+
assert_format "foo[a, b: 2]"
10091010
end

‎src/compiler/crystal/tools/formatter.cr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2105,7 +2105,7 @@ module Crystal
21052105
last_arg = args.pop
21062106
end
21072107

2108-
has_newlines, found_comment, _ = format_args args, true
2108+
has_newlines, found_comment, _ = format_args args, true, node.named_args
21092109
if @token.type == :"," || @token.type == :NEWLINE
21102110
if has_newlines
21112111
write ","

0 commit comments

Comments
 (0)
Please sign in to comment.