aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2018-06-11 15:14:30 +0200
committerLukas Larsson <[email protected]>2018-06-11 15:14:30 +0200
commita221bb53d41de10f5fcf3d5d6c0174af702c3cce (patch)
treed0468b9f989b17fe86f847b29f1bbcf7184abbcc /lib/stdlib/src
parente1d7d2d501bd1d28a3c0962d9230147503e3a1c8 (diff)
parent51f630ebd4ac92780c28748afc427c90e97d88d3 (diff)
downloadotp-a221bb53d41de10f5fcf3d5d6c0174af702c3cce.tar.gz
otp-a221bb53d41de10f5fcf3d5d6c0174af702c3cce.tar.bz2
otp-a221bb53d41de10f5fcf3d5d6c0174af702c3cce.zip
Merge branch 'jl/sharpen-maps-tests/OTP-14012'
* jl/sharpen-maps-tests/OTP-14012: stdlib: Fix error reason for maps:with/without Check for the overlap between maps and iterators
Diffstat (limited to 'lib/stdlib/src')
-rw-r--r--lib/stdlib/src/maps.erl9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/stdlib/src/maps.erl b/lib/stdlib/src/maps.erl
index a13f340709..a1634547f3 100644
--- a/lib/stdlib/src/maps.erl
+++ b/lib/stdlib/src/maps.erl
@@ -249,7 +249,7 @@ fold(Fun,Init,Map) when is_function(Fun,3), is_map(Map) ->
fold(Fun,Init,Iterator) when is_function(Fun,3), ?IS_ITERATOR(Iterator) ->
fold_1(Fun,Init,Iterator);
fold(Fun,Init,Map) ->
- erlang:error(error_type(Map),[Fun,Init,Map]).
+ erlang:error(error_type_iter(Map),[Fun,Init,Map]).
fold_1(Fun, Acc, Iter) ->
case next(Iter) of
@@ -272,7 +272,7 @@ map(Fun,Map) when is_function(Fun, 2), is_map(Map) ->
map(Fun,Iterator) when is_function(Fun, 2), ?IS_ITERATOR(Iterator) ->
maps:from_list(map_1(Fun, Iterator));
map(Fun,Map) ->
- erlang:error(error_type(Map),[Fun,Map]).
+ erlang:error(error_type_iter(Map),[Fun,Map]).
map_1(Fun, Iter) ->
case next(Iter) of
@@ -342,5 +342,8 @@ with(Ks,M) ->
erlang:error(error_type(M),[Ks,M]).
-error_type(M) when is_map(M); ?IS_ITERATOR(M) -> badarg;
+error_type(M) when is_map(M) -> badarg;
error_type(V) -> {badmap, V}.
+
+error_type_iter(M) when is_map(M); ?IS_ITERATOR(M) -> badarg;
+error_type_iter(V) -> {badmap, V}.