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

Improve error message "This expression has type foo but is used with type foo" #4716

Closed
vicuna opened this issue Feb 12, 2009 · 1 comment
Closed
Assignees

Comments

@vicuna
Copy link

vicuna commented Feb 12, 2009

Original bug ID: 4716
Reporter: Yoric
Assigned to: @garrigue
Status: closed (set by @garrigue on 2010-04-30T07:12:46Z)
Resolution: fixed
Priority: normal
Severity: feature
Fixed in version: 3.12.0+dev
Category: ~DO NOT USE (was: OCaml general)
Monitored by: @glondu

Bug description

Beginners are often baffled by error message "This expression has type foo but is used with type foo", due to having two types with the same name in the toplevel.

I suggest that, whenever the toplevel is instructed to print an error messages that that two types are incompatible, it first checks whether the pretty-printed types are identical, in which case it rather prints a message along the lines of
"This expression has type foo but is used with type foo. This strange error message is due to the fact that you have define two types with the same name and are attempting to use a value corresponding to one definition as if it belonged to the other definition."

@vicuna
Copy link
Author

vicuna commented Apr 30, 2010

Comment author: @garrigue

Use unique names (with internal number) when reporting a type error involving conflicting
identifiers with same name.
(at revision 10333)

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

2 participants