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: 6213 Reporter: jpdeplaix Assigned to:@gasche Status: closed (set by @xavierleroy on 2015-12-11T18:24:16Z) Resolution: not a bug Priority: normal Severity: minor Version: 4.01.0 Category: typing Monitored by:@gasche
Bug description
The following example, fails to compile with this message:
Error: In this `with' constraint, the new definition of Make
does not match its original definition in the constrained signature:
...
At position functor (H) ->
Values do not match:
val stats : 'a t -> Hashtbl.statistics
is not included in
val stats : 'a t -> statistics
But if we uncomment the first line, it compiles.
It seems to me that it's a bug because it works fine in some cases, but maybe it's a known behavior.
Steps to reproduce
(* module Hashtbl = Hashtbl *)
module M = struct
include (Hashtbl :
module type of Hashtbl
with module Make := Hashtbl.Make
)
end
The text was updated successfully, but these errors were encountered:
module M = struct
include (Hashtbl :
module type of Hashtbl
with type statistics = Hashtbl.statistics
with module Make := Hashtbl.Make
)
end
The reason is that "module type of" does not strengthen the type of the module, i.e. it does not add automatically the information that type statistics = Hashtbl.statistics.
(If you add the line "module Hashtbl = Hashtbl", Hashtbl.statistics is no longer an abstract type, which explains why it works)
The weaker choice was originally done to allow changing the definition of abstract types in the signature.
Retrospectively, it was probably a bad choice, because there are extremely few cases where this is needed, while one almost always needs the strengthened types.
Original bug ID: 6213
Reporter: jpdeplaix
Assigned to: @gasche
Status: closed (set by @xavierleroy on 2015-12-11T18:24:16Z)
Resolution: not a bug
Priority: normal
Severity: minor
Version: 4.01.0
Category: typing
Monitored by: @gasche
Bug description
The following example, fails to compile with this message:
Error: In this `with' constraint, the new definition of Make
does not match its original definition in the constrained signature:
...
At position functor (H) ->
Values do not match:
val stats : 'a t -> Hashtbl.statistics
is not included in
val stats : 'a t -> statistics
But if we uncomment the first line, it compiles.
It seems to me that it's a bug because it works fine in some cases, but maybe it's a known behavior.
Steps to reproduce
(* module Hashtbl = Hashtbl *)
module M = struct
include (Hashtbl :
module type of Hashtbl
with module Make := Hashtbl.Make
)
end
The text was updated successfully, but these errors were encountered: