-
Notifications
You must be signed in to change notification settings - Fork 463
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 for duplicate labels #6415
Conversation
cc @DZakh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
| Duplicate_label (s, None) -> | ||
fprintf ppf "The field @{<info>%s@} is defined several times in this record. Fields can only be added once to a record." s | ||
| Duplicate_label (s, Some recordName) -> | ||
fprintf ppf "The field @{<info>%s@} is defined several times in the record @{<info>%s@}. Fields can only be added once to a record." s recordName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose the error message might be used for objects as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Objects are a bit trickier, and needs a general overhaul. Doesn't seem like overwriting object fields is an error at all, although you can't change their type of course.
@@ -1998,8 +1998,10 @@ let report_error ppf = function | |||
fprintf ppf "A type parameter occurs several times" | |||
| Duplicate_constructor s -> | |||
fprintf ppf "Two constructors are named %s" s | |||
| Duplicate_label s -> | |||
fprintf ppf "Two labels are named %s" s | |||
| Duplicate_label (s, None) -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious: when does this case fire?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inline records, I believe.
No description provided.