Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds a dedicated error message for dict literal spreads, which are not yet supported in ReScript. The change improves user experience by providing a clear, specific error message when developers attempt to use spread syntax (...) in dict literals.
Key changes:
- Adds specific error handling for spread syntax in dict literals
- Provides clear error message indicating the feature is not yet supported
- Includes test case to verify the error behavior
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| res_core.ml | Adds error message constant and parsing logic to detect and handle dict spread syntax |
| dict_spread.res | Test case containing invalid dict spread syntax |
| dict_spread.res.txt | Expected error output for the test case |
| CHANGELOG.md | Documents the improvement in the Polish section |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
rescript
@rescript/darwin-arm64
@rescript/darwin-x64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
nojaf
approved these changes
Sep 18, 2025
| ...b}` wouldn't make sense, as `b` would override every field of `a` \ | ||
| anyway." | ||
|
|
||
| let dict_expr_spread = "Dict literals do not support spread (`...`) yet." |
Member
There was a problem hiding this comment.
Bit of a stretch, but we could sneak in a link to a GitHub issue folks can upvote. That gives an indication how many people have tried this.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We do not support spreads in dict literals yet, but one day we will. This gives a proper error for the spread in the meantime.