anchor.diff:      NegTypes1 = [P || {_,T}=P <- EqTypes, beam_types:is_singleton_type(T)],
   
       PosTypes = EqTypes ++ PosTypes0,
  -    SuccTs = meet_types(PosTypes, Ts),
  +    SuccTs1 = meet_types(PosTypes, Ts),
   
       NegTypes = NegTypes0 ++ NegTypes1,
  -    FailTs = subtract_types(NegTypes, Ts),
  -
  -    {SuccTs,FailTs}.
  +    FailTs1 = subtract_types(NegTypes, Ts),
  +
  +    SuccTs = infer_br_value(V, Ts, true, SuccTs1),
  +    FailTs = infer_br_value(V, Ts, false, FailTs1),
  +
  +    {SuccTs, FailTs}.
  +
  +infer_br_value(_V, _OldTs, _Bool, none) ->
  +    none;
  +infer_br_value(V, OldTs, Bool, NewTs) ->
  +    case OldTs of
  +        #{ V := T } ->
  +            case beam_types:is_boolean_type(T) of
  +                true ->
  +                    NewTs#{ V := beam_types:make_atom(Bool) };
  +                false ->
  +                    %% V is a try/catch tag or similar, leave it alone.
  +                    NewTs
  +            end;
  +        #{} ->
  +            %% V is only used in this branch; don't propagate its type.
  +            NewTs
  +    end.
   
   infer_types_switch(V, Lit, Ts, #d{ds=Ds}) ->
       Types = infer_eq_type({bif,'=:='}, [V, Lit], Ts, Ds),
  
positive.code: subtract_types([{V,T0}|Vs], Ts) ->
      #{V:=T1} = Ts,
      case beam_types:subtract(T1, T0) of
          T1 -> subtract_types(Vs, Ts);
          T -> subtract_types(Vs, Ts#{V:=T})
      end;
  subtract_types([], Ts) -> Ts.
  
negative.code:         {Is,Ts,Ds,Fdb,Sub} ->
              D1 = D0#d{ds=Ds,sub=Sub,func_db=Fdb},
              Last1 = simplify_terminator(Last0, Sub, Ts, Ds),
              Last2 = opt_terminator(Last1, Ts, Ds),
              {Last,D} = update_successors(Last2, Ts, D1),
              Blk = Blk0#b_blk{is=Is,last=Last},
              opt(Bs, D, [{L,Blk}|Acc]);
          {no_return,Ret,Is,Ds,Fdb,Sub} ->
  