Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004296OCamlOCaml generalpublic2007-05-24 18:292010-04-30 06:42
Reporterprevosto 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version3.10.0 
Target VersionFixed in Version3.12.0+dev 
Summary0004296: compilation failed on module types with duplicated values
Description--- test.ml
module type B = sig val x: int val y: int val x: int end
---
ocamlc -c test.ml
The implementation test.ml does not match the interface (inferred signature):
Module type declarations do not match:
  module type B = sig val x : int val y : int val x : int end
does not match
  module type B = sig val x : int val y : int val x : int end
Illegal permutation of structure fields

It seems like the duplicated fields are ordered differently when producing the interface and the bytecode. module type B above is quite silly, but the same thing happens of course when the duplication comes from included modules, in which case it is not possible to simply erase one of the fields in the source, such as in the example below:

--- test2.ml
module type A = sig val x: int val y: int end
module type B = sig val x: int val z: int end
module type C = sig include A include B end
---
TagsNo tags attached.
Attached Files

- Relationships
duplicate of 0004136closed Obscure compilation message error "Illegal permutation of structure fields" 

-  Notes
(0004071)
ertai (developer)
2007-05-25 11:03

The error message is not ideal but the problem is that your signature is not satisfiable, so you should fix it.
(0004074)
prevosto (reporter)
2007-05-25 14:45

According to the compiler, the signature is perfectly satisfiable. At least in the sense that you can use it as the signature of a module implementation:

module A: sig val x: int val y: int val x:int end =
struct let x = 0 let y = 1 end

is accepted by the compiler (and of course you can remove the sig from the .ml to put it in the .mli
(0005421)
garrigue (manager)
2010-04-30 06:42

Fixed together with the introduction of destructive substitution (revision 10263).

- Issue History
Date Modified Username Field Change
2007-05-24 18:29 prevosto New Issue
2007-05-25 11:03 ertai Note Added: 0004071
2007-05-25 14:45 prevosto Note Added: 0004074
2007-11-10 15:27 xleroy Status new => acknowledged
2009-08-25 15:19 xclerc Relationship added duplicate of 0004136
2010-04-30 06:42 garrigue Note Added: 0005421
2010-04-30 06:42 garrigue Status acknowledged => closed
2010-04-30 06:42 garrigue Resolution open => fixed
2010-04-30 06:42 garrigue Fixed in Version => 3.12.0+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker