Skip to content

Commit

Permalink
Ensure conversion of maps to erlang ast is deterministic
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed May 19, 2023
1 parent ca0d6ad commit f9e0f25
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/elixir/src/elixir_erl.erl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ elixir_to_erl([], Ann) ->
elixir_to_erl(<<>>, Ann) ->
{bin, Ann, []};
elixir_to_erl(#{} = Map, Ann) ->
Assocs = [{map_field_assoc, Ann, elixir_to_erl(K, Ann), elixir_to_erl(V, Ann)} || {K, V} <- maps:to_list(Map)],
Assocs = [{map_field_assoc, Ann, elixir_to_erl(K, Ann), elixir_to_erl(V, Ann)}
|| {K, V} <- lists:sort(maps:to_list(Map))],
{map, Ann, Assocs};
elixir_to_erl(Tree, Ann) when is_list(Tree) ->
elixir_to_erl_cons(Tree, Ann);
Expand Down

0 comments on commit f9e0f25

Please sign in to comment.