anchor.diff:            Sig_declare_typ((right lb.lbname).fv_name.v, lb.lbunivs, lb.lbtyp, Assumption::quals, r)), hidden
       else [se], hidden
   
  +(* adds the typechecked sigelt to the env, also performs any processing required in the env (such as reset options) *)
  +(* this was earlier part of tc_decl, but separating it might help if and when we cache type checked modules *)
  +let add_sigelt_to_env (env:Env.env) (se:sigelt) :Env.env =
  +  match se with
  +  | Sig_inductive_typ _ -> failwith "add_sigelt_to_env: Impossible, bare data constructor"
  +  | Sig_datacon _ -> failwith "add_sigelt_to_env: Impossible, bare data constructor"
  +  | Sig_pragma (p, r) ->
  +    (match p with
  +     | ResetOptions _ -> env.solver.refresh (); env
  +     | _ -> env)
  +  | Sig_new_effect_for_free _ -> env
  +  | Sig_new_effect (ne, _) ->
  +    let env = Env.push_sigelt env se in
  +    ne.actions |> List.fold_left (fun env a -> Env.push_sigelt env (U.action_as_lb ne.mname a)) env
  +  | Sig_declare_typ (_, _, _, quals, _)
  +  | Sig_let (_, _, _, quals, _) when quals |> BU.for_some (function OnlyName -> true | _ -> false) -> env
  +  | _ -> Env.push_sigelt env se
  +
  +
   let tc_decls env ses =
     let rec process_one_decl (ses, exports, env, hidden) se =
       if Env.debug env Options.Low
       then BU.print1 ">>>>>>>>>>>>>>Checking top-level decl %s\n" (Print.sigelt_to_string se);
   
  -    let ses', env, ses_elaborated = tc_decl env se  in
  +    let ses', ses_elaborated = tc_decl env se  in
  +    let env = ses' |> List.fold_left (fun env se -> add_sigelt_to_env env se) env in
   
       if (Options.log_types()) || Env.debug env <| Options.Other "LogTypes"
       then BU.print1 "Checked: %s\n" (List.fold_left (fun s se -> s ^ Print.sigelt_to_string se ^ "\n") "" ses');
  
positive.code:     let e, _, g = check_expected_effect env (Some (U.ml_comp Common.t_unit r)) (e, c.comp()) in
      Rel.force_trivial_guard env (Rel.conj_guard g1 g);
      let se = Sig_main(e, r) in
      let env = Env.push_sigelt env se in
      [se], env, []
  
    | Sig_let(lbs, r, lids, quals, attrs) ->
      let env = Env.set_range env r in
  
negative.code:             uvs, SS.close_univ_vars uvs t
      in
      let se = Sig_declare_typ(lid, uvs, t, quals, r) in
      [se], []
  
    | Sig_assume(lid, phi, quals, r) ->
      let se = tc_assume env lid phi quals r in
      [se], []
  
    | Sig_main(e, r) ->
      let env = Env.set_range env r in
  