File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -1583,6 +1583,10 @@ defmodule Code.Formatter do
15831583 insert_underscores ( int_part ) <> "." <> decimal_part
15841584 end
15851585
1586+ defp insert_underscores ( "-" <> digits ) do
1587+ "-" <> insert_underscores ( digits )
1588+ end
1589+
15861590 defp insert_underscores ( digits ) do
15871591 cond do
15881592 digits =~ "_" ->
Original file line number Diff line number Diff line change @@ -429,6 +429,16 @@ defmodule MacroTest do
429429 test "converts quoted to string" do
430430 assert Macro . to_string ( quote do: hello ( world ) ) == "hello(world)"
431431 end
432+
433+ test "large number literals" do
434+ # with quote
435+ assert Macro . to_string ( quote do: 576_460_752_303_423_455 ) == "576_460_752_303_423_455"
436+ assert Macro . to_string ( quote do: - 576_460_752_303_423_455 ) == "-576_460_752_303_423_455"
437+
438+ # without quote
439+ assert Macro . to_string ( 576_460_752_303_423_455 ) == "576_460_752_303_423_455"
440+ assert Macro . to_string ( - 576_460_752_303_423_455 ) == "-576_460_752_303_423_455"
441+ end
432442 end
433443
434444 describe "to_string/2" do
You can’t perform that action at this time.
0 commit comments