diff options
author | John Högberg <[email protected]> | 2019-01-25 09:41:12 +0100 |
---|---|---|
committer | John Högberg <[email protected]> | 2019-01-25 09:41:12 +0100 |
commit | 7160deffbc2828b13ef5e1162d76b0b8851bab55 (patch) | |
tree | d7f1765a708099bf436cd60b4448e2f136c7aa37 /lib/compiler | |
parent | 677efa620e85bd78317c139dcb11efb3ea42d16e (diff) | |
parent | bd6a3d3c574644151ecc4d919673bb0526c94bd0 (diff) | |
download | otp-7160deffbc2828b13ef5e1162d76b0b8851bab55.tar.gz otp-7160deffbc2828b13ef5e1162d76b0b8851bab55.tar.bz2 otp-7160deffbc2828b13ef5e1162d76b0b8851bab55.zip |
Merge branch 'john/compiler/misc-validator-fixes/ERL-832'
* john/compiler/misc-validator-fixes/ERL-832:
Make the beam_validator smarter again, again
Diffstat (limited to 'lib/compiler')
-rw-r--r-- | lib/compiler/src/beam_validator.erl | 2 | ||||
-rw-r--r-- | lib/compiler/test/beam_validator_SUITE.erl | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/lib/compiler/src/beam_validator.erl b/lib/compiler/src/beam_validator.erl index 15ed267c54..4081e366a5 100644 --- a/lib/compiler/src/beam_validator.erl +++ b/lib/compiler/src/beam_validator.erl @@ -871,7 +871,7 @@ valfun_4({test,is_map,{f,Lbl},[Src]}, Vst0) -> valfun_4({test,is_nil,{f,Lbl},[Src]}, Vst0) -> Vst = case get_term_type(Src, Vst0) of list -> - branch_state(Lbl, set_type_reg(cons, Src, Vst0)); + branch_state(Lbl, set_aliased_type(cons, Src, Vst0)); _ -> branch_state(Lbl, Vst0) end, diff --git a/lib/compiler/test/beam_validator_SUITE.erl b/lib/compiler/test/beam_validator_SUITE.erl index c9df066958..585d0e7191 100644 --- a/lib/compiler/test/beam_validator_SUITE.erl +++ b/lib/compiler/test/beam_validator_SUITE.erl @@ -586,6 +586,9 @@ aliased_types(Config) -> {1,1} = aliased_types_2(Seq), {42,none} = aliased_types_2([]), + gurka = aliased_types_3([gurka]), + gaffel = aliased_types_3([gaffel]), + ok. %% ERL-735: validator failed to track types on aliased registers, rejecting @@ -614,6 +617,20 @@ aliased_types_2(Bug) -> _ -> hd(Bug) end}. +%% ERL-832 part deux; validator failed to realize that an aliased register was +%% a cons. +aliased_types_3(Bug) -> + List = [Y || Y <- Bug], + case List of + [] -> Bug; + _ -> + if + hd(List) -> a:a(); + true -> ok + end, + hd(List) + end. + %%%------------------------------------------------------------------------- transform_remove(Remove, Module) -> |