From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id QAA13029 for caml-redistribution; Fri, 10 Sep 1999 16:52:50 +0200 (MET DST) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA03856 for ; Thu, 9 Sep 1999 21:43:15 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.8.7/8.8.7) with ESMTP id VAA07240; Thu, 9 Sep 1999 21:43:13 +0200 (MET DST) Received: (from vouillon@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id VAA28425; Thu, 9 Sep 1999 21:43:13 +0200 (MET DST) Message-ID: <19990909214313.55795@pauillac.inria.fr> Date: Thu, 9 Sep 1999 21:43:13 +0200 From: Jerome Vouillon To: Pierre Boulet , caml-list@inria.fr Subject: Re: strange behavior of the object type-checker References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Mailer: Mutt 0.89.1 In-Reply-To: ; from Pierre Boulet on Thu, Sep 09, 1999 at 06:34:19PM +0200 Sender: weis 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