Skip to content

Commit

Permalink
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions spec/compiler/formatter/formatter_spec.cr
Original file line number Diff line number Diff line change
@@ -1045,4 +1045,6 @@ describe Crystal::Formatter do
assert_format "foo bar, \\\nbaz", "foo bar,\n baz"

assert_format "alias X = ((Y, Z) ->)"

assert_format "def x(@y = ->(z) {})\nend"
end
6 changes: 6 additions & 0 deletions src/compiler/crystal/tools/formatter.cr
Original file line number Diff line number Diff line change
@@ -1953,6 +1953,10 @@ module Crystal
end

if default_value
# The default value might be a Proc with args, so
# we need to remember this and restore it later
old_last_arg_is_skip = @last_arg_is_skip

skip_space_or_newline

check_align = check_assign_length node
@@ -1961,6 +1965,8 @@ module Crystal
skip_space_or_newline
accept default_value
check_assign_align before_column, default_value if check_align

@last_arg_is_skip = old_last_arg_is_skip
end

# This is the case of an enum member

0 comments on commit 3d5e845

Please sign in to comment.