caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] In 3.12 and 4.0, erratic message "The implementation tt.ml does not match the interface tt.cmi"
@ 2012-07-04 22:54 Jean-Louis Giavitto
  2012-07-06 19:36 ` [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") Jean-Louis Giavitto
  0 siblings, 1 reply; 3+ messages in thread
From: Jean-Louis Giavitto @ 2012-07-04 22:54 UTC (permalink / raw)
  To: caml-list

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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [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")
  2012-07-04 22:54 [Caml-list] In 3.12 and 4.0, erratic message "The implementation tt.ml does not match the interface tt.cmi" Jean-Louis Giavitto
@ 2012-07-06 19:36 ` Jean-Louis Giavitto
  2012-07-07  0:13   ` Jacques Garrigue
  0 siblings, 1 reply; 3+ messages in thread
From: Jean-Louis Giavitto @ 2012-07-06 19:36 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 3508 bytes --]

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

[-- Attachment #2: PbWithPolymorphicField.tgz --]
[-- Type: application/x-gzip, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [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")
  2012-07-06 19:36 ` [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") Jean-Louis Giavitto
@ 2012-07-07  0:13   ` Jacques Garrigue
  0 siblings, 0 replies; 3+ messages in thread
From: Jacques Garrigue @ 2012-07-07  0:13 UTC (permalink / raw)
  To: jean-louis.giavitto; +Cc: Mailing OCaML

I could reproduce this bug with 3.11 and 3.12.
It appears to be fixed in the latest version of 4.00 (and trunk).
(By the way, bugs should go to the bug tracker...)

Jacques Garrigue

On 2012/07/07, at 4:36, Jean-Louis Giavitto wrote:

> 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
> 
> -- 
> Caml-list mailing list.  Subscription management and archives:
> https://sympa-roc.inria.fr/wws/info/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
> 
> <PbWithPolymorphicField.tgz>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-07-07  4:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-04 22:54 [Caml-list] In 3.12 and 4.0, erratic message "The implementation tt.ml does not match the interface tt.cmi" Jean-Louis Giavitto
2012-07-06 19:36 ` [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") Jean-Louis Giavitto
2012-07-07  0:13   ` Jacques Garrigue

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).