Skip to content

Commit b4b9ecc

Browse files
author
José Valim
committed
Remove :[] as a valid atom and do not allow remote container calls
1 parent 53b6888 commit b4b9ecc

File tree

3 files changed

+2
-11
lines changed

3 files changed

+2
-11
lines changed

lib/elixir/lib/inspect.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ defimpl Inspect, for: Atom do
100100
valid_ref_identifier?(binary) ->
101101
"Elixir." <> rest = binary
102102
rest
103-
atom in [:{}, :[], :<<>>] ->
103+
atom in [:{}, :<<>>] ->
104104
":" <> binary
105105
atom in Macro.binary_ops or atom in Macro.unary_ops ->
106106
":" <> binary

lib/elixir/src/elixir_tokenizer.erl

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
-import(elixir_interpolation, [unescape_chars/1, unescape_tokens/1]).
55

66
-define(container(T1, T2),
7-
T1 == ${, T2 == $};
8-
T1 == $[, T2 == $]
7+
T1 == ${, T2 == $}
98
).
109

1110
-define(at_op(T),
@@ -224,13 +223,6 @@ tokenize([$.,T|Tail], Line, Scope, Tokens) when ?is_space(T) ->
224223
[_|Rest] -> tokenize([$.|Rest], Line, Scope, Tokens)
225224
end;
226225

227-
% ## Containers
228-
tokenize(".<<>>" ++ Rest, Line, Scope, Tokens) ->
229-
handle_call_identifier(Rest, Line, '<<>>', Scope, Tokens);
230-
231-
tokenize([$.,T1,T2|Rest], Line, Scope, Tokens) when ?container(T1, T2) ->
232-
handle_call_identifier(Rest, Line, list_to_atom([T1, T2]), Scope, Tokens);
233-
234226
% ## Three Token Operators
235227
tokenize([$.,T1,T2,T3|Rest], Line, Scope, Tokens) when
236228
?unary_op3(T1, T2, T3); ?comp_op3(T1, T2, T3); ?and_op3(T1, T2, T3); ?or_op3(T1, T2, T3);

lib/elixir/test/elixir/inspect_test.exs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ defmodule Inspect.AtomTest do
4444

4545
test :container do
4646
assert inspect(:<<>>) == ":<<>>"
47-
assert inspect(:[]) == ":[]"
4847
assert inspect(:{}) == ":{}"
4948
end
5049
end

0 commit comments

Comments
 (0)