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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 4D93DBB84 for ; Wed, 18 Jun 2008 20:21:45 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApYBALDuWEjAXQIniGdsb2JhbACSOAEBAQ8gnmI X-IronPort-AV: E=Sophos;i="4.27,667,1204498800"; d="scan'208";a="12250956" Received: from concorde.inria.fr ([192.93.2.39]) by mail2-smtp-roc.national.inria.fr with ESMTP; 18 Jun 2008 20:21:44 +0200 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id m5IILhd7011218 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Wed, 18 Jun 2008 20:21:45 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoAAALDuWEhCm3xrnWdsb2JhbACSOAEBAQEBCA0HnnM X-IronPort-AV: E=Sophos;i="4.27,667,1204498800"; d="scan'208";a="14047944" Received: from janestcapital.com (HELO smtp.janestcapital.com) ([66.155.124.107]) by mail1-smtp-roc.national.inria.fr with ESMTP; 18 Jun 2008 20:21:44 +0200 Received: from qsmtp.delacy.com [38.105.200.250] by janestcapital.com with ESMTP (SMTPD-9.10) id A23503C0; Wed, 18 Jun 2008 14:21:41 -0400 Received: from nyc-qws-011.delacy.com ([172.25.131.111] helo=nyc-qws-011) by qsmtp.delacy.com with smtp (Exim 4.62) (envelope-from ) id 1K92Hs-0001zG-HK for caml-list@inria.fr; Wed, 18 Jun 2008 14:21:41 -0400 Received: by nyc-qws-011 (sSMTP sendmail emulation); Wed, 18 Jun 2008 14:21:40 -0400 From: "Mark Shinwell" Date: Wed, 18 Jun 2008 14:21:40 -0400 To: caml-list@inria.fr Subject: Type checker (ex-)bug Message-ID: <20080618182140.GK30596@janestcapital.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.1i X-Miltered: at concorde with ID 48595238.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; shinwell:01 checker:01 bug:01 typecheck:01 ocamlc:01 compiler:01 foo:01 bug:01 btype:01 iter:01 btype:01 snap:98 snap:98 complains:01 delayed:01 The following program: type 'a s = 'a type 'a t = unit let g (_ : 'a s -> unit) (_ : 'a t) = () let f t = g (fun x -> x; ()) t fails to typecheck using ocamlc 3.10.0 but succeeds (as would surely be expected) under 3.10.1 and 3.10.2. The 3.10.0 compiler complains: File "foo.ml", line 5, characters 6-30: The type of this expression, '_a t -> unit, contains type variables that cannot be generalized The fix for this bug doesn't appear to be explicitly noted in the Changes file, but it was fixed by this patch, which was introduced between 3.10.0 and 3.10.1: @@ -585,8 +585,11 @@ let add_delayed_check f = delayed_checks := f :: !delayed_checks let force_delayed_checks () = + (* checks may change type levels *) + let snap = Btype.snapshot () in List.iter (fun f -> f ()) (List.rev !delayed_checks); - reset_delayed_checks () + reset_delayed_checks (); + Btype.backtrack snap Could someone comment whether this patch is indeed the correct fix for this problem (I assume it was written to fix something else)? Or is there perhaps still something wrong that is being masked by this patch? Thanks in advance. Mark