-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
This program does not typecheck, but should:
module type S = sig
type t [@@immediate]
end
type t = (module S with type t = int)Error:
File "/home/ccasinghino/tmp/bar.ml", line 5, characters 9-37:
5 | type t = (module S with type t = int)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: In this with constraint, the new definition of t
does not match its original definition in the constrained signature:
Type declarations do not match:
type t
is not included in
type t [@@immediate]
The first is not an immediate type.
File "/home/ccasinghino/tmp/bar.ml", line 2, characters 2-22:
Expected declaration
File "/home/ccasinghino/tmp/bar.ml", line 5, characters 9-37:
Actual declaration
As far as I can tell, it is impossible to use a with type constraint for an immediate type in a package type. The direct cause is that the "fake" module type constructed by Typetexp.create_package_mty doesn't keep the manifests from the with type constraints, though a fix is not so simple as keeping them.
I thought this had been reported before, but I can't find a ticket - apologies if this is a duplicate.
Metadata
Metadata
Assignees
Labels
No labels