diff options
author | Björn Gustavsson <[email protected]> | 2017-08-16 10:40:31 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2017-08-16 10:40:31 +0200 |
commit | 5cbb54cb00d1437b8213bddf0b4e431d0c54f6a8 (patch) | |
tree | a6cc0382be205ef28c73e757aaaf5d1425c5a100 /erts/emulator/test/map_SUITE_data | |
parent | a84ddf3f9bc3fc4806ed05232a7e6446590728ca (diff) | |
parent | 17bb6bfa8d435300ee2205f1e0c20b0c6b50591a (diff) | |
download | otp-5cbb54cb00d1437b8213bddf0b4e431d0c54f6a8.tar.gz otp-5cbb54cb00d1437b8213bddf0b4e431d0c54f6a8.tar.bz2 otp-5cbb54cb00d1437b8213bddf0b4e431d0c54f6a8.zip |
Merge pull request #1535 from bjorng/bjorn/erts/opt-map-update
Slightly optimize updating of maps
Diffstat (limited to 'erts/emulator/test/map_SUITE_data')
-rw-r--r-- | erts/emulator/test/map_SUITE_data/badmap_17.beam | bin | 592 -> 1192 bytes | |||
-rw-r--r-- | erts/emulator/test/map_SUITE_data/badmap_17.erl | 36 |
2 files changed, 34 insertions, 2 deletions
diff --git a/erts/emulator/test/map_SUITE_data/badmap_17.beam b/erts/emulator/test/map_SUITE_data/badmap_17.beam Binary files differindex 277fc34b94..6f79bb8c2c 100644 --- a/erts/emulator/test/map_SUITE_data/badmap_17.beam +++ b/erts/emulator/test/map_SUITE_data/badmap_17.beam diff --git a/erts/emulator/test/map_SUITE_data/badmap_17.erl b/erts/emulator/test/map_SUITE_data/badmap_17.erl index 0ec65e0e33..887fc2e5e3 100644 --- a/erts/emulator/test/map_SUITE_data/badmap_17.erl +++ b/erts/emulator/test/map_SUITE_data/badmap_17.erl @@ -1,7 +1,7 @@ -module(badmap_17). -export([update/1]). -%% Compile this source file with OTP 17. +%% Compile this source file with OTP 17.0. update(Map) -> try @@ -17,10 +17,42 @@ update(Map) -> catch error:{badmap,Map} -> ok - end. + end, + try + update_3(Map), + error(update_did_not_fail) + catch + error:{badmap,Map} -> + ok + end, + ok = update_4(Map), + ok = update_5(Map), + ok. update_1(M) -> M#{a=>42}. update_2(M) -> M#{a:=42}. + +update_3(M) -> + id(M), + M#{a=>42}. + +update_4(M) when M#{a=>b} =:= M -> + did_not_fail; +update_4(_) -> + ok. + +update_5(M) -> + id(M), + case id(true) of + true when M#{a=>b} =:= M -> + did_not_fail; + true -> + ok + end. + +id(I) -> + I. + |