Re: strange behavior of the object type-checker

From: Jerome Vouillon (Jerome.Vouillon@inria.fr)
Date: Thu Sep 09 1999 - 21:43:13 MET DST


Date: Thu, 9 Sep 1999 21:43:13 +0200
From: Jerome Vouillon <Jerome.Vouillon@inria.fr>
To: Pierre Boulet <Pierre.Boulet@lifl.fr>, caml-list@inria.fr
Subject: Re: strange behavior of the object type-checker
In-Reply-To: <vtuvh9khwms.fsf@gala.lifl.fr>; from Pierre Boulet on Thu, Sep 09, 1999 at 06:34:19PM +0200

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



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:25 MET