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

Extensible constructor with the same name but different types are not exported correctly #6984

Closed
vicuna opened this issue Sep 9, 2015 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Sep 9, 2015

Original bug ID: 6984
Reporter: pcouderc
Status: closed (set by @xavierleroy on 2017-02-16T14:16:36Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.02.3
Fixed in version: 4.03.0+dev / +beta1
Category: typing
Monitored by: @gasche

Bug description

When extending two different types with the same constructor, only the last one is exported in the signature.

For example:

type t = ..;;

type t = ..

type u = ..;;

type u = ..

module M = struct

type t += M
type u += M
end;;
module M : sig type u += M end

That also means that an exception can be shadowed by a constructor that has the same name. It does not matter if both constructor have a different type.

Is it the expected behavior of extensible types? It also happens with module types. I would have guessed that it should be rejected (like multiple definitions of a type).

If not I suppose it may happen when simplifying the signature of a module to remove duplicate idents (which is problematic with type extensions since they should be ordered by a constructor name and a type path).

@vicuna
Copy link
Author

vicuna commented Sep 9, 2015

Comment author: @alainfrisch

The trunk version already rejects structures that defines multiple extension constructors (including exceptions) with the same name. (This allowed to spot a few bugs here and there.)

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