Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] typing class...
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Garrigue <garrigue@k...>
Subject: Re: [Caml-list] typing class...
From: Damien <Damien.Pous@ens-lyon.fr>

> I am not sure this is a bug, but this is annoying...

This looks like a bug, this smells like a bug... and this is a bug!
Thanks for the report, this is now fixed.

I join a patch which should apply on any recent ocaml.

Jacques Garrigue

Index: typing/ctype.ml
===================================================================
RCS file: /net/pauillac/caml/repository/csl/typing/ctype.ml,v
retrieving revision 1.154
retrieving revision 1.155
diff -c -r1.154 -r1.155
*** ctype.ml	2003/03/26 07:24:17	1.154
--- ctype.ml	2003/04/03 02:15:38	1.155
***************
*** 2058,2063 ****
--- 2058,2068 ----
                   (*  Equivalence between parameterized types  *)
                   (*********************************************)
  
+ let normalize_subst subst =
+   if List.exists
+       (function {desc=Tlink _}, _ | _, {desc=Tlink _} -> true | _ -> false)
+       !subst
+   then subst := List.map (fun (t1,t2) -> repr t1, repr t2) !subst
  
  let rec eqtype rename type_pairs subst env t1 t2 =
    if t1 == t2 then () else
***************
*** 2069,2074 ****
--- 2074,2080 ----
      match (t1.desc, t2.desc) with
        (Tvar, Tvar) when rename ->
          begin try
+           normalize_subst subst;
            if List.assq t1 !subst != t2 then raise (Unify [])
          with Not_found ->
            subst := (t1, t2) :: !subst
***************
*** 2088,2093 ****
--- 2094,2100 ----
            match (t1'.desc, t2'.desc) with
              (Tvar, Tvar) when rename ->
                begin try
+                 normalize_subst subst;
                  if List.assq t1' !subst != t2' then raise (Unify [])
                with Not_found ->
                  subst := (t1', t2') :: !subst

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners