diff options
author | Björn Gustavsson <[email protected]> | 2014-03-14 11:53:26 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2014-03-14 11:53:26 +0100 |
commit | dde1023b527eecaddb0c398eeed11df4e834f994 (patch) | |
tree | bdb9f7b906ddc456d39b775c6e72cff7f8cfc804 /lib/compiler/src | |
parent | 264e1eed4c3c67b3772f9b616b144e117d351044 (diff) | |
parent | 4777f33ece33aaaa5066730b950f185cbd5ae816 (diff) | |
download | otp-dde1023b527eecaddb0c398eeed11df4e834f994.tar.gz otp-dde1023b527eecaddb0c398eeed11df4e834f994.tar.bz2 otp-dde1023b527eecaddb0c398eeed11df4e834f994.zip |
Merge branch 'nox/compiler/sys_core_fold-redundant-clauses'
* nox/compiler/sys_core_fold-redundant-clauses:
Properly handle redundant boolean clauses in sys_core_fold
Diffstat (limited to 'lib/compiler/src')
-rw-r--r-- | lib/compiler/src/sys_core_fold.erl | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/compiler/src/sys_core_fold.erl b/lib/compiler/src/sys_core_fold.erl index 6fdeea51d1..058abd3357 100644 --- a/lib/compiler/src/sys_core_fold.erl +++ b/lib/compiler/src/sys_core_fold.erl @@ -1810,9 +1810,14 @@ opt_bool_clauses([#c_clause{pats=[#c_literal{val=Lit}], true -> %% This clause will match. C = C0#c_clause{body=opt_bool_case(B)}, - case Lit of - false -> [C|opt_bool_clauses(Cs, SeenT, true)]; - true -> [C|opt_bool_clauses(Cs, true, SeenF)] + case {Lit,SeenT,SeenF} of + {false,_,false} -> + [C|opt_bool_clauses(Cs, SeenT, true)]; + {true,false,_} -> + [C|opt_bool_clauses(Cs, true, SeenF)]; + _ -> + add_warning(C, nomatch_shadow), + opt_bool_clauses(Cs, SeenT, SeenF) end end; opt_bool_clauses([#c_clause{pats=Ps,guard=#c_literal{val=true}}=C|Cs], SeenT, SeenF) -> |