aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2019-02-13 08:58:01 +0100
committerBjörn Gustavsson <[email protected]>2019-02-13 09:55:02 +0100
commit5c4e24725e1f4b2db89b8f58423a0ba29132faf9 (patch)
tree036214f8cc9d829a5bca12b28c1b2601cfa8f979 /lib/compiler
parent485713afa0d2481e93882bc386aebb06a49c04bc (diff)
downloadotp-5c4e24725e1f4b2db89b8f58423a0ba29132faf9.tar.gz
otp-5c4e24725e1f4b2db89b8f58423a0ba29132faf9.tar.bz2
otp-5c4e24725e1f4b2db89b8f58423a0ba29132faf9.zip
Make dialyzer faster for left-associative andalso/orelse expressions
https://bugs.erlang.org/browse/ERL-851
Diffstat (limited to 'lib/compiler')
-rw-r--r--lib/compiler/src/v3_core.erl6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/compiler/src/v3_core.erl b/lib/compiler/src/v3_core.erl
index 27131bc3ab..66e578b776 100644
--- a/lib/compiler/src/v3_core.erl
+++ b/lib/compiler/src/v3_core.erl
@@ -766,14 +766,16 @@ expr({op,_,'++',{lc,Llc,E,Qs0},More}, St0) ->
{Qs,St2} = preprocess_quals(Llc, Qs0, St1),
{Y,Yps,St} = lc_tq(Llc, E, Qs, Mc, St2),
{Y,Mps++Yps,St};
-expr({op,L,'andalso',E1,E2}, St0) ->
+expr({op,_,'andalso',_,_}=E0, St0) ->
+ {op,L,'andalso',E1,E2} = right_assoc(E0, 'andalso', St0),
Anno = lineno_anno(L, St0),
{#c_var{name=V0},St} = new_var(Anno, St0),
V = {var,L,V0},
False = {atom,L,false},
E = make_bool_switch(L, E1, V, E2, False, St0),
expr(E, St);
-expr({op,L,'orelse',E1,E2}, St0) ->
+expr({op,_,'orelse',_,_}=E0, St0) ->
+ {op,L,'orelse',E1,E2} = right_assoc(E0, 'orelse', St0),
Anno = lineno_anno(L, St0),
{#c_var{name=V0},St} = new_var(Anno, St0),
V = {var,L,V0},