Hello all!
The following code fragment compiles with OCaml 4.02.3 to 4.06.0 but not with 4.07:
module Original = struct
module X = struct
let x = 42
end
end
module Intermediate = struct
include Original
end
module Final = struct
module X = struct
let x = 43
end
include (Intermediate: module type of Intermediate with module X := X)
end
With 4.07, it fails with this error message:
Error: In this `with' constraint, the new definition of X
does not match its original definition in the constrained signature:
Modules do not match:
(module X)
is not included in
(module Original.X)
If you remove the Intermediate
module (and include (Original: module type of Original with module X := X)
, it does compile with all versions I tried.
Questions:
- is it expected to compile? (i.e. was it a bug in previous versions or is it a regression in 4.07?)
- is there a workaround to make it work with 4.07
Thanks!