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

Unexpected behaviour of T with module M = N (to me at least) #7337

Closed
vicuna opened this issue Aug 30, 2016 · 2 comments
Closed

Unexpected behaviour of T with module M = N (to me at least) #7337

vicuna opened this issue Aug 30, 2016 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Aug 30, 2016

Original bug ID: 7337
Reporter: furuse
Assigned to: @gasche
Status: closed (set by @xavierleroy on 2017-09-24T15:33:26Z)
Resolution: duplicate
Priority: normal
Severity: major
Version: 4.03.0
Category: typing
Duplicate of: #5514
Monitored by: @gasche

Bug description

In OCaml 4.03.0, S with module M = N adds all the components available of N's signature to S. It contradicts what the reference manual says: 6.10.4 of http://caml.inria.fr/pub/docs/manual-ocaml/modtypes.html

Steps to reproduce

The following code reproduce the issue:


module type S = sig
module M : sig type t end
end

module N = struct
type t = int
type u = float
let x = 1
end

module type T = S with module M = N


Above, I thought module type T is equal to

sig module M : sig type t = N.t end end

but ocamlc -i shows that

sig module M : sig type t = int type u = float val x : int end end

@vicuna
Copy link
Author

vicuna commented Aug 30, 2016

Comment author: furuse

Oh, my second thought sig type t = int type u = float val x : int end is a subtype of the original type, so it is ok... ;-)

@vicuna
Copy link
Author

vicuna commented Aug 30, 2016

Comment author: furuse

Ah, in #5514, people have already discuss about the document issue too. Thanks!

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