From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=AWL autolearn=disabled version=3.1.3 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 99345BBCA for ; Mon, 12 May 2008 15:38:02 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEABblJ0iCNhAB/2dsb2JhbACqRA X-IronPort-AV: E=Sophos;i="4.27,473,1204498800"; d="scan'208";a="26079312" Received: from kurims.kurims.kyoto-u.ac.jp ([130.54.16.1]) by mail4-smtp-sop.national.inria.fr with ESMTP; 12 May 2008 15:38:01 +0200 Received: from localhost (orion [130.54.16.5]) by kurims.kurims.kyoto-u.ac.jp (8.13.8/8.13.8) with ESMTP id m4CDbrde002145; Mon, 12 May 2008 22:37:53 +0900 (JST) Date: Mon, 12 May 2008 22:37:43 +0900 (JST) Message-Id: <20080512.223743.52176750.garrigue@math.nagoya-u.ac.jp> To: rich@annexia.org Cc: rathereasy@gmail.com, caml-list@yquem.inria.fr Subject: Re: [Caml-list] ocamlc freezes From: Jacques Garrigue In-Reply-To: <20080512083745.GA23048@annexia.org> References: <20080512083745.GA23048@annexia.org> X-Mailer: Mew version 4.2 on Emacs 22.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; ocamlc:01 freezes:01 node:01 node:01 foo:01 foo:01 ocamlc:01 freezes:01 ocaml:01 bug:01 type-checker:01 bug:01 cheers:01 'left:98 'left:98 From: Richard Jones > On Sun, May 11, 2008 at 09:19:26PM -0400, Jacques Le Normand wrote: > > hello caml-list > > when I try to compile > > > > class type node = > > object > > method get_right_sibling : node option > > end > > class type ['top_parent_type,'left_sibling_type,'right_sibling_type] typ = > > object > > inherit node > > method get_left_sibling : 'left_sibling_type option > > method get_right_sibling : 'right_sibling_type option > > end > > type 'p foo_typ = ('p,'p foo_typ,'p foo_typ) typ > > > > with > > > > ocamlc test.ml > > > > ocamlc just freezes; I'm using ocaml 3.09.2 on ubuntu. What should I do? > > Possibly upgrade. With 3.10.0 this gives an error: > > File "test.ml", line 11, characters 4-48: > This type constructor expands to type > 'a foo_typ = > < get_left_sibling : 'a foo_typ option; get_right_sibling : node option > > but is here used with type node = < get_right_sibling : node option > > Type node = < get_right_sibling : node option > is not compatible with type > < get_right_sibling : node option > > Type > 'a foo_typ = > < get_left_sibling : 'a foo_typ option; get_right_sibling : node option > > is not compatible with type > < get_left_sibling : 'a foo_typ option; get_right_sibling : node option > > Types for method get_left_sibling are incompatible This probably requires a bit of explanation, as the error message seems to tell that identical types are not so... maybe a bug in the reporting code. Anyway, this is the first line that matters. You cannot change a method's type with method override. So get_right_sibling in typ has still type [node option], which means that in foo_typ, ['p foo_typ] should be a [node option], hence the contradiction. There was a type-checker bug in 3.09.2, but it is now fixed. Cheers, Jacques Garrigue