Elixir and Erlang/OTP versions
Erlang/OTP 26 [erts-14.2.5.2] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]
Elixir 1.17.2 (compiled with Erlang/OTP 26)
Operating system
any
Current behavior
- It returns
local_or_var
for atom keys in list, map, etc
iex(5)> Code.Fragment.surround_context("%{foo: 1}", {1, 3})
%{context: {:local_or_var, ~c"foo"}, begin: {1, 3}, end: {1, 6}}
for ordinary atoms it returns unquoted_atom
iex(8)> Code.Fragment.surround_context(":foo", {1, 1})
%{context: {:unquoted_atom, ~c"foo"}, begin: {1, 1}, end: {1, 5}}
- It is finding only
&
operator but in this context &
is not an operator but a part of a special variable &123
iex(1)> Code.Fragment.surround_context("&123", {1, 1})
%{context: {:operator, ~c"&"}, begin: {1, 1}, end: {1, 2}}
iex(2)> Code.Fragment.surround_context("&123", {1, 2})
:none
Expected behavior
- I would expect it to return
unquoted_atom
or more specific unquoted_atom_key
- Here more appropriate would be
local_or_var
or something dedicated