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.2 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id B02A4BBAF for ; Wed, 25 Jun 2008 05:12:43 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmMCAJpUYUiFBoIFiGdsb2JhbACScgEBAQ8gn0U X-IronPort-AV: E=Sophos;i="4.27,700,1204498800"; d="scan'208";a="12496907" Received: from rabbit.math.nagoya-u.ac.jp ([133.6.130.5]) by mail2-smtp-roc.national.inria.fr with ESMTP; 25 Jun 2008 05:12:42 +0200 Received: from localhost (millas [172.16.30.29]) by rabbit.math.nagoya-u.ac.jp (8.12.11/3.7W) with ESMTP id m5P3Cbxa017293; Wed, 25 Jun 2008 12:12:37 +0900 (JST) Date: Wed, 25 Jun 2008 12:12:26 +0900 (JST) Message-Id: <20080625.121226.240480867.garrigue@math.nagoya-u.ac.jp> To: khooyp@cs.umd.edu Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Problem with class method and polymorphic variants From: Jacques Garrigue In-Reply-To: <9CA92F89-880D-46A8-835C-F4E93722BEE2@cs.umd.edu> References: <9CA92F89-880D-46A8-835C-F4E93722BEE2@cs.umd.edu> X-Mailer: Mew version 4.0.69 on Emacs 22.0.50 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; variants: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 polymorphic:01 compile:01 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