Skip to content

Commit d1efe7c

Browse files
arczJosé Valim
authored andcommitted
Improve error message on oversized atom (#6612)
1 parent 0494629 commit d1efe7c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/elixir/src/elixir_tokenizer.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ eol(Line, Column, Tokens) -> [{eol, {Line, Column, Column + 1}} | Tokens].
670670
unsafe_to_atom(Part, Line, #elixir_tokenizer{}) when
671671
is_binary(Part) andalso size(Part) > 255;
672672
is_list(Part) andalso length(Part) > 255 ->
673-
{error, {Line, "atom length must be less than system limit", ":"}};
673+
{error, {Line, "atom length must be less than system limit: ", [$: | Part]}};
674674
unsafe_to_atom(Binary, _Line, #elixir_tokenizer{existing_atoms_only=true}) when is_binary(Binary) ->
675675
{ok, binary_to_existing_atom(Binary, utf8)};
676676
unsafe_to_atom(Binary, _Line, #elixir_tokenizer{}) when is_binary(Binary) ->

lib/elixir/test/erlang/tokenizer_test.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ quoted_atom_test() ->
5353

5454
oversized_atom_test() ->
5555
OversizedAtom = [$: | string:copies("a", 256)],
56-
{1, "atom length must be less than system limit", ":"} = tokenize_error(OversizedAtom).
56+
{1, "atom length must be less than system limit: ", OversizedAtom} = tokenize_error(OversizedAtom).
5757

5858
op_atom_test() ->
5959
[{atom, {1, 1, 6}, f0_1}] = tokenize(":f0_1").

0 commit comments

Comments
 (0)