diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/elixir/lib/code/formatter.ex | 2 | ||||
-rw-r--r-- | lib/elixir/test/elixir/code_formatter/containers_test.exs | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/elixir/lib/code/formatter.ex b/lib/elixir/lib/code/formatter.ex index 761df5a9e..39bc37a4e 100644 --- a/lib/elixir/lib/code/formatter.ex +++ b/lib/elixir/lib/code/formatter.ex @@ -1257,7 +1257,7 @@ defmodule Code.Formatter do {right_doc, state} = args_to_algebra_with_comments(right, meta, state, "ed_to_algebra(&1, :parens_arg, &2)) - args_doc = group(glue(left_doc, concat("| ", nest(right_doc, 2)))) + args_doc = glue(left_doc, concat("| ", nest(right_doc, 2))) name_doc = "%" |> concat(name_doc) |> concat("{") {surround(name_doc, args_doc, "}"), state} end diff --git a/lib/elixir/test/elixir/code_formatter/containers_test.exs b/lib/elixir/test/elixir/code_formatter/containers_test.exs index 395451530..d1c651ade 100644 --- a/lib/elixir/test/elixir/code_formatter/containers_test.exs +++ b/lib/elixir/test/elixir/code_formatter/containers_test.exs @@ -529,5 +529,17 @@ defmodule Code.Formatter.ContainersTest do } """ end + + test "converges" do + bad = "hello_world(%struct{foo | 1 => 2, 3 => 4})" + good = """ + hello_world(%struct{ + foo + | 1 => 2, + 3 => 4 + }) + """ + assert_format bad, good, line_length: 30 + end end end |