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.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id D1EE8BBAF for ; Wed, 25 Jun 2008 07:18:00 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmMCALVxYUiACH+SiGdsb2JhbACScgEBAQ8gnw0 X-IronPort-AV: E=Sophos;i="4.27,700,1204498800"; d="scan'208";a="14503242" Received: from server-nat-3.cs.umd.edu (HELO bacon.cs.umd.edu) ([128.8.127.146]) by mail3-smtp-sop.national.inria.fr with ESMTP; 25 Jun 2008 07:18:00 +0200 Received: from [192.168.1.100] (pool-96-231-87-112.washdc.east.verizon.net [96.231.87.112]) (authenticated bits=0) by bacon.cs.umd.edu (8.13.1/8.14.1) with ESMTP id m5P5HBVo024323 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Wed, 25 Jun 2008 01:17:11 -0400 Cc: Khoo Yit Phang , caml-list@yquem.inria.fr Message-Id: From: Khoo Yit Phang To: Jacques Garrigue In-Reply-To: <20080625.121226.240480867.garrigue@math.nagoya-u.ac.jp> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v924) Subject: Re: [Caml-list] Problem with class method and polymorphic variants Date: Wed, 25 Jun 2008 01:17:10 -0400 References: <9CA92F89-880D-46A8-835C-F4E93722BEE2@cs.umd.edu> <20080625.121226.240480867.garrigue@math.nagoya-u.ac.jp> X-Mailer: Apple Mail (2.924) X-CSD-MailScanner-Information: Please email staff@cs.umd.edu for more information X-CSD-MailScanner: Found to be clean X-CSD-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-1.8, required 5, autolearn=not spam, ALL_TRUSTED -1.80) X-CSD-MailScanner-From: khooyp@cs.umd.edu X-Spam: no; 0.00; variants:01 node:01 node:01 ocaml:01 ocamlc:01 ocaml:01 toplevel:01 bug:01 type-checker:01 bug:01 toplevel:01 ocamlc:01 cvs:01 variants:01 cheers:01 Hi, Thanks for the quick response! I've encountered another strange one that may be related. The code below compiles only if you remove the underscore in the method "_a". The error message is similar to the earlier one, but I think it's a different problem? class ['a] node d = object method _d : 'a = d method p (x : 'a) = "" end class ['a] pnode data = object (self) inherit ['a] node data (* doesn't compile with the underscore in "_a" *) method _a = self method p = function `P p -> p#name end Yit June 25, 2008 On Jun 24, 2008, at 11:12 PM, Jacques Garrigue wrote: > From: Khoo Yit Phang >> Hi, >> >> I discovered that the attached snippet of Ocaml does not compile in >> ocamlc, but does work in the ocaml toplevel (tested in v3.10.0 and >> 3.10.2). Removing anything (except the :int annotation) causes the >> error to go away. Is it a bug in the type-checker? >> >> # cat polymorphic-variants-methods-bug.ml >> class ['a] c (a : 'a) = >> object (s) >> method s = s >> method d : int = match a with `A b -> b#num >> end > > Of course this is a bug. I added it myself to the bug tracker. > By the way you could also trigger it in the toplevel by giving > explicitly a module signature (this is what ocamlc does internally). > > This is now fixed in CVS, branch release310. > Note that you may still have other kinds of problems using > upper-bounded polymorpic variants inside constraints. Just report them > as you go... > > Cheers, > > Jacques Garrigue