Provide specific error for uppercase typedef
Fixes #122. It works, but it is probably still far to be the right fix 😅 Any feedback is appreciated.
Looking into this PR now. I'm thinking about ways to handle this in a more generic way.
After having given it some thought, this looks like the correct solution. I was thinking that we should solve it in a more “generic” way, but that turned out to be magic. One of the goals of the new syntax is to keep the implementation of the parser as simple as possible. Your intuition was good. Thanks for helping out here.
A couple of suggestions:
- Can we change the parameter
?customErrorinto~msg? It would be good if the caller ofparseValuePathneeded to pass an error message. This way we “force” good error messages everywhere =D Can we pass an appropriate error message everywhere? Should this just be a simple string? - Would it be possible to add test cases for every possible situation where
parseValuePathis called with an uppercased ident? We can dump them all in one filetests/parsing/errors/other/if you want. - Unrelated, but should we rename
let rec auxtolet rec parseValuePathRestorlet rec parseValuePathTailto make it more clear insideparseValuePath? What do you think?
The rescript-lang/syntax repo is obsolete and will be archived soon. If this issue is still relevant, please reopen in the compiler repo (https://github.com/rescript-lang/rescript-compiler) or comment here to ask for it to be moved. Thank you for your contributions.