Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Error message for 'Illegal permutation of structure fields' #3819

Closed
vicuna opened this issue Oct 24, 2005 · 4 comments · Fixed by #8546
Closed

Feature Request: Error message for 'Illegal permutation of structure fields' #3819

vicuna opened this issue Oct 24, 2005 · 4 comments · Fixed by #8546

Comments

@vicuna
Copy link

vicuna commented Oct 24, 2005

Original bug ID: 3819
Reporter: administrator
Status: acknowledged
Resolution: open
Priority: normal
Severity: feature
Category: typing
Monitored by: @gasche

Bug description

Full_Name: Ethan Aubin
Version: 3.08.4
OS: linux
Submission from: c-24-60-21-144.hsd1.ma.comcast.net (24.60.21.144)

I came across an error saying 'Illegal permutation of structure fields'. The
modules I'm working with are have interfaces ~ 150 lines and its hard to figure
out whats in the wrong spot. Could the message print an which fields are
conflicting (omitting the rest)? Thanks -EA

File attachments

@vicuna
Copy link
Author

vicuna commented Feb 18, 2015

Comment author: @zoggy

Ping.

@vicuna
Copy link
Author

vicuna commented Feb 18, 2015

Comment author: @gasche

Would someone feel motivated to provide a small representative program that displays this warning?

@vicuna
Copy link
Author

vicuna commented Feb 18, 2015

Comment author: @yallop

Here's an example. The problem boils down to incompatibility between module type members when checking signature inclusion compatibility:

   # module F (X : sig module type T = sig val x : int val y : int end end) =
              (X : sig module type T = sig val y : int val x : int end end);;
     Characters 85-86:
                (X : sig module type T = sig val y : int val x : int end end);;
                 ^
   Error: Signature mismatch:
          Modules do not match:
            sig module type T = sig val x : int val y : int end end
          is not included in
            sig module type T = sig val y : int val x : int end end
          Module type declarations do not match:
            module type T = sig val x : int val y : int end
          does not match
            module type T = sig val y : int val x : int end
          At position module type T = <here>
          Illegal permutation of structure fields

@vicuna
Copy link
Author

vicuna commented Feb 18, 2015

Comment author: @zoggy

Here are four files.
When compiling order.mli and order.ml, the error message:

File "order.ml", line 1:
Error: The implementation order.ml does not match the interface order.cmi:
       ...
       At position module type M = <here>
       Illegal permutation of structure fields

When compiling order_m.mli and order_m.ml:

File "order_m.ml", line 1:
Error: The implementation order_m.ml
       does not match the interface order_m.cmi:
       Module type declarations do not match:
         module type M =
           sig
             module T : sig type t = string end
             module T2 : sig val foo : int -> string end
           end
       does not match
         module type M =
           sig
             module T2 : sig val foo : int -> string end
             module T : sig type t = string end
           end
       At position module type M = <here>
       Illegal permutation of structure fields

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant