File 2931-beam_ssa_lint-Use-gb_sets-is_empty-1-instead-of-gb_s.patch of Package erlang
From bee24830ce015b780ab9e6d0f90edfde792c072c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Sat, 20 Feb 2021 07:17:55 +0100
Subject: [PATCH 1/6] beam_ssa_lint: Use gb_sets:is_empty/1 instead of
gb_sets:size/1
---
lib/compiler/src/beam_ssa_lint.erl | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/compiler/src/beam_ssa_lint.erl b/lib/compiler/src/beam_ssa_lint.erl
index 1c8b0d958e..b518cb823f 100644
--- a/lib/compiler/src/beam_ssa_lint.erl
+++ b/lib/compiler/src/beam_ssa_lint.erl
@@ -291,15 +291,15 @@ vvars_block_1([], _Terminator, State) ->
vvars_terminator(#b_ret{ arg = Arg }=I, From, State) ->
ok = vvars_assert_args([Arg], I, State),
TryTags = State#vvars.try_tags,
- case gb_sets:size(TryTags) of
- N when N > 0, From =/= ?EXCEPTION_BLOCK ->
- throw({active_try_tags_on_return, TryTags, I});
- N when N > 0, From =:= ?EXCEPTION_BLOCK ->
+ case {gb_sets:is_empty(TryTags),From} of
+ {false,?EXCEPTION_BLOCK} ->
%% Plain guards sometimes branch off to ?EXCEPTION_BLOCK even
%% though they cannot actually throw exceptions. This ought to be
%% fixed at the source, but we'll ignore this for now.
State;
- 0 ->
+ {false,_} ->
+ throw({active_try_tags_on_return, TryTags, I});
+ {true,_} ->
State
end;
vvars_terminator(#b_switch{arg=Arg,fail=Fail,list=Switch}=I, From, State) ->
--
2.26.2