You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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 aliasingmodule 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 constraintwith 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
The text was updated successfully, but these errors were encountered: