diff options
author | John Högberg <[email protected]> | 2019-08-05 11:37:34 +0200 |
---|---|---|
committer | John Högberg <[email protected]> | 2019-08-05 11:37:34 +0200 |
commit | 381ff386961aa28abaf2b43572303bd394121a7d (patch) | |
tree | 10e29242f39c36a18b571274cac38ddce3ea2b97 /lib/compiler/test | |
parent | 7f1a25062744fb172f2b4c69085abfa374825ae0 (diff) | |
parent | 8c0bfd12802af3265d84b8bca247529633d05fcf (diff) | |
download | otp-381ff386961aa28abaf2b43572303bd394121a7d.tar.gz otp-381ff386961aa28abaf2b43572303bd394121a7d.tar.bz2 otp-381ff386961aa28abaf2b43572303bd394121a7d.zip |
Merge branch 'john/compiler/fix-delayed-type-inference/OTP-15954/ERL-995' into maint
* john/compiler/fix-delayed-type-inference/OTP-15954/ERL-995:
beam_validator: Values referenced by other values must be merged
Diffstat (limited to 'lib/compiler/test')
-rw-r--r-- | lib/compiler/test/beam_validator_SUITE.erl | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/compiler/test/beam_validator_SUITE.erl b/lib/compiler/test/beam_validator_SUITE.erl index 6b1438abdd..20f6cb2691 100644 --- a/lib/compiler/test/beam_validator_SUITE.erl +++ b/lib/compiler/test/beam_validator_SUITE.erl @@ -681,11 +681,16 @@ infer_on_eq_4(T) -> %% ERIERL-348; types were inferred for dead values, causing validation to fail. +-record(idv, {key}). + infer_dead_value(Config) when is_list(Config) -> a = idv_1({a, b, c, d, e, f, g}, {0, 0, 0, 0, 0, 0, 0}), b = idv_1({a, b, c, d, 0, 0, 0}, {a, b, c, d, 0, 0, 0}), c = idv_1({0, 0, 0, 0, 0, f, g}, {0, 0, 0, 0, 0, f, g}), error = idv_1(gurka, gaffel), + + ok = idv_2(id(#idv{})), + ok. idv_1({_A, _B, _C, _D, _E, _F, _G}, @@ -700,6 +705,23 @@ idv_1({_A, _B, _C, _D, _E, F, G}, idv_1(_A, _B) -> error. +%% ERL-995: The first solution to ERIERL-348 was incomplete and caused +%% validation to fail when living values depended on delayed type inference on +%% "dead" values. + +idv_2(State) -> + Flag = (State#idv.key == undefined), + case id(gurka) of + {_} -> id([Flag]); + _ -> ok + end, + if + Flag -> idv_called_once(State); + true -> ok + end. + +idv_called_once(_State) -> ok. + %%%------------------------------------------------------------------------- transform_remove(Remove, Module) -> |