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 aliases not expanded when comparing abstract module types #7204

Closed
vicuna opened this Issue Apr 1, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@vicuna
Copy link
Collaborator

vicuna commented Apr 1, 2016

Original bug ID: 7204
Reporter: @stedolan
Assigned to: @lpw25
Status: closed (set by @xavierleroy on 2017-09-24T15:32:11Z)
Resolution: duplicate
Priority: low
Severity: feature
Version: 4.02.3
Fixed in version: 4.03.1+dev
Category: typing
Duplicate of: #7112
Monitored by: @yallop

Bug description

Suppose I write a functor producing an abstract module type:

module type THING = sig 
  type t
  val thing : t
end

module F (X : THING) : sig
  module type T
end = struct
  module type T = sig type t = X.t end
end

and I make a module of signature THING, and an alias:

module Int : THING = struct 
  type t = int
  let thing = 42
end

module Int2 = Int

I feel that, while abstract, the module types F(Int).T and F(Int2).T are equal. However, signature matching disagrees with me, by rejecting:

module Same (X : F(Int).T) : F(Int2).T = X

On the other hand, as of 4.02.3, the subtyping relation agrees with me, by accepting:

module Same (X : F(Int).T) () : F(Int2).T =
  (val ((module X : F(Int).T) :> (module F(Int2).T)))

Is this a simple oversight, or is there some reason to avoid expanding module aliases when comparing abstract module types? How much work would be necessary to make OCaml accept the first version of Same?

(this is low-priority, because I intend to use this ability to write only the most silly of programs)

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Apr 1, 2016

Comment author: @lpw25

Have you tried your example with trunk? Because this may be a duplicate of #7112.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Apr 1, 2016

Comment author: @stedolan

You're right, this is fixed on trunk. Missed that PR. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
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.