From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by sympa.inria.fr (Postfix) with ESMTPS id 6264A7ED34 for ; Fri, 6 Jul 2012 21:36:27 +0200 (CEST) Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of jean-louis.giavitto@ircam.fr) identity=pra; client-ip=129.102.3.72; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="Jean-Louis.Giavitto@ircam.fr"; x-sender="jean-louis.giavitto@ircam.fr"; x-conformance=sidf_compatible Received-SPF: Pass (mail1-smtp-roc.national.inria.fr: domain of Jean-Louis.Giavitto@ircam.fr designates 129.102.3.72 as permitted sender) identity=mailfrom; client-ip=129.102.3.72; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="Jean-Louis.Giavitto@ircam.fr"; x-sender="Jean-Louis.Giavitto@ircam.fr"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@smarthost2.ircam.fr) identity=helo; client-ip=129.102.3.72; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="Jean-Louis.Giavitto@ircam.fr"; x-sender="postmaster@smarthost2.ircam.fr"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvgCANA990+BZgNIgWdsb2JhbABFhWSxcCIBARYmJ4IZAQUjBFERLBYEBwICAgcDAgECAUUTCAEBiAcBp2qTCJBNgRIDjkmBIYVNgRKJdIde X-IronPort-AV: E=Sophos;i="4.77,540,1336341600"; d="tgz'50?ml'50?mli'50?scan'50,208,49,50";a="165916542" Received: from smarthost2.ircam.fr ([129.102.3.72]) by mail1-smtp-roc.national.inria.fr with ESMTP; 06 Jul 2012 21:36:27 +0200 Received: from localhost (localhost.localdomain [127.0.0.1]) by smarthost2.ircam.fr (Postfix) with ESMTP id 7115A8254E; Fri, 6 Jul 2012 21:36:26 +0200 (CEST) X-Virus-Scanned: amavisd-new at ircam.fr Received: from smarthost2.ircam.fr ([127.0.0.1]) by localhost (smarthost2.ircam.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wb1nJZxhSNCL; Fri, 6 Jul 2012 21:36:26 +0200 (CEST) Received: from increvable.ircam.fr (increvable.ircam.fr [IPv6:2001:660:3004:2:230:48ff:fe29:4f48]) by smarthost2.ircam.fr (Postfix) with ESMTP id 483708254B; Fri, 6 Jul 2012 21:36:26 +0200 (CEST) Received: from m2055.ircam.fr (m2055.ircam.fr [129.102.64.75]) (Authenticated sender: giavitto) by increvable.ircam.fr (Postfix) with ESMTP id 24C874E381; Fri, 6 Jul 2012 21:36:26 +0200 (CEST) Message-ID: <4FF73E39.5060405@ircam.fr> Date: Fri, 06 Jul 2012 21:36:25 +0200 From: Jean-Louis Giavitto Reply-To: jean-louis.giavitto@ircam.fr Organization: UMR STMS 9912 - IRCAM & CNRS & UPMC & Inria User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: caml-list@inria.fr References: <4FF4C98F.2030703@ircam.fr> In-Reply-To: <4FF4C98F.2030703@ircam.fr> Content-Type: multipart/mixed; boundary="------------010102050908000404030907" X-Validation-by: jean-louis.giavitto@ircam.fr Subject: [Caml-list] Problem of type equality in a single definition (was: In 3.12 and 4.0, erratic message "The implementation tt.ml does not match the interface tt.cmi") This is a multi-part message in MIME format. --------------010102050908000404030907 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Dear all, I have circumscribed my initial problem and I am able to produce it on a simple case. I have a signature Classdef.mli restrcted to class virtual ['a, 'b, 'c] cl0 : object constraint 'c = < m : 'a -> 'b -> int; .. > end class virtual ['a, 'b] cl1 : object method virtual m : 'a -> 'b -> int method virtual raise_trouble : 'a end class virtual ['a, 'b] cl2 : object method virtual as_cl0 : ('a, 'b, ('a, 'b) cl1) cl0 end then, in another module that contains only the following type declaration type refer = { poly : 'a 'b 'c . (('b, 'c) #Classdef.cl2 as 'a); } raise the error: File "anotherModule.ml", line 1, characters 0-1: Error: The implementation anotherModule.ml does not match the interface (inferred signature): Type declarations do not match: type refer = { poly : 'a 'b 'c. ('b, 'c) #Classdef.cl2 as 'a; } is not included in type refer = { poly : 'a 'b 'c. ('b, 'c) #Classdef.cl2 as 'a; } The types for field poly are not equal. Note that - if I suppress the method raise_trouble - or if neither 'a nor 'b appear in the type of this method, then everything works fine. Can someone explain to me this behavior? (the two files are in the attached tarball): . First, I don't understand which instances of type poly are compared: there is only one single definition of this type and no use. . And second, I don't understand why adding a method will change the behavior. Many thanks in advance, Jean-Louis Giavitto ------------------------------------------------------- Le 22/07/64 20:59, Jean-Louis Giavitto a écrit : > Hello. > if anyone could give me some hints on the following problem... > > > I have a file tt.ml which reduces to > > type typedef = { > isa : 'a 'rep 'cell . > (('rep, int, int, int, int, int) #Collection.collection as 'a); > } > > The mli file is exactly the same has the ml file. 'collection' is a > virtual class declared in file collection.ml and signature in > collection.mli. > > tt.ml compile without problems. However, if I replace (in tt.ml and > tt.mli) one of the 'int' parameter by a type variable: > > type typedef = { > isa : > 'a 'rep 'cell . > (('rep, 'cell, int, int, int, int) #Collection.collection > as 'a); > } > > then I have the following message (with the 4.0 compiler): > > File "tt.ml", line 1: > Error: The implementation tt.ml does not match the interface tt.cmi: > Type declarations do not match: > type typedef = { > isa : > 'a 'rep 'cell. > ('rep, 'cell, int, int, int, int) #Collection.collection as 'a; > } > is not included in > type typedef = { > isa : > 'a 'rep 'cell. > ('rep, 'cell, int, int, int, int) #Collection.collection as 'a; > } > File "tt.ml", line 2, characters 5-112: Actual declaration > The types for field isa are not equal. > > > - The problem appears with the compiler 3.12 but also 4.0 (a similar > error (5622) was reported but was not reproducible with 4.0). > - I have no problem if I drop the .mli file. > - The error seems sensitive to the definition of the class 'collection': > I was not able to reproduce it with a much simpler definition of > collection. > - I have the same error if I replace more 'int' parameter by type > variables. > > Have you any clues? > Jean-Louis Giavitto. -- Jean-Louis Giavitto Ircam CNRS UMR STMS 9912 – UPMC – Inria 1, place Igor Stravinsky, 75004 Paris http://repmus.ircam.fr/giavitto http://mgs.spatial-computing.org --------------010102050908000404030907 Content-Type: application/x-gzip; name="PbWithPolymorphicField.tgz" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="PbWithPolymorphicField.tgz" H4sIABk9908AA+2W32vbMBDH/Tr/FQd7cAKLJzv+Aenal8HeCnnbwxhFlpVF m2wFWS4rY//7Tt5cwlY3hYYUsvuALWEf95V8/h5aVx+V266NvmuM3W2V+KCk rt8Gx4QhZZ77Mc/S1I8pK4ZxJEiSssyLZbEslwFLcGAB5EddxQR957gFCL4o fqucM1NxVu6avlv0rfp+imWdivXD9eetcVtpr03daxk3+lkavsBFlk3WP0mL sf55WZQBS5N8mQfAjrTHR/nP6x+G7m4nwcqNtHAJIcAPvAB2+EfACoZ5xCGq IBIQw2wWVW9wOofX7zXvulpuYqFT4B1GzS8w/GeIvPSuiKcy4X8xFrfR6tka h/yflXv9P2GBf5uV5P9TgGYdag23yrqea/gUcTT4YPLPIDSDVWiqr1I43wuE aTtnuWqdbweX8A4abBLYHxZXvkXgHV9dQBzDFYSyrSeS+8TJfWLM20i3NfV9 GCp08sZZ01daooDX8wr839AH9A8Ip48I8+5m2DLMxq/wZzL3K/Y39jv72XS4 Cf9f829yo7Q8isYh/zM8843+T/w5McWAgvx/CsLaKLcKXxnBGy1gIWC/9e8/ //tIeDYWIAiCIAiCIAiCIAiCIAiCIAiCIIiz4ReImbCHACgAAA== --------------010102050908000404030907--