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

module T1 = T2 does not result in (module T1) = (module T2) as types #5847

Closed
vicuna opened this issue Dec 5, 2012 · 2 comments
Closed

module T1 = T2 does not result in (module T1) = (module T2) as types #5847

vicuna opened this issue Dec 5, 2012 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Dec 5, 2012

Original bug ID: 5847
Reporter: @zoggy
Assigned to: @alainfrisch
Status: resolved (set by @alainfrisch on 2012-12-05T15:39:30Z)
Resolution: suspended
Priority: normal
Severity: minor
Version: 4.00.2+dev
Category: typing

Bug description

The following code:

module type T1 = sig end

let foo t =
let module T = (val t : T1) in
()
;;

module type T2 = T1

let bar (t : (module T2)) = foo t;;

gives the following error message:

File "mtype.ml", line 11, characters 32-33:
Error: This expression has type (module T2)
but an expression was expected of type (module T1)

I expected T2 to be equal to T1 but it doesn't seem to the case. Am I missing something ?

@vicuna
Copy link
Author

vicuna commented Dec 5, 2012

Comment author: @alainfrisch

The equality of packages types is based on the path equivalence of module types. In other words, we use nominal typing for first-class modules. This is the current expected behavior. Maybe it will be relaxed in the future, but there is no concrete plans to do so.

@vicuna vicuna closed this as completed Dec 5, 2012
@vicuna
Copy link
Author

vicuna commented Dec 5, 2012

Comment author: @zoggy

Ok. Sorry, I missed it in the doc (I see it now).

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