-
Notifications
You must be signed in to change notification settings - Fork 471
Specialized errors for when colon and equals are mixed up #7900
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
Conversation
rescript
@rescript/darwin-arm64
@rescript/darwin-x64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
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.
Pull Request Overview
This PR adds specialized error messages for syntax errors where colons (:
) and equals (=
) are mixed up in various ReScript language constructs. The changes improve developer experience by providing clearer, context-specific error messages when these common syntax mistakes occur.
- Adds dedicated error messages for record field, pattern, and labelled argument syntax errors
- Implements error handling logic in the parser to detect and report these specific mistakes
- Provides comprehensive test coverage for all error scenarios
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
res_core.ml | Adds error message constants and parser logic to detect colon/equals mix-ups |
recordFieldWrongAssignment.res (multiple) | Test cases demonstrating the syntax errors in different contexts |
expected/*.res.txt (multiple) | Expected error output showing the new specialized error messages |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
tests/syntax_tests/data/parsing/errors/structure/expected/recordFieldWrongAssignment.res.txt
Show resolved
Hide resolved
tests/syntax_tests/data/parsing/errors/pattern/expected/recordFieldWrongAssignment.res.txt
Show resolved
Hide resolved
...s/syntax_tests/data/parsing/errors/expressions/expected/labelledArgumentMissingEqual.res.txt
Show resolved
Hide resolved
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.
Parser changes look good!
I'll let the others speak about the error messages.
… function arguments, and more
09c1615
to
d9295b6
Compare
@cknitt care to have a look at these error messages? |
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.
much clearer error messages, great work @zth!
Good to have dedicated errors for these cases, where
:
and=
are mixed up.