Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007752OCamltypingpublic2018-03-13 19:232018-03-28 22:35
Assigned Tolpw25 
Platformx86_64OSLinux 4.4.0OS VersionUbuntu 16.04.4
Product Version4.06.1 
Target VersionFixed in Version4.07.0+dev/beta2/rc1/rc2 
Summary0007752: Surprising weakening of module signature: module alias disappears after adding module equality constraint
DescriptionThe following example:

module type S = sig end
module type S2 = sig module M1 : S module M2 = M1 end
module type S' = sig module M : S2 end
module M_ok : S2 = struct module M1 = struct end module M2 = M1 end
module U : S' with module M = M_ok = struct module M = M_ok end
module OM1 : S = struct end
module M_err : S2 with module M1 = OM1 = struct module M1 = OM1 module M2 = M1 end
module U' : S' with module M = M_err = struct module M = M_err end

fails with

(in the last line)
Error: In this `with' constraint, the new definition of M
       does not match its original definition in the constrained signature:
       Modules do not match:
         sig module M1 : sig end module M2 : sig end end
       is not included in
       In module M2:
       Modules do not match: sig end is not included in (module M1)

What's surprising in this behavior is that adding a constraint `with module M1 = OM1` to S2 removed the aliasing `module M2 = M1` from the signature S2 so that now M_err.M1 and M_err.M2 are separate modules. My understanding is that in this example the constraint `with module M1 = OM1` is useless as there are no types to add any equalities to. But without it the example is typechecked without errors. This is based on a more realistic use case where S includes type definitions.
TagsNo tags attached.
Attached Files? file icon [^] (427 bytes) 2018-03-13 19:23 [Show Content]

- Relationships

-  Notes
lpw25 (developer)
2018-03-28 20:36

This was fixed on trunk by [^]

- Issue History
Date Modified Username Field Change
2018-03-13 19:23 mandrykin New Issue
2018-03-13 19:23 mandrykin File Added:
2018-03-14 12:53 mandrykin Note Added: 0018945
2018-03-16 16:55 mandrykin Note Deleted: 0018945
2018-03-28 20:36 lpw25 Note Added: 0018963
2018-03-28 20:36 lpw25 Status new => resolved
2018-03-28 20:36 lpw25 Fixed in Version => 4.07.0+dev/beta2/rc1/rc2
2018-03-28 20:36 lpw25 Resolution open => fixed
2018-03-28 20:36 lpw25 Assigned To => lpw25

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker