Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delay snapshotting of desugaring environment #3585

Merged
merged 2 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ocaml/fstar-lib/generated/FStarC_ToSyntax_ToSyntax.ml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions src/tosyntax/FStarC.ToSyntax.ToSyntax.fst
Original file line number Diff line number Diff line change
Expand Up @@ -3645,12 +3645,6 @@ and desugar_decl_maybe_fail_attr env (d: decl): (env_t & sigelts) =
List.filter (fun at -> Option.isNone (get_fail_attr1 false at)) ats
in

// The `fail` attribute behaves
// differentrly! We only keep that one on the first new decl.
let env0 = Env.snapshot env |> snd in (* we need the snapshot since pushing the let
* will shadow a previous val *)


(* If this is an expect_failure, check to see if it fails.
* If it does, check that the errors match as we normally do.
* If it doesn't fail, leave it alone! The typechecker will check the failure. *)
Expand All @@ -3659,6 +3653,12 @@ and desugar_decl_maybe_fail_attr env (d: decl): (env_t & sigelts) =
let attrs = U.deduplicate_terms attrs in
match get_fail_attr false attrs with
| Some (expected_errs, lax) ->
// The `fail` attribute behaves
// differentrly! We only keep that one on the first new decl.
let env0 =
Env.snapshot env |> snd (* we need the snapshot since pushing the let
* will shadow a previous val *)
in
let d = { d with attrs = [] } in
let errs, r = Errors.catch_errors (fun () ->
Options.with_saved_options (fun () ->
Expand Down