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

seemingly inconsistent type checker behavior #6788

Closed
vicuna opened this issue Feb 19, 2015 · 1 comment
Closed

seemingly inconsistent type checker behavior #6788

vicuna opened this issue Feb 19, 2015 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Feb 19, 2015

Original bug ID: 6788
Reporter: milanst
Assigned to: @yallop
Status: closed (set by @xavierleroy on 2016-12-07T10:47:14Z)
Resolution: duplicate
Priority: normal
Severity: minor
Version: 4.02.1
Category: typing
Duplicate of: #6786

Bug description

This was discussed on caml-list. It seems that type checker in some cases drops module alias information but not always.

It looks like a bug in the type checker.

Steps to reproduce

module type S = sig type t end
module Make (M : sig end) : S = struct type t end

module M : sig
type t
module C : S with type t = t
end = struct
module C = struct
module T = struct end
include Make (T)
end
include C
end

The above fails to compile with following error:
Error: Signature mismatch:
Modules do not match:
sig
module C : sig module T : sig end type t = Make(T).t end
module T = C.T
type t = Make(T).t
end
is not included in
sig type t module C : sig type t = t end end
In module C:
Modules do not match:
sig module T : sig end type t = Make(T).t end
is not included in
sig type t = t end
In module C:
Type declarations do not match:
type t = Make(T).t
is not included in
type t = t

This seems to say that C.t is not the same as Make(T).t. But the following compiles which seems to say that all type [t]s that I have are the same.

module type S = sig type t end
module Make (M : sig end) : S = struct type t end

module M : sig
type t
val f1 : t -> unit
val f2 : t -> unit
val f3 : t -> unit
val f4 : t -> unit
end = struct
module C = struct
module T = struct end
include Make (T)
end
include C

let f1 (x : t) = ()
let f2 (x : Make(C.T).t) = ()
let f3 (x : C.t) = ()
let f4 (x : Make(T).t) = ()
end

@vicuna
Copy link
Author

vicuna commented Feb 19, 2015

Comment author: milanst

Sorry, I didn't see that Carl already created a bug report.
#6786

I don't know how to mark this as duplicate, admins can probably do it.

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

1 participant