aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2019-02-19 10:40:31 +0100
committerJohn Högberg <[email protected]>2019-02-20 18:40:24 +0100
commit342e110030aecdf63341909369acefd736a36e57 (patch)
treea4b8ebc587af13c5df9ce3680f07789cce145bfd /lib
parent2550311b4c00f33c959d98c20d3832008e80366b (diff)
downloadotp-342e110030aecdf63341909369acefd736a36e57.tar.gz
otp-342e110030aecdf63341909369acefd736a36e57.tar.bz2
otp-342e110030aecdf63341909369acefd736a36e57.zip
beam_validator: Remove special handling of map_get/is_map_key
Neither can be used for type subtraction, so the default BIF handler suits them just fine.
Diffstat (limited to 'lib')
-rw-r--r--lib/compiler/src/beam_validator.erl12
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/compiler/src/beam_validator.erl b/lib/compiler/src/beam_validator.erl
index 9985e29725..7cb9fce386 100644
--- a/lib/compiler/src/beam_validator.erl
+++ b/lib/compiler/src/beam_validator.erl
@@ -624,16 +624,6 @@ valfun_4({bif,raise,{f,0},Src,_Dst}, Vst) ->
kill_state(Vst);
valfun_4(raw_raise=I, Vst) ->
call(I, 3, Vst);
-valfun_4({bif,map_get,{f,Fail},[_Key,Map]=Ss,Dst}, Vst0) ->
- validate_src(Ss, Vst0),
- Vst1 = branch_state(Fail, Vst0),
- Vst = update_type(fun meet/2, map, Map, Vst1),
- extract_term(term, Ss, Dst, Vst);
-valfun_4({bif,is_map_key,{f,Fail},[_Key,Map]=Ss,Dst}, Vst0) ->
- validate_src(Ss, Vst0),
- Vst1 = branch_state(Fail, Vst0),
- Vst = update_type(fun meet/2, map, Map, Vst1),
- extract_term(bool, Ss, Dst, Vst);
valfun_4({bif,Op,{f,Fail},[Cons]=Ss,Dst}, Vst0)
when Op =:= hd; Op =:= tl ->
validate_src(Ss, Vst0),
@@ -2323,6 +2313,8 @@ bif_return_type(Bif, _, _) when is_atom(Bif) -> term.
%% Generic
bif_arg_types(tuple_size, [_]) -> [{tuple,[0],#{}}];
bif_arg_types(map_size, [_]) -> [map];
+bif_arg_types(is_map_key, [_,_]) -> [term, map];
+bif_arg_types(map_get, [_,_]) -> [term, map];
bif_arg_types(length, [_]) -> [list];
bif_arg_types(hd, [_]) -> [cons];
bif_arg_types(tl, [_]) -> [cons];