anchor.diff:          let branches = t_eqns |> List.map (fun ((pat, wopt, br), _, eff_label, _, _, _, _) ->
             pat, wopt, TcUtil.maybe_lift env br eff_label cres.eff_name cres.res_typ
           ) in
  -        let e = mk (Tm_match(scrutinee, ret_opt, branches)) top.pos in
  +        let e =
  +          let rc = { residual_effect = cres.eff_name;
  +                     residual_typ = Some cres.res_typ;
  +                     residual_flags = cres.cflags } in
  +          mk (Tm_match(scrutinee, ret_opt, branches, Some rc)) top.pos in
           let e = TcUtil.maybe_monadic env e cres.eff_name cres.res_typ in
           //The ascription with the result type is useful for re-checking a term, translating it to Lean etc.
           //AR: revisit, for now doing only if return annotation is not provided
  
positive.code: 
    | Tm_meta(t, _) -> typeof_tot_or_gtot_term_fastpath env t must_tot
  
    | Tm_match _
    | Tm_let _
    | Tm_unknown
  
negative.code:    *)
  
    match (SS.compress top).n with
    | Tm_match(e1, ret_opt, eqns, _) ->  //ret_opt is the return annotation
      let e1, c1, g1 = tc_term
        (env |> Env.clear_expected_typ |> fst |> instantiate_both)
        e1 in
  