Correction d'un bug (occur check qui bouclait parfois).

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@867 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Jérôme Vouillon 1996-06-10 11:26:54 +00:00
parent 3fa081f403
commit c5bbe99551
1 changed files with 3 additions and 2 deletions

View File

@ -403,11 +403,12 @@ let generic_abbrev env path =
let occur env ty0 ty =
let visited = ref ([] : type_expr list) in
let rec occur_rec ty =
let ty = repr ty in
if ty == ty0 then raise (Unify []);
match ty.desc with
Tlink ty' ->
occur_rec ty'
| Tvar ->
if ty == ty0 then raise (Unify []) else
()
| Tarrow(t1, t2) ->
occur_rec t1; occur_rec t2
@ -497,7 +498,7 @@ and unify_core env a1 a2 t1 t2 = (* Other cases *)
| (Some l1, None) ->
update_level t2.level t1; t2.desc <- Tlink l1
| (_, _) ->
update_level t1.level t2; t1.desc <- Tlink t2
update_level t1.level t2; occur env t1 t2; t1.desc <- Tlink t2
end;
try
match (d1, d2) with