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

Private constraints accepted by toplevel but not by compiler #4623

Closed
vicuna opened this issue Oct 15, 2008 · 2 comments
Closed

Private constraints accepted by toplevel but not by compiler #4623

vicuna opened this issue Oct 15, 2008 · 2 comments
Assignees
Labels

Comments

@vicuna
Copy link

vicuna commented Oct 15, 2008

Original bug ID: 4623
Reporter: dario
Assigned to: @garrigue
Status: closed (set by @garrigue on 2010-04-27T07:16:51Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.11+dev
Fixed in version: 3.11+dev
Category: ~DO NOT USE (was: OCaml general)
Related to: #4580

Bug description

Using the just released 3.11 Beta1, the following code is accepted by the top-level:

module Foobar:
sig
type foo_t = [ A ] type bar_t = [ B ]
type foobar_t = [ foo_t | bar_t ]
type 'a t = private 'a constraint 'a = [< foobar_t ]

    val make_a: unit -> foo_t t
    val make_b: unit -> bar_t t

end =
struct
type foo_t = [ A ] type bar_t = [ B ]
type foobar_t = [ foo_t | bar_t ]
type 'a t = 'a constraint 'a = [< foobar_t ]

    let make_a () = `A
    let make_b () = `B

end

But is rejected by both the byte and native code compilers:

File "constraint.ml", line 1, characters 0-1:
Error: The implementation constraint.ml
does not match the interface (inferred signature):
Modules do not match:
sig
type foo_t = [ A ] type bar_t = [ B ]
type foobar_t = [ A | B ]
type 'a t = 'a Foobar.t constraint 'a = [< foobar_t ]
val make_a : unit -> foo_t t
val make_b : unit -> bar_t t
end
is not included in
sig
type foo_t = [ A ] type bar_t = [ B ]
type foobar_t = [ A | B ]
type 'a t = private 'a constraint 'a = [< foobar_t ]
val make_a : unit -> foo_t t
val make_b : unit -> bar_t t
end
Type declarations do not match:
type 'a t = 'a Foobar.t constraint 'a = [< foobar_t ]
is not included in
type 'a t = private 'a constraint 'a = [< foobar_t ]

@vicuna
Copy link
Author

vicuna commented Oct 16, 2008

Comment author: @garrigue

Actually the problem was not unrelated to constraints.
A minimal reproduction case follows:

module Foobar : sig type t = private int end =
struct type t = int end

This is now fixed in CVS/release311, by allowing head-expansion of private
abbreviations when defining a private type.

@vicuna
Copy link
Author

vicuna commented Apr 27, 2010

Comment author: @garrigue

safe to close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants