feat: support literal string map pattern keys - #22
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends QuickCoffee’s map destructuring (pattern matching on {...}) to accept literal string keys (single- or double-quoted) in addition to identifier keys, aligning pattern syntax with map literal capabilities while continuing to reject computed/interpolated keys.
Changes:
- Parser: allow
Token::Stringkeys in map destructuring patterns, rejecting interpolated (computed) string keys. - Tests: add regression coverage for successful binding and failure cases with literal string keys.
- Docs/RFCs: add RFC 0090 and update English/Chinese syntax indexes plus README RFC range.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/rfc_core.rs | Adds regression tests for literal string keys in map destructuring (success + error cases). |
| src/parser.rs | Extends map-pattern key parsing to accept literal string tokens while rejecting computed/interpolated keys. |
| RFCs/0090-string-map-pattern-keys.md | New RFC documenting the contract and acceptance criteria for literal string map-pattern keys. |
| README.md | Updates the “RFCs range” link to include RFC 0090. |
| docs/syntax.zh-CN.md | Updates the Chinese syntax index to document literal string keys in map destructuring and exclude computed keys. |
| docs/syntax.en.md | Updates the English syntax index to document literal string keys in map destructuring and exclude computed keys. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Summary
Validation
make checkNo new VM instruction is required; keys are lowered to the existing map pattern representation.