diff options
author | Björn-Egil Dahlberg <[email protected]> | 2014-03-06 14:32:13 +0100 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2014-03-06 14:32:13 +0100 |
commit | 1c48db25372a2bc96b5ce643913f95082c550b0c (patch) | |
tree | 4885cc3fbc8b2eb5a977f066d86078cc30df6da4 /lib/compiler/src | |
parent | 54cd909aa26fa8cbed4a7bb81919ea914ad2dcc6 (diff) | |
parent | ee03d24a84ca995a0403a385b0d808e5abce6b32 (diff) | |
download | otp-1c48db25372a2bc96b5ce643913f95082c550b0c.tar.gz otp-1c48db25372a2bc96b5ce643913f95082c550b0c.tar.bz2 otp-1c48db25372a2bc96b5ce643913f95082c550b0c.zip |
Merge branch 'nox/maps-v3_codegen-sort-nil-keys'
* nox/maps-v3_codegen-sort-nil-keys:
Properly sort map pairs in v3_codegen
Diffstat (limited to 'lib/compiler/src')
-rw-r--r-- | lib/compiler/src/v3_codegen.erl | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/compiler/src/v3_codegen.erl b/lib/compiler/src/v3_codegen.erl index e00ee1f3ad..f1331d1fe7 100644 --- a/lib/compiler/src/v3_codegen.erl +++ b/lib/compiler/src/v3_codegen.erl @@ -1551,7 +1551,11 @@ map_pair_strip_and_termsort(Es) -> %% [{map_pair,K,V}] %% where K is for example {integer, 1} and we want to sort on 1. Ls = [{K,V}||{_,K,V}<-Es], - lists:sort(fun({{_,A},_},{{_,B},_}) -> erts_internal:cmp_term(A,B) < 0 end, Ls). + lists:sort(fun ({{_,A},_}, {{_,B},_}) -> erts_internal:cmp_term(A,B) =< 0; + ({nil,_}, {{_,B},_}) -> [] =< B; + ({{_,A},_}, {nil,_}) -> A =< []; + ({nil,_}, {nil,_}) -> true + end, Ls). %%% %%% Code generation for constructing binaries. |