Skip to content

Conversation

zth
Copy link
Member

@zth zth commented Sep 18, 2025

Good to have dedicated errors for these cases, where : and = are mixed up.

Copy link

pkg-pr-new bot commented Sep 18, 2025

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript-lang/rescript@7900

@rescript/darwin-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-arm64@7900

@rescript/darwin-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-x64@7900

@rescript/linux-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-arm64@7900

@rescript/linux-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-x64@7900

@rescript/runtime

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/runtime@7900

@rescript/win32-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/win32-x64@7900

commit: d9295b6

Copy link
Contributor

@Copilot Copilot AI left a 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.

Copy link
Member

@nojaf nojaf left a 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.

@zth zth force-pushed the better-assign-errors branch from 09c1615 to d9295b6 Compare September 19, 2025 07:03
@zth
Copy link
Member Author

zth commented Sep 19, 2025

@cknitt care to have a look at these error messages?

Copy link
Member

@tsnobip tsnobip left a 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!

@zth zth merged commit f53e36d into master Sep 19, 2025
25 checks passed
@zth zth deleted the better-assign-errors branch September 19, 2025 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants