Skip to content

Commit

Permalink
Make subst restore the level even on error
Browse files Browse the repository at this point in the history
  • Loading branch information
goldfirere committed Jan 4, 2023
1 parent 3840478 commit ba63ad9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions typing/ctype.ml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ let global_level = s_ref 1
let saved_level = s_ref []

type levels =
{ current_level: int; nongen_level: int; global_level: int;
{ current_level: int; nongen_level: int;
global_level: int; (* level assigned to a fresh 'a in user code *)
saved_level: (int * int) list; }
let save_levels () =
{ current_level = !current_level;
Expand Down Expand Up @@ -1592,7 +1593,7 @@ let subst env level priv abbrev oty params args body =
current_level := old_level;
umode := old_umode;
body'
with Unify _ ->
with Unify _ | Cannot_subst | Escape _ ->
current_level := old_level;
umode := old_umode;
undo_abbrev ();
Expand Down

0 comments on commit ba63ad9

Please sign in to comment.