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

Type error message when constructors are mis-ordered could be clearer #4478

Closed
vicuna opened this Issue Jan 13, 2008 · 1 comment

Comments

Projects
None yet
2 participants
@vicuna
Copy link
Collaborator

vicuna commented Jan 13, 2008

Original bug ID: 4478
Reporter: @dra27
Assigned to: @garrigue
Status: closed (set by @garrigue on 2010-05-21T03:38:15Z)
Resolution: fixed
Priority: normal
Severity: feature
Version: 3.09.3
Fixed in version: 3.12.0+dev
Category: ~DO NOT USE (was: OCaml general)
Related to: #4819

Bug description

Foo.ml:

type t = A | B

Foo.mli

type t = B | A

Running ocamlc -c t.mli t.ml correctly reports that...
The implementation t.ml does not match the interface t.cmi:
Type declarations do not match:
type t = B | A
is not included in
type t = A | B

However, the mismatch is only because the constructors are misordered. This is a slightly cryptic error unless you know about the internals of OCaml - perhaps in this instance, ocamlc could note that the types would be compatible if the constructors were in the same order?

Additional information

I was being daft here and wrote an mli file with my brain switched off. Although I know from writing C stubs that the constructors must obviously be in the same order for the types to be the same, it took quite me some time to realise my stupidity because the type I was dealing with was much longer. The additional warning would be most useful!

I presume 3.10.1 behaves the same way...

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented May 21, 2010

Comment author: @garrigue

Error messages concerning type declaration mismatches have been greatly improved for 3.12.

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.