Fix quasiquote-to-list changing behavior on quoted datums#795
Merged
Conversation
The quasiquote-to-list rule matched non-unquoted elements with the literal-constant syntax class, which accepts (quote x) forms. Inside a quasiquoted list those are plain data, so rewriting `(1 ,y 'x) to (list 1 y 'x) changed the last element from the list (quote x) to the symbol x. Non-unquoted elements must now be self-quoting literals. The self-quoting-literal syntax class moves from hash-shortcuts, which added it for the same reason in #794, to a shared private module. Also fixes an "equialent" typo in two rule descriptions. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Resyntax analyzed 4 files in this pull request and found no issues.
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.
Fixes a semantics-changing bug in
quasiquote-to-list, found while implementing #122 (no pre-existing issue tracks it).The rule's
unquotedsyntax class matched non-unquoted elements withliteral-constant, which accepts(quote x)forms. But inside a quasiquoted list,'xis plain data:Non-unquoted elements must now be self-quoting literals (booleans, characters, numbers, regexps, strings, bytes), so quasiquotations containing quoted datums, bare symbols, or nested lists produce no suggestion. Quasiquotations mixing unquotes with self-quoting constants still refactor as before.
The
self-quoting-literalsyntax class moves fromhash-shortcuts.rkt— which introduced it to dodge this exact trap in #794 — to a shared module indefault-recommendations/private/. Also fixes an "equialent" → "equivalent" typo in the descriptions ofquasiquote-to-listandquasiquote-to-append.🤖 Generated with Claude Code