Skip to content

Commit

Permalink
Pull and apply latest changes from upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
voodoos committed Jan 7, 2025
1 parent 874de7e commit 5701916
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
17 changes: 10 additions & 7 deletions src/ocaml/typing/ctype.ml
Original file line number Diff line number Diff line change
Expand Up @@ -209,20 +209,23 @@ let create_scope () =
level

let wrap_end_def f = Misc.try_finally f ~always:end_def
let wrap_end_def_new_pool f =
wrap_end_def (fun _ -> with_new_pool ~level:!current_level f)

(* [with_local_level_gen] handles both the scoping structure of levels
and automatic generalization through pools (cf. btype.ml) *)
let with_local_level_gen ~begin_def ~structure ?before_generalize f =
begin_def ();
let level = !current_level in
let result, pool = wrap_end_def_new_pool f in
Option.iter (fun g -> g result) before_generalize;
let result, pool =
with_new_pool ~level:!current_level begin fun () ->
let result = wrap_end_def f in
Option.iter (fun g -> g result) before_generalize;
result
end
in
simple_abbrevs := Mnil;
(* Nodes in [pool] were either created by the above call to [f],
or they were created before, generalized, and then added to
the pool by [update_level].
(* Nodes in [pool] were either created by the above calls to [f]
and [before_generalize], or they were created before, generalized,
and then added to the pool by [update_level].
In the latter case, their level was already kept for backtracking
by a call to [set_level] inside [update_level].
Since backtracking can only go back to a snapshot taken before [f] was
Expand Down
2 changes: 1 addition & 1 deletion upstream/ocaml_503/base-rev.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
630a342bf2b033a1be1c8746cbd34d0c63801ded
bc5083c1d3b773fc3198355494afd2fb4628ff0e
17 changes: 10 additions & 7 deletions upstream/ocaml_503/typing/ctype.ml
Original file line number Diff line number Diff line change
Expand Up @@ -192,20 +192,23 @@ let create_scope () =
level

let wrap_end_def f = Misc.try_finally f ~always:end_def
let wrap_end_def_new_pool f =
wrap_end_def (fun _ -> with_new_pool ~level:!current_level f)

(* [with_local_level_gen] handles both the scoping structure of levels
and automatic generalization through pools (cf. btype.ml) *)
let with_local_level_gen ~begin_def ~structure ?before_generalize f =
begin_def ();
let level = !current_level in
let result, pool = wrap_end_def_new_pool f in
Option.iter (fun g -> g result) before_generalize;
let result, pool =
with_new_pool ~level:!current_level begin fun () ->
let result = wrap_end_def f in
Option.iter (fun g -> g result) before_generalize;
result
end
in
simple_abbrevs := Mnil;
(* Nodes in [pool] were either created by the above call to [f],
or they were created before, generalized, and then added to
the pool by [update_level].
(* Nodes in [pool] were either created by the above calls to [f]
and [before_generalize], or they were created before, generalized,
and then added to the pool by [update_level].
In the latter case, their level was already kept for backtracking
by a call to [set_level] inside [update_level].
Since backtracking can only go back to a snapshot taken before [f] was
Expand Down

0 comments on commit 5701916

Please sign in to comment.