Skip to content

Commit ad3f7d2

Browse files
committed
Sort maps and environment when escaping
1 parent 3cdb388 commit ad3f7d2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/elixir/src/elixir_expand.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ escape_env_entries(Meta, #elixir_ex{vars={Read, _}}, Env0) ->
462462

463463
Env1#{versioned_vars := escape_map(Read), line := ?line(Meta)}.
464464

465-
escape_map(Map) -> {'%{}', [], maps:to_list(Map)}.
465+
escape_map(Map) -> {'%{}', [], lists:sort(maps:to_list(Map))}.
466466

467467
expand_multi_alias_call(Kind, Meta, Base, Refs, Opts, S, E) ->
468468
{BaseRef, SB, EB} = expand_without_aliases_report(Base, S, E),

lib/elixir/src/elixir_quote.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ do_escape(BitString, _, _) when is_bitstring(BitString) ->
144144
end;
145145

146146
do_escape(Map, Q, E) when is_map(Map) ->
147-
TT = do_quote(maps:to_list(Map), Q, E),
147+
TT = do_quote(lists:sort(maps:to_list(Map)), Q, E),
148148
{'%{}', [], TT};
149149

150150
do_escape([], _, _) -> [];

0 commit comments

Comments
 (0)