File 8771-Remove-and-or-in-stdlib.patch of Package erlang
From 04c39c48b1d16208e6e54848f4d462c9c5227fd9 Mon Sep 17 00:00:00 2001
From: Maria Scott <maria-12648430@hnc-agency.org>
Date: Thu, 22 Jan 2026 13:42:20 +0100
Subject: [PATCH 1/3] Remove and/or in stdlib
Co-authored-by: Jan Uhlig <juhlig@hnc-agency.org>
---
lib/stdlib/examples/erl_id_trans.erl | 14 +++---
lib/stdlib/src/dets.erl | 1 -
lib/stdlib/src/dets_v9.erl | 1 -
lib/stdlib/src/erl_error.erl | 4 +-
lib/stdlib/src/erl_eval.erl | 3 +-
lib/stdlib/src/erl_lint.erl | 8 ++--
lib/stdlib/src/erl_pp.erl | 4 +-
lib/stdlib/src/erl_stdlib_errors.erl | 4 +-
lib/stdlib/src/erl_tar.erl | 4 +-
lib/stdlib/src/escript.erl | 4 +-
lib/stdlib/src/filename.erl | 4 +-
lib/stdlib/src/io_lib_fread.erl | 5 +-
lib/stdlib/src/io_lib_pretty.erl | 8 ++--
lib/stdlib/src/ms_transform.erl | 13 +++--
lib/stdlib/src/proc_lib.erl | 3 +-
lib/stdlib/src/qlc.erl | 19 ++++----
lib/stdlib/src/qlc_pt.erl | 3 +-
lib/stdlib/src/shell.erl | 3 +-
lib/stdlib/src/shell_docs.erl | 4 +-
lib/stdlib/src/sofs.erl | 11 ++---
lib/stdlib/src/unicode.erl | 5 +-
lib/stdlib/test/beam_lib_SUITE.erl | 4 +-
lib/stdlib/test/binary_module_SUITE.erl | 19 ++++----
lib/stdlib/test/binref.erl | 14 +++---
lib/stdlib/test/erl_eval_SUITE.erl | 6 +--
lib/stdlib/test/erl_lint_SUITE.erl | 2 -
lib/stdlib/test/erl_pp_SUITE.erl | 4 +-
lib/stdlib/test/ets_SUITE.erl | 6 +--
lib/stdlib/test/id_transform_SUITE.erl | 26 +++++-----
lib/stdlib/test/io_SUITE.erl | 4 +-
lib/stdlib/test/ms_transform_SUITE.erl | 6 +--
lib/stdlib/test/run_old_pcre1_tests.erl | 64 +++++--------------------
lib/stdlib/test/run_pcre_tests.erl | 14 +++---
lib/stdlib/test/select_SUITE.erl | 6 +--
lib/stdlib/test/supervisor_SUITE.erl | 7 +--
35 files changed, 105 insertions(+), 202 deletions(-)
diff --git a/lib/stdlib/examples/erl_id_trans.erl b/lib/stdlib/examples/erl_id_trans.erl
index fa98cb4371..8b1d156406 100644
--- a/lib/stdlib/examples/erl_id_trans.erl
+++ b/lib/stdlib/examples/erl_id_trans.erl
@@ -335,9 +335,9 @@ gexpr({call,Line,{atom,La,F},As0}) ->
end;
% Guard bif's can be remote, but only in the module erlang...
gexpr({call,Line,{remote,La,{atom,Lb,erlang},{atom,Lc,F}},As0}) ->
- case erl_internal:guard_bif(F, length(As0)) or
- erl_internal:arith_op(F, length(As0)) or
- erl_internal:comp_op(F, length(As0)) or
+ case erl_internal:guard_bif(F, length(As0)) orelse
+ erl_internal:arith_op(F, length(As0)) orelse
+ erl_internal:comp_op(F, length(As0)) orelse
erl_internal:bool_op(F, length(As0)) of
true -> As1 = gexpr_list(As0),
{call,Line,{remote,La,{atom,Lb,erlang},{atom,Lc,F}},As1}
@@ -346,7 +346,7 @@ gexpr({bin,Line,Fs}) ->
Fs2 = pattern_grp(Fs),
{bin,Line,Fs2};
gexpr({op,Line,Op,A0}) ->
- case erl_internal:arith_op(Op, 1) or
+ case erl_internal:arith_op(Op, 1) orelse
erl_internal:bool_op(Op, 1) of
true -> A1 = gexpr(A0),
{op,Line,Op,A1}
@@ -357,8 +357,8 @@ gexpr({op,Line,Op,L0,R0}) when Op =:= 'andalso'; Op =:= 'orelse' ->
R1 = gexpr(R0), %They see the same variables
{op,Line,Op,L1,R1};
gexpr({op,Line,Op,L0,R0}) ->
- case erl_internal:arith_op(Op, 2) or
- erl_internal:bool_op(Op, 2) or
+ case erl_internal:arith_op(Op, 2) orelse
+ erl_internal:bool_op(Op, 2) orelse
erl_internal:comp_op(Op, 2) of
true ->
L1 = gexpr(L0),
diff --git a/lib/stdlib/src/erl_error.erl b/lib/stdlib/src/erl_error.erl
index e41862369e..7007edfda9 100644
--- a/lib/stdlib/src/erl_error.erl
+++ b/lib/stdlib/src/erl_error.erl
@@ -568,7 +566,7 @@ format_call(ErrStr, Pre1, ForMForFun, As, PF, Enc, CL) ->
S2 = pp_arguments(PF, As, string:length([Pre1|MFs]), Enc, CL),
S3 = pp_arguments(PF, [a2345,b2345], I1, Enc, CL),
Long = count_nl(S3) > 0,
- case Long or (count_nl(S2) < count_nl(S1)) of
+ case Long orelse count_nl(S2) < count_nl(S1) of
true ->
[$\n, Pre1, MFs, S2];
false ->
diff --git a/lib/stdlib/src/erl_eval.erl b/lib/stdlib/src/erl_eval.erl
index 42867b8769..53148e382c 100644
--- a/lib/stdlib/src/erl_eval.erl
+++ b/lib/stdlib/src/erl_eval.erl
@@ -732,7 +731,7 @@ find_maxline(LC) ->
put('$erl_eval_max_line', 0),
F = fun(A) ->
L = erl_anno:line(A),
- case is_integer(L) and (L > get('$erl_eval_max_line')) of
+ case is_integer(L) andalso L > get('$erl_eval_max_line') of
true -> put('$erl_eval_max_line', L);
false -> ok
end end,
diff --git a/lib/stdlib/src/erl_lint.erl b/lib/stdlib/src/erl_lint.erl
index ed8fb60406..aa643b1fee 100644
--- a/lib/stdlib/src/erl_lint.erl
+++ b/lib/stdlib/src/erl_lint.erl
@@ -1476,12 +1476,12 @@ import(Line, {Mod,Fs}, St00) ->
AutoImpSup = is_autoimport_suppressed(St0#lint.no_auto,{F,A}),
OldBif = erl_internal:old_bif(F,A),
{Err,if
- Warn and (not AutoImpSup) and OldBif ->
+ Warn, not AutoImpSup, OldBif ->
add_error
(Line,
{redefine_old_bif_import, {F,A}},
St0);
- Warn and (not AutoImpSup) ->
+ Warn, not AutoImpSup ->
add_warning
(Line,
{redefine_bif_import, {F,A}},
@@ -2017,7 +2017,7 @@ bit_type(Line, Size0, Type, St) ->
bit_size_check(_Line, unknown, _, St) -> {unknown,St};
bit_size_check(_Line, undefined, #bittype{type=Type}, St) ->
- true = (Type =:= utf8) or (Type =:= utf16) or (Type =:= utf32), %Assertion.
+ true = Type =:= utf8 orelse Type =:= utf16 orelse Type =:= utf32, %Assertion.
{undefined,St};
bit_size_check(Line, all, #bittype{type=Type}, St) ->
case Type of
@@ -2306,7 +2306,7 @@ is_gexpr({record,L,Name,Inits}, Info) ->
is_gexpr_fields(Inits, L, Name, Info);
is_gexpr({bin,_L,Fs}, Info) ->
all(fun ({bin_element,_Line,E,Sz,_Ts}) ->
- is_gexpr(E, Info) and (Sz =:= default orelse is_gexpr(Sz, Info))
+ is_gexpr(E, Info) andalso (Sz =:= default orelse is_gexpr(Sz, Info))
end, Fs);
is_gexpr({call,_L,{atom,_Lf,F},As}, {_,IsOverridden}=Info) ->
A = length(As),
diff --git a/lib/stdlib/src/erl_pp.erl b/lib/stdlib/src/erl_pp.erl
index 49018be811..a5de92d705 100644
--- a/lib/stdlib/src/erl_pp.erl
+++ b/lib/stdlib/src/erl_pp.erl
@@ -1430,7 +1428,7 @@ write_a_string([], _N, _Len, _PP) ->
write_a_string(S, N, Len, PP) ->
SS = string:slice(S, 0, N),
Sl = write_string(SS, PP),
- case (string:length(Sl) > Len) and (N > ?MIN_SUBSTRING) of
+ case string:length(Sl) > Len andalso N > ?MIN_SUBSTRING of
true ->
write_a_string(S, N-1, Len, PP);
false ->
diff --git a/lib/stdlib/src/erl_tar.erl b/lib/stdlib/src/erl_tar.erl
index 0128cb66a5..4dca903eb1 100644
--- a/lib/stdlib/src/erl_tar.erl
+++ b/lib/stdlib/src/erl_tar.erl
@@ -722,7 +720,7 @@ The options in `OptionList` modify the defaults as follows:
-spec create(file:filename_all(), filelist(), [create_opt()]) ->
ok | {error, term()} | {error, {string(), term()}}.
create(Name, FileList, Options) when is_list(Name); is_binary(Name) ->
- Mode = lists:filter(fun(X) -> (X=:=compressed) or (X=:=cooked)
+ Mode = lists:filter(fun(X) -> X=:=compressed orelse X=:=cooked
end, Options),
case open(Name, [write|Mode]) of
{ok, TarFile} ->
diff --git a/lib/stdlib/src/escript.erl b/lib/stdlib/src/escript.erl
index a65fae62b2..7f36ee1247 100644
--- a/lib/stdlib/src/escript.erl
+++ b/lib/stdlib/src/escript.erl
@@ -1036,7 +1034,7 @@ format_exception(Class, Reason, StackTrace) ->
PF = fun(Term, I) ->
io_lib:format("~." ++ integer_to_list(I) ++ P, [Term, 50])
end,
- StackFun = fun(M, _F, _A) -> (M =:= erl_eval) or (M =:= ?MODULE) end,
+ StackFun = fun(M, _F, _A) -> M =:= erl_eval orelse M =:= ?MODULE end,
erl_error:format_exception(1, Class, Reason, StackTrace, StackFun, PF, Enc).
encoding() ->
diff --git a/lib/stdlib/src/filename.erl b/lib/stdlib/src/filename.erl
index e4ed474ac9..89ac6394a9 100644
--- a/lib/stdlib/src/filename.erl
+++ b/lib/stdlib/src/filename.erl
@@ -785,7 +783,7 @@ Returns the path type, which is one of the following:
Path :: file:name_all().
pathtype(Atom) when is_atom(Atom) ->
pathtype(atom_to_list(Atom));
-pathtype(Name) when is_list(Name) or is_binary(Name) ->
+pathtype(Name) when is_list(Name); is_binary(Name) ->
case os:type() of
{win32, _} ->
win32_pathtype(Name);
diff --git a/lib/stdlib/src/io_lib_fread.erl b/lib/stdlib/src/io_lib_fread.erl
index df58b8c384..77634b37ae 100644
--- a/lib/stdlib/src/io_lib_fread.erl
+++ b/lib/stdlib/src/io_lib_fread.erl
@@ -209,7 +208,7 @@ fread1([$#|Format], none, Sup, false, Line0, N0, Res) ->
begin
{Line1,N1,B1} = fread_base(Line0, N0),
B = abs(B1),
- true = (B >= 2) and (B =< 1+$Z-$A+10),
+ true = B >= 2 andalso B =< 1+$Z-$A+10,
{Line2,N2,Cs2} = fread_digits(Line1, N1, B, []),
fread_based(reverse(Cs2), B1, Sup, Format, Line2, N2, Res)
end of
@@ -223,7 +222,7 @@ fread1([$#|Format], F, Sup, false, Line0, N, Res) ->
begin
{Line1,Cs1} = fread_chars(Line0, F, false),
{Line2,_,B2} = fread_base(reverse(Cs1), N),
- true = ((B2 >= 2) and (B2 =< 1+$Z-$A+10)),
+ true = B2 >= 2 andalso B2 =< 1+$Z-$A+10,
fread_based(Line2, B2, Sup, Format, Line1, N+F, Res)
end of
{'EXIT',_} ->
diff --git a/lib/stdlib/src/io_lib_pretty.erl b/lib/stdlib/src/io_lib_pretty.erl
index c74ac4f961..403bd35c35 100644
--- a/lib/stdlib/src/io_lib_pretty.erl
+++ b/lib/stdlib/src/io_lib_pretty.erl
@@ -359,7 +357,7 @@ pp_field({{field, Name, NameL, F},_,_, _}, Col0, Ll, M, TInd, Ind0, LD, W0) ->
rec_indent(RInd, TInd, Col0, Ind0, W0) ->
%% this uses TInd
- Nl = (TInd > 0) and (RInd > TInd),
+ Nl = TInd > 0 andalso RInd > TInd,
DCol = case Nl of
true -> TInd;
false -> RInd
@@ -980,7 +978,7 @@ print_length_tuple(Tuple, 1, _T, RF, Enc, Str, Ord) ->
{"{...}", 5, 3, More};
print_length_tuple(Tuple, D, T, RF, Enc, Str) ->
L = print_length_tuple1(Tuple, 1, D, tsub(T, 2), RF, Enc, Str),
- IsTagged = is_atom(element(1, Tuple)) and (tuple_size(Tuple) > 1),
+ IsTagged = is_atom(element(1, Tuple)) andalso tuple_size(Tuple) > 1,
{Len, Dots} = list_length(L, 2, 0),
{{tuple,IsTagged,L}, Len, Dots, no_more}.
@@ -1496,7 +1494,7 @@ cind_field({{field, _Name, NameL, F},_Len,_,_}, Col0, Ll, M, Ind, LD, W0) ->
Ll.
cind_rec(RInd, Col0, Ll, M, Ind, W0) ->
- Nl = (Ind > 0) and (RInd > Ind),
+ Nl = Ind > 0 andalso RInd > Ind,
DCol = case Nl of
true -> Ind;
false -> RInd
diff --git a/lib/stdlib/src/ms_transform.erl b/lib/stdlib/src/ms_transform.erl
index ea86858d8f..22e7f30ceb 100644
--- a/lib/stdlib/src/ms_transform.erl
+++ b/lib/stdlib/src/ms_transform.erl
@@ -1028,7 +1027,7 @@ pseudo_guard_function(get_tcw,0) -> true;
pseudo_guard_function(_,_) -> false.
guard_function(X,A) ->
- real_guard_function(X,A) or pseudo_guard_function(X,A).
+ real_guard_function(X,A) orelse pseudo_guard_function(X,A).
action_function(set_seq_token,2) -> true;
action_function(get_seq_token,0) -> true;
@@ -1117,17 +1116,17 @@ cmp_operator(_,_) ->
false.
is_operator(X,A,_) ->
- bool_operator(X,A) or arith_operator(X,A) or cmp_operator(X,A).
+ bool_operator(X,A) orelse arith_operator(X,A) orelse cmp_operator(X,A).
is_imported_from_erlang(X,A,_) ->
- real_guard_function(X,A) or bool_test(X,A) or bool_operator(X,A) or
- arith_operator(X,A) or cmp_operator(X,A).
+ real_guard_function(X,A) orelse bool_test(X,A) orelse bool_operator(X,A) orelse
+ arith_operator(X,A) orelse cmp_operator(X,A).
is_ms_function(X,A,body) ->
- action_function(X,A) or guard_function(X,A) or bool_test(X,A);
+ action_function(X,A) orelse guard_function(X,A) orelse bool_test(X,A);
is_ms_function(X,A,guard) ->
- guard_function(X,A) or bool_test(X,A).
+ guard_function(X,A) orelse bool_test(X,A).
fixup_environment(L,B) when is_list(L) ->
lists:map(fun(X) ->
diff --git a/lib/stdlib/src/proc_lib.erl b/lib/stdlib/src/proc_lib.erl
index b6470e7d4c..cb3fcf148e 100644
--- a/lib/stdlib/src/proc_lib.erl
+++ b/lib/stdlib/src/proc_lib.erl
@@ -1444,7 +1443,7 @@ format_rep(_, _, _Extra, _Limit) ->
format_exception(Class, Reason, StackTrace, Extra, Limit) ->
#{encoding:=Enc,depth:=Depth, single_line:=Single} = Extra,
- StackFun = fun(M, _F, _A) -> (M =:= erl_eval) or (M =:= ?MODULE) end,
+ StackFun = fun(M, _F, _A) -> M =:= erl_eval orelse M =:= ?MODULE end,
if Single ->
{P,Tl} = p(Enc,Depth),
Opts = chars_limit_opt(Limit),
diff --git a/lib/stdlib/src/qlc.erl b/lib/stdlib/src/qlc.erl
index 227b324343..711c47b6c6 100644
--- a/lib/stdlib/src/qlc.erl
+++ b/lib/stdlib/src/qlc.erl
@@ -2239,7 +2238,7 @@ prep_le(#qlc_lc{lc = LC_fun, opt = #qlc_opt{} = Opt0}=H, GOpt) ->
#qlc_opt{unique = GUnique, cache = GCache,
tmpdir = TmpDir, max_list = MaxList,
tmpdir_usage = TmpUsage} = GOpt,
- Unique = Opt0#qlc_opt.unique or GUnique,
+ Unique = Opt0#qlc_opt.unique orelse GUnique,
Cache = if
not GCache -> Opt0#qlc_opt.cache;
true -> GCache
@@ -2254,7 +2253,7 @@ prep_le(#qlc_table{info_fun = IF}=T, GOpt) ->
Prep = #prepared{qh = T, sort_info = SortInfo, sorted = Sorted,
is_unique_objects = IsUnique},
Opt = if
- IsUnique or not GOpt#qlc_opt.unique,
+ IsUnique orelse not GOpt#qlc_opt.unique,
T#qlc_table.ms =:= no_match_spec ->
GOpt#qlc_opt{cache = false};
true ->
@@ -2424,8 +2423,8 @@ may_create_simple(#qlc_opt{unique = Unique, cache = Cache} = Opt,
#prepared{is_cached = IsCached,
is_unique_objects = IsUnique} = Prep) ->
if
- Unique and not IsUnique;
- (Cache =/= false) and not IsCached ->
+ Unique andalso not IsUnique;
+ Cache =/= false andalso not IsCached ->
prep_simple_qlc(?SIMPLE_QVAR, anno(1), Prep, Opt);
true ->
Prep
@@ -2442,14 +2441,14 @@ prep_simple_qlc(PVar, Anno, LE, Opt) ->
not IsCached -> Cache;
true -> false
end,
- Optz = #optz{unique = Unique and not IsUnique,
+ Optz = #optz{unique = Unique andalso not IsUnique,
cache = Cachez, opt = Opt},
QLC = #simple_qlc{p = PVar, le = LE, line = Line,
init_value = not_a_list, optz = Optz},
%% LE#prepared.join is not copied
- #prepared{qh = QLC, is_unique_objects = IsUnique or Unique,
+ #prepared{qh = QLC, is_unique_objects = IsUnique orelse Unique,
sort_info = SortInfo, sorted = Sorted,
- is_cached = IsCached or (Cachez =/= false)}.
+ is_cached = IsCached orelse Cachez =/= false}.
prep_sort(#qlc_sort{h = #prepared{sorted = yes}=Prep}, _GOpt) ->
Prep;
@@ -2461,7 +2460,7 @@ prep_sort(#qlc_sort{h = #prepared{is_unique_objects = IsUniqueObjs}}=Q,
{SortInfo, Sorted} = sort_sort_info(S),
#prepared{qh = S, is_cached = true, sort_info = SortInfo,
sorted = Sorted,
- is_unique_objects = S#qlc_sort.unique or IsUniqueObjs}.
+ is_unique_objects = S#qlc_sort.unique orelse IsUniqueObjs}.
prep_qlc(QFun, CodeF, Qdata0, QOpt, Opt) ->
#qlc_opt{unique = Unique, cache = Cache, join = Join} = Opt,
@@ -2807,7 +2806,7 @@ opt_le(#prepared{qh = #simple_qlc{le = LE0, optz = Optz0}=QLC}=Prep0,
Cache2 -> Cache2
end,
Optz = Optz0#optz{cache = Cachez,
- unique = Optz0#optz.unique or Optz2#optz.unique},
+ unique = Optz0#optz.unique orelse Optz2#optz.unique},
PVar = if
LE_Pvar =:= ?SIMPLE_QVAR -> QLC#simple_qlc.p;
true -> LE_Pvar
diff --git a/lib/stdlib/src/qlc_pt.erl b/lib/stdlib/src/qlc_pt.erl
index 5533c52d89..7af6a40885 100644
--- a/lib/stdlib/src/qlc_pt.erl
+++ b/lib/stdlib/src/qlc_pt.erl
@@ -854,7 +853,7 @@ opt_info(TemplateInfo, Sizes, JoinInfo, MSQs, Anno,
opt_column_constants(ColumnConstants0) ->
[CC || {{IdNo,_Col},Const,_FilNs}=CC <- ColumnConstants0,
- (IdNo =/= ?TNO) or (length(Const) =:= 1)].
+ IdNo =/= ?TNO orelse length(Const) =:= 1].
opt_constants(L, ColumnConstants) ->
Ns = lists:usort([IdNo || {{IdNo,_Col},_Const,_FilNs} <- ColumnConstants]),
diff --git a/lib/stdlib/src/shell.erl b/lib/stdlib/src/shell.erl
index bbefefaaa3..dd895b3c66 100644
--- a/lib/stdlib/src/shell.erl
+++ b/lib/stdlib/src/shell.erl
@@ -866,7 +865,7 @@ report_exception(Class, Severity, {Reason,Stacktrace}, RT) ->
Tag = severity_tag(Severity),
I = iolist_size(Tag) + 1,
PF = fun(Term, I1) -> pp(Term, I1, RT) end,
- SF = fun(M, _F, _A) -> (M =:= erl_eval) or (M =:= ?MODULE) end,
+ SF = fun(M, _F, _A) -> M =:= erl_eval orelse M =:= ?MODULE end,
Enc = encoding(),
Str = erl_error:format_exception(I, Class, Reason, Stacktrace, SF, PF, Enc),
io:requests([{put_chars, latin1, Tag},
diff --git a/lib/stdlib/src/shell_docs.erl b/lib/stdlib/src/shell_docs.erl
index 6d6e9f1e3c..cab7cf5b6c 100644
--- a/lib/stdlib/src/shell_docs.erl
+++ b/lib/stdlib/src/shell_docs.erl
@@ -224,7 +222,7 @@ validate_docs({Tag,Attr,Content},Path) ->
ok
end,
%% Test that there are no block tags within a pre, h*
- case lists:member(pre,Path) or
+ case lists:member(pre,Path) orelse
lists:any(fun(H) -> lists:member(H,Path) end, [h1,h2,h3,h4,h5,h6]) of
true when ?IS_BLOCK(Tag) ->
throw({cannot_put_block_tag_within_pre,Tag,Path});
diff --git a/lib/stdlib/src/sofs.erl b/lib/stdlib/src/sofs.erl
index ba896e69a7..f214b5643e 100644
--- a/lib/stdlib/src/sofs.erl
+++ b/lib/stdlib/src/sofs.erl
@@ -1649,7 +1648,7 @@ element E in `Set` that does not belong to the [domain](`m:sofs#domain`) of
extension(R, S, E) when ?IS_SET(R), ?IS_SET(S) ->
case {?TYPE(R), ?TYPE(S), is_sofs_set(E)} of
{T=?BINREL(DT, RT), ST, true} ->
- case match_types(DT, ST) and match_types(RT, type(E)) of
+ case match_types(DT, ST) andalso match_types(RT, type(E)) of
false ->
erlang:error(type_mismatch);
true ->
@@ -2378,7 +2377,7 @@ and `Relation2` on coordinates `I` and `J`.
J :: pos_integer()).
join(R1, I1, R2, I2)
when ?IS_SET(R1), ?IS_SET(R2), is_integer(I1), is_integer(I2) ->
- case test_rel(R1, I1, lte) and test_rel(R2, I2, lte) of
+ case test_rel(R1, I1, lte) andalso test_rel(R2, I2, lte) of
false -> erlang:error(badarg);
true when ?TYPE(R1) =:= ?ANYTYPE -> R1;
true when ?TYPE(R2) =:= ?ANYTYPE -> R2;
@@ -2386,7 +2385,7 @@ join(R1, I1, R2, I2)
L1 = ?LIST(raise_element(R1, I1)),
L2 = ?LIST(raise_element(R2, I2)),
T = relprod1(L1, L2),
- F = case (I1 =:= 1) and (I2 =:= 1) of
+ F = case I1 =:= 1 andalso I2 =:= 1 of
true ->
fun({X,Y}) -> join_element(X, Y) end;
false ->
@@ -3034,7 +3033,7 @@ ordset_of_sets(_, _L, _T) ->
%% Inlined.
rel(Ts, [Type]) ->
- case is_type(Type) and atoms_only(Type, 1) of
+ case is_type(Type) andalso atoms_only(Type, 1) of
true ->
rel(Ts, tuple_size(Type), Type);
false ->
@@ -3518,7 +3517,7 @@ relprod_n(RL, R, EmptyR, IsR) ->
Error = {error, _Reason} ->
Error;
DType ->
- Empty = any(fun is_empty_set/1, RL) or EmptyR,
+ Empty = any(fun is_empty_set/1, RL) orelse EmptyR,
RType = range_type(RL, []),
Type = ?BINREL(DType, RType),
Prod =
diff --git a/lib/stdlib/src/unicode.erl b/lib/stdlib/src/unicode.erl
index 7c016ca38c..cc75d2fed3 100644
--- a/lib/stdlib/src/unicode.erl
+++ b/lib/stdlib/src/unicode.erl
@@ -982,7 +981,7 @@ cbv({utf32,big}, <<0:8>>) ->
cbv({utf32,big}, <<0:8,X:8>>) when X =< 16 ->
2;
cbv({utf32,big}, <<0:8,X:8,Y:8>>)
- when X =< 16, ((X > 0) or ((Y =< 215) or (Y >= 224))) ->
+ when X =< 16, X > 0 orelse Y =< 215 orelse Y >= 224 ->
1;
cbv({utf32,big},_) ->
false;
@@ -993,7 +992,7 @@ cbv({utf32,little},<<_:8,_:8>>) ->
cbv({utf32,little},<<X:8,255:8,0:8>>) when X =:= 254; X =:= 255 ->
false;
cbv({utf32,little},<<_:8,Y:8,X:8>>)
- when X =< 16, ((X > 0) or ((Y =< 215) or (Y >= 224))) ->
+ when X =< 16, X > 0 orelse Y =< 215 orelse Y >= 224 ->
1;
cbv({utf32,little},_) ->
false.
diff --git a/lib/stdlib/test/beam_lib_SUITE.erl b/lib/stdlib/test/beam_lib_SUITE.erl
index 3e29c57173..9f9e00bc03 100644
--- a/lib/stdlib/test/beam_lib_SUITE.erl
+++ b/lib/stdlib/test/beam_lib_SUITE.erl
@@ -964,7 +962,7 @@ verify_error(S, R) ->
%% Also make sure that formatted message is not just the term printed.
Handled = beam_lib:format_error(R) =/= io_lib:format("~p~n", [R]),
- true = ((FM > 0) or (BM > 0)) and Handled.
+ true = (FM > 0 orelse BM > 0) andalso Handled.
ver(S, {error, beam_lib, R}) ->
[S|_] = tuple_to_list(R),
diff --git a/lib/stdlib/test/binary_module_SUITE.erl b/lib/stdlib/test/binary_module_SUITE.erl
index 6ad9d9ab3d..9439d84720 100644
--- a/lib/stdlib/test/binary_module_SUITE.erl
+++ b/lib/stdlib/test/binary_module_SUITE.erl
@@ -749,12 +747,13 @@ encode_decode_loop(Range, X) ->
R = binary:decode_unsigned(make_unaligned(PaddedLittle),little),
S = binref:decode_unsigned(PaddedLittle,little),
T = binref:decode_unsigned(PaddedBig),
- case (((A =:= B) and (B =:= C) and (C =:= D)) and
- ((E =:= F)) and
- ((N =:= G) and (G =:= H) and (H =:= I) and
- (I =:= J) and (J =:= K) and (K =:= L) and (L =:= M)) and
- ((M =:= O) and (O =:= P) and (P =:= Q) and (Q =:= R) and
- (R =:= S) and (S =:= T)))of
+
+ CmpFn = fun(Cmp1) -> fun(Cmp2) -> Cmp2 =:= Cmp1 end end,
+ case
+ lists:all(CmpFn(A), [B, C, D]) andalso
+ E =:= F andalso
+ lists:all(CmpFn(G), [H, I, J, K, L, M, N, O, P, Q, R, S, T])
+ of
true ->
encode_decode_loop(Range,X-1);
_ ->
@@ -1306,7 +1305,7 @@ do_split_comp(N,H,Opts) ->
A = ?MASK_ERROR(binref:split(H,N,Opts)),
D = ?MASK_ERROR(binary:split(H,binary:compile_pattern(N),Opts)),
if
- (A =/= [N]) and is_list(A) ->
+ A =/= [N] andalso is_list(A) ->
put(success_counter,get(success_counter)+1);
true ->
ok
@@ -1354,7 +1353,7 @@ do_replace_comp(N,H,R,Opts) ->
A = ?MASK_ERROR(binref:replace(H,N,R,Opts)),
D = ?MASK_ERROR(binary:replace(H,binary:compile_pattern(N),R,Opts)),
if
- (A =/= N) and is_binary(A) ->
+ A =/= N andalso is_binary(A) ->
put(success_counter,get(success_counter)+1);
true ->
ok
diff --git a/lib/stdlib/test/binref.erl b/lib/stdlib/test/binref.erl
index 055ddf2b0c..9e3a70afbb 100644
--- a/lib/stdlib/test/binref.erl
+++ b/lib/stdlib/test/binref.erl
@@ -55,7 +53,7 @@ match(Haystack,{Needles},Options) ->
match(Haystack,Needles,Options);
match(Haystack,Needles,Options) ->
try
- true = is_binary(Haystack) and is_list(Needles), % badarg, not function_clause
+ true = is_binary(Haystack) andalso is_list(Needles), % badarg, not function_clause
case get_opts_match(Options,nomatch) of
nomatch ->
mloop(Haystack,Needles);
@@ -82,7 +80,7 @@ matches(Haystack,{Needles},Options) ->
matches(Haystack,Needles,Options);
matches(Haystack,Needles,Options) ->
try
- true = is_binary(Haystack) and is_list(Needles), % badarg, not function_clause
+ true = is_binary(Haystack) andalso is_list(Needles), % badarg, not function_clause
case get_opts_match(Options,nomatch) of
nomatch ->
msloop(Haystack,Needles);
@@ -398,7 +396,7 @@ list_to_bin(List) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
longest_common_prefix(LB) ->
try
- true = is_list(LB) and (length(LB) > 0), % Make badarg instead of function clause
+ true = is_list(LB) andalso length(LB) > 0, % Make badarg instead of function clause
do_longest_common_prefix(LB,0)
catch
_:_ ->
@@ -433,7 +431,7 @@ do_lcp([Bin|T],X,Ch) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
longest_common_suffix(LB) ->
try
- true = is_list(LB) and (length(LB) > 0), % Make badarg instead of function clause
+ true = is_list(LB) andalso length(LB) > 0, % Make badarg instead of function clause
do_longest_common_suffix(LB,0)
catch
_:_ ->
@@ -495,7 +493,7 @@ copy(Subject) ->
copy(Subject,1).
copy(Subject,N) ->
try
- true = is_integer(N) and (N >= 0) and is_binary(Subject), % Badarg, not function clause
+ true = is_integer(N) andalso N >= 0 andalso is_binary(Subject), % Badarg, not function clause
erlang:list_to_binary(lists:duplicate(N,Subject))
catch
_:_ ->
@@ -509,7 +507,7 @@ encode_unsigned(Unsigned) ->
encode_unsigned(Unsigned,big).
encode_unsigned(Unsigned,Endian) ->
try
- true = is_integer(Unsigned) and (Unsigned >= 0),
+ true = is_integer(Unsigned) andalso Unsigned >= 0,
if
Unsigned =:= 0 ->
<<0>>;
diff --git a/lib/stdlib/test/erl_eval_SUITE.erl b/lib/stdlib/test/erl_eval_SUITE.erl
index 1f2bb118f4..08a53ebd6b 100644
--- a/lib/stdlib/test/erl_eval_SUITE.erl
+++ b/lib/stdlib/test/erl_eval_SUITE.erl
@@ -673,9 +671,9 @@ simple_cases(Config) when is_list(Config) ->
"(2#101 band 2#10101) bor (2#110 bxor 2#010).", 5),
check(fun() -> (2#1 bsl 4) + (2#10000 bsr 3) end,
"(2#1 bsl 4) + (2#10000 bsr 3).", 18),
- check(fun() -> ((1<3) and ((1 =:= 2) or (1 =/= 2))) xor (1=<2) end,
+ check(fun() -> (1<3 andalso (1 =:= 2 orelse 1 =/= 2)) xor (1=<2) end,
"((1<3) and ((1 =:= 2) or (1 =/= 2))) xor (1=<2).", false),
- check(fun() -> (a /= b) or (2 > 4) or (3 >= 3) end,
+ check(fun() -> a /= b orelse 2 > 4 orelse 3 >= 3 end,
"(a /= b) or (2 > 4) or (3 >= 3).", true),
check(fun() -> "hej" ++ "san" =/= "hejsan" -- "san" end,
"\"hej\" ++ \"san\" =/= \"hejsan\" -- \"san\".", true),
diff --git a/lib/stdlib/test/erl_pp_SUITE.erl b/lib/stdlib/test/erl_pp_SUITE.erl
index 4b00afe5b5..8914bb5b85 100644
--- a/lib/stdlib/test/erl_pp_SUITE.erl
+++ b/lib/stdlib/test/erl_pp_SUITE.erl
@@ -1549,7 +1547,7 @@ pp_expr(List, Options) when is_list(List) ->
if
PP1 =:= PP2 -> % same line numbers
case
- (test_max_line(PP1) =:= ok) and (test_new_line(PPneg) =:= ok)
+ test_max_line(PP1) =:= ok andalso test_new_line(PPneg) =:= ok
of
true ->
ok;
diff --git a/lib/stdlib/test/ets_SUITE.erl b/lib/stdlib/test/ets_SUITE.erl
index d42e8d4510..2e70a0615a 100644
--- a/lib/stdlib/test/ets_SUITE.erl
+++ b/lib/stdlib/test/ets_SUITE.erl
@@ -5435,8 +5433,8 @@ info_do(Opts) ->
end, set, Opts),
PublicOrCurr =
fun(Curr) ->
- case lists:member({write_concurrency, false}, Opts) or
- lists:member(private, Opts) or
+ case lists:member({write_concurrency, false}, Opts) orelse
+ lists:member(private, Opts) orelse
lists:member(protected, Opts) of
true -> Curr;
false -> public
diff --git a/lib/stdlib/test/id_transform_SUITE.erl b/lib/stdlib/test/id_transform_SUITE.erl
index ebe9b90382..12143ae036 100644
--- a/lib/stdlib/test/id_transform_SUITE.erl
+++ b/lib/stdlib/test/id_transform_SUITE.erl
@@ -345,29 +343,29 @@ t2(A) when reference(A); reference(A) ->
t2(A) when tuple(A); tuple(A) ->
tuple.
-t3(A) when is_atom(A) or is_atom(A) ->
+t3(A) when is_atom(A) orelse is_atom(A) ->
is_atom;
-t3(A) when is_binary(A) or is_binary(A) ->
+t3(A) when is_binary(A) orelse is_binary(A) ->
is_binary;
-t3(A) when is_float(A) or is_float(A) ->
+t3(A) when is_float(A) orelse is_float(A) ->
is_float;
-t3(A) when is_function(A) or is_function(A) ->
+t3(A) when is_function(A) orelse is_function(A) ->
is_function;
-t3(A) when is_integer(A) or is_integer(A) ->
+t3(A) when is_integer(A) orelse is_integer(A) ->
is_integer;
-t3(A) when is_list(A) or is_list(A) ->
+t3(A) when is_list(A) orelse is_list(A) ->
is_list;
-t3(A) when is_number(A) or is_number(A) ->
+t3(A) when is_number(A) orelse is_number(A) ->
is_number;
-t3(A) when is_pid(A) or is_pid(A) ->
+t3(A) when is_pid(A) orelse is_pid(A) ->
is_pid;
-t3(A) when is_port(A) or is_port(A) ->
+t3(A) when is_port(A) orelse is_port(A) ->
is_port;
-t3(A) when is_record(A, apa) or is_record(A, apa) ->
+t3(A) when is_record(A, apa) orelse is_record(A, apa) ->
is_record;
-t3(A) when is_reference(A) or is_reference(A) ->
+t3(A) when is_reference(A) orelse is_reference(A) ->
is_reference;
-t3(A) when is_tuple(A) or is_tuple(A) ->
+t3(A) when is_tuple(A) orelse is_tuple(A) ->
is_tuple;
t3(A) when record(A, apa) ->
foo;
diff --git a/lib/stdlib/test/io_SUITE.erl b/lib/stdlib/test/io_SUITE.erl
index 32ac44e419..4a36654baf 100644
--- a/lib/stdlib/test/io_SUITE.erl
+++ b/lib/stdlib/test/io_SUITE.erl
@@ -1725,7 +1723,7 @@ g_choice_small(S) when is_list(S) ->
El = length(ES),
I = list_to_integer(IS),
if
- El =/= 0, ((I > 9) or (I < -9)) ->
+ El =/= 0, I > 9 orelse I < -9 ->
throw(too_many_digits_before_the_dot);
El =/= 0, I =:= 0 ->
throw(zero_before_the_dot);
diff --git a/lib/stdlib/test/ms_transform_SUITE.erl b/lib/stdlib/test/ms_transform_SUITE.erl
index 679d438c46..722937c0bd 100644
--- a/lib/stdlib/test/ms_transform_SUITE.erl
+++ b/lib/stdlib/test/ms_transform_SUITE.erl
@@ -782,12 +780,12 @@ float_1_function(Config) when is_list(Config) ->
MS1 = compile_and_run
(<<"ets:fun2ms(fun(X) -> float(X) end)">>),
[F1] = RunMS([3], MS1),
- true = is_float(F1) and (F1 == 3),
+ true = is_float(F1) andalso F1 == 3,
MS1b = compile_and_run
(<<"dbg:fun2ms(fun(X) -> float(X) end)">>),
[F2] = RunMS([3], MS1b),
- true = is_float(F2) and (F2 == 3),
+ true = is_float(F2) andalso F2 == 3,
MS2 = compile_and_run
(<<"ets:fun2ms(fun(X) when is_pid(X) or float(X) -> true end)">>),
diff --git a/lib/stdlib/test/select_SUITE.erl b/lib/stdlib/test/select_SUITE.erl
index b69c0e05a6..3a1d8e2ffb 100644
--- a/lib/stdlib/test/select_SUITE.erl
+++ b/lib/stdlib/test/select_SUITE.erl
@@ -628,8 +626,8 @@ multi_mixed_key(Tabs,Type) ->
[ {A,F} |
Acc];
Else ->
- case FunE(Else) or
- FunG(Else) or
+ case FunE(Else) orelse
+ FunG(Else) orelse
FunJ(Else) of
true ->
[ {A,F} |
diff --git a/lib/stdlib/test/supervisor_SUITE.erl b/lib/stdlib/test/supervisor_SUITE.erl
index 585737636e..afcee3c14d 100644
--- a/lib/stdlib/test/supervisor_SUITE.erl
+++ b/lib/stdlib/test/supervisor_SUITE.erl
@@ -46,7 +46,6 @@
sup_start_map_faulty_specs/1,
sup_stop_infinity/1, sup_stop_timeout/1, sup_stop_timeout_dynamic/1,
sup_stop_brutal_kill/1, sup_stop_brutal_kill_dynamic/1,
- sup_stop_race/1, sup_stop_non_shutdown_exit_dynamic/1,
sup_stop_manual/1, sup_stop_manual_timeout/1,
sup_stop_race/1, sup_stop_non_shutdown_exit_dynamic/1,
child_adm/1, child_adm_simple/1, child_specs/1, extra_return/1,
@@ -2009,7 +2008,7 @@ dont_save_start_parameters_for_temporary_children(simple_one_for_one = Type) ->
Size2 = erts_debug:flat_size(sys:get_status(Sup2)),
Size3 = erts_debug:flat_size(sys:get_status(Sup3)),
- true = (Size3 < Size1) and (Size3 < Size2),
+ true = Size3 < Size1 andalso Size3 < Size2,
terminate(Sup1, shutdown),
terminate(Sup2, shutdown),
@@ -2037,7 +2036,7 @@ dont_save_start_parameters_for_temporary_children(Type) ->
Size2 = erts_debug:flat_size(sys:get_status(Sup2)),
Size3 = erts_debug:flat_size(sys:get_status(Sup3)),
- true = (Size3 < Size1) and (Size3 < Size2),
+ true = Size3 < Size1 andalso Size3 < Size2,
terminate(Sup1, shutdown),
terminate(Sup2, shutdown),
--
2.51.0