Skip to content

Commit

Permalink
Fix PR#3918
Browse files Browse the repository at this point in the history
git-svn-id: http://caml.inria.fr/svn/ocaml/version/3.09@7273 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
  • Loading branch information
Jacques Garrigue committed Dec 15, 2005
1 parent 460f46c commit 9c8fc95
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions typing/ctype.ml
Expand Up @@ -1105,8 +1105,9 @@ let expand_abbrev env ty =
| _ ->
assert false

(* Fully expand the head of a type. Raise an exception if the type
cannot be expanded. *)
(* Fully expand the head of a type.
Raise Cannot_expand if the type cannot be expanded.
May raise Unify, if a recursion was hidden in the type. *)
let rec try_expand_head env ty =
let ty = repr ty in
match ty.desc with
Expand All @@ -1128,7 +1129,11 @@ let expand_head_once env ty =

(* Fully expand the head of a type. *)
let rec expand_head env ty =
try try_expand_head env ty with Cannot_expand -> repr ty
let snap = Btype.snapshot () in
try try_expand_head env ty
with Cannot_expand | Unify _ -> (* expand_head shall never fail *)
Btype.backtrack snap;
repr ty

(* Make sure that the type parameters of the type constructor [ty]
respect the type constraints *)
Expand Down

0 comments on commit 9c8fc95

Please sign in to comment.