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

Surprising weakening of module signature: module alias disappears after adding module equality constraint #7752

Closed
vicuna opened this issue Mar 13, 2018 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Mar 13, 2018

Original bug ID: 7752
Reporter: mandrykin
Assigned to: @lpw25
Status: resolved (set by @lpw25 on 2018-03-28T18:36:59Z)
Resolution: fixed
Priority: low
Severity: feature
Platform: x86_64
OS: Linux 4.4.0
OS Version: Ubuntu 16.04.4
Version: 4.06.1
Fixed in version: 4.07.0+dev/beta2/rc1/rc2
Category: typing
Monitored by: @gasche

Bug description

The 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
S2
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.

File attachments

@vicuna
Copy link
Author

vicuna commented Mar 28, 2018

Comment author: @lpw25

This was fixed on trunk by #1652.

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

No branches or pull requests

2 participants