aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/beam_validator.erl
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2018-09-25 14:03:52 +0200
committerJohn Högberg <[email protected]>2018-09-25 14:25:58 +0200
commit6c968a18962ea85f9b426d98fbd3c7b3e527c038 (patch)
tree516fdb9cc836f70d8972777be1aad81a482435b3 /lib/compiler/src/beam_validator.erl
parent672a164719fe5f0e2b3185034dfc3f761b5397e9 (diff)
downloadotp-6c968a18962ea85f9b426d98fbd3c7b3e527c038.tar.gz
otp-6c968a18962ea85f9b426d98fbd3c7b3e527c038.tar.bz2
otp-6c968a18962ea85f9b426d98fbd3c7b3e527c038.zip
beam_validator: Use set_aliased_type in more operations
The following code broke because aliases weren't tracked for hd/1: bug(Bool) -> Bug = remote:call(), if Bool -> %% Branch of some kind. _ = hd(Bug), remote:call(), hd(Bug) end. Related to 1f221b27f1336e747f7409692f260055dd3ddf79
Diffstat (limited to 'lib/compiler/src/beam_validator.erl')
-rw-r--r--lib/compiler/src/beam_validator.erl8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/compiler/src/beam_validator.erl b/lib/compiler/src/beam_validator.erl
index 8d699f2abd..e76b097500 100644
--- a/lib/compiler/src/beam_validator.erl
+++ b/lib/compiler/src/beam_validator.erl
@@ -572,7 +572,7 @@ valfun_4({bif,tuple_size,{f,Fail},[Tuple],Dst}=I, Vst0) ->
TupleType0 = get_term_type(Tuple, Vst0),
Vst1 = branch_state(Fail, Vst0),
TupleType = upgrade_tuple_type({tuple,[0]}, TupleType0),
- Vst = set_type(TupleType, Tuple, Vst1),
+ Vst = set_aliased_type(TupleType, Tuple, Vst1),
set_type_reg_expr({integer,[]}, I, Dst, Vst);
valfun_4({bif,element,{f,Fail},[Pos,Tuple],Dst}, Vst0) ->
TupleType0 = get_term_type(Tuple, Vst0),
@@ -589,20 +589,20 @@ valfun_4(raw_raise=I, Vst) ->
valfun_4({bif,map_get,{f,Fail},[_Key,Map]=Src,Dst}, Vst0) ->
validate_src(Src, Vst0),
Vst1 = branch_state(Fail, Vst0),
- Vst = set_type(map, Map, Vst1),
+ Vst = set_aliased_type(map, Map, Vst1),
Type = propagate_fragility(term, Src, Vst),
set_type_reg(Type, Dst, Vst);
valfun_4({bif,is_map_key,{f,Fail},[_Key,Map]=Src,Dst}, Vst0) ->
validate_src(Src, Vst0),
Vst1 = branch_state(Fail, Vst0),
- Vst = set_type(map, Map, Vst1),
+ Vst = set_aliased_type(map, Map, Vst1),
Type = propagate_fragility(bool, Src, Vst),
set_type_reg(Type, Dst, Vst);
valfun_4({bif,Op,{f,Fail},[Cons]=Src,Dst}, Vst0)
when Op =:= hd; Op =:= tl ->
validate_src(Src, Vst0),
Vst1 = branch_state(Fail, Vst0),
- Vst = set_type(cons, Cons, Vst1),
+ Vst = set_aliased_type(cons, Cons, Vst1),
Type0 = bif_type(Op, Src, Vst),
Type = propagate_fragility(Type0, Src, Vst),
set_type_reg(Type, Dst, Vst);