aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/beam_types.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/compiler/src/beam_types.erl')
-rw-r--r--lib/compiler/src/beam_types.erl12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/compiler/src/beam_types.erl b/lib/compiler/src/beam_types.erl
index 752dda0d2b..4f8ba0ada5 100644
--- a/lib/compiler/src/beam_types.erl
+++ b/lib/compiler/src/beam_types.erl
@@ -171,6 +171,18 @@ meet(#t_atom{elements=[_|_]}=T, #t_atom{elements=any}) ->
T;
meet(#t_atom{elements=any}, #t_atom{elements=[_|_]}=T) ->
T;
+meet(#t_bs_context{slots=SlotCountA,valid=ValidSlotsA},
+ #t_bs_context{slots=SlotCountB,valid=ValidSlotsB}) ->
+ CommonSlotMask = (1 bsl min(SlotCountA, SlotCountB)) - 1,
+ CommonSlotsA = ValidSlotsA band CommonSlotMask,
+ CommonSlotsB = ValidSlotsB band CommonSlotMask,
+ if
+ CommonSlotsA =:= CommonSlotsB ->
+ #t_bs_context{slots=max(SlotCountA, SlotCountB),
+ valid=ValidSlotsA bor ValidSlotsB};
+ CommonSlotsA =/= CommonSlotsB ->
+ none
+ end;
meet(#t_fun{arity=any}, #t_fun{}=T) ->
T;
meet(#t_fun{}=T, #t_fun{arity=any}) ->