Version française
Home     About     Download     Resources     Contact us    
Browse thread
strange behavior of the object type-checker
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jerome Vouillon <Jerome.Vouillon@i...>
Subject: Re: strange behavior of the object type-checker
On Thu, Sep 09, 1999 at 06:34:19PM +0200, Pierre Boulet wrote:
> dear ocamllers,
> 
> I have finally decided to give a try to the object subsystem of ocaml
> and I have stumbled on something very strange (for me, at least).
> 
> In the code I present below, after some parametric class creation, I
> try to execute some method of an object. Three *successive* tries give
> three *different* results: two different typing error messages and
> finally success.

This is due to a type checker bug. Here is a patch (the bug should
also soon be corrected in cvs).

-- Jérôme

Index: typing/ctype.ml
===================================================================
RCS file: /net/pauillac/caml/repository/csl/typing/ctype.ml,v
retrieving revision 1.65
diff -u -u -r1.65 ctype.ml
--- ctype.ml    1999/02/24 15:21:49     1.65
+++ ctype.ml    1999/09/09 19:35:33
@@ -1068,7 +1068,8 @@
   let t1' = expand_head env t1 in
   let t2' = expand_head env t2 in
   (* Expansion may have changed the representative of the types... *)
-  let t1' = repr t1' and t2' = repr t2' in
+  let t1' = expand_head env t1' in
+  let t2' = expand_head env t2' in
   if t1' == t2' then () else
 
   let t1 = repr t1 and t2 = repr t2 in