aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2019-08-05 11:44:35 +0200
committerJohn Högberg <[email protected]>2019-08-05 11:56:34 +0200
commit64731f3bb753f2b534ada36a4713370aecc8b4b1 (patch)
treeab7fa83a49174eb57d778b8fc0844beaaa5cf0fa /lib/compiler/test
parent4f170eeb7043838866a4eb5a518ec51a913bcbd2 (diff)
parent381ff386961aa28abaf2b43572303bd394121a7d (diff)
downloadotp-64731f3bb753f2b534ada36a4713370aecc8b4b1.tar.gz
otp-64731f3bb753f2b534ada36a4713370aecc8b4b1.tar.bz2
otp-64731f3bb753f2b534ada36a4713370aecc8b4b1.zip
Merge branch 'maint'
* maint: 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.erl22
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 326ad9042f..685e1a95a7 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},
@@ -719,6 +724,23 @@ ion_2(#ion{state = closing}) -> ok.
ion_close(State = #ion{}) -> State#ion{state = closing}.
+%% 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) ->