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

Better error message for modules with lowercase identifiers #2062

Merged
merged 2 commits into from
Jul 11, 2018

Conversation

anmonteiro
Copy link
Member

fixes #1974

@@ -1047,6 +1047,9 @@ let record_pat_spread_msg =
Explanation: you can't collect a subset of a record's field into its own record, since a record needs an explicit declaration and that subset wouldn't have one.
Solution: you need to pull out each field you want explicitly."

let lowercase_module_msg s =
Printf.sprintf "Module names must be uppercase identifiers. `%s` is not an uppercase identifier." s
Copy link
Contributor

@hcarty hcarty Jul 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have uppercase identifier defined somewhere? It may be helpful to be explicit in this error message - something along the lines of Module names must start with an uppercase letter. `%s` does not start with an uppercase letter.

EDIT: tweaked wording

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hcarty that sounds good to me. I'm expecting @chenglou to bikeshed the error message anyway!

@chenglou
Copy link
Member

Yeah no need to say that "foo" isn't uppercased.

Thanks!

@chenglou chenglou merged commit 7d44d1c into reasonml:master Jul 11, 2018
@anmonteiro anmonteiro deleted the gh-1974 branch July 11, 2018 21:32
@IwanKaramazow
Copy link
Contributor

I'm not sure to what extend we should encode all those error cases into the grammar. There's the cost of tampering with the grammar that might result into shift/reduce conflicts in the future. For example, LIDENT is a common for core_types/mod_types. Some errors might be better positioned in the error message table to avoid needless grammar complexity.

@chenglou
Copy link
Member

Should we revert this one then?

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

Successfully merging this pull request may close these issues.

lowercase module name: Syntax error
5 participants