Skip to content

Fix quasiquote-to-list changing behavior on quoted datums#795

Merged
jackfirth merged 1 commit into
masterfrom
fix-quasiquote-to-list-quoted-datums
Jul 7, 2026
Merged

Fix quasiquote-to-list changing behavior on quoted datums#795
jackfirth merged 1 commit into
masterfrom
fix-quasiquote-to-list-quoted-datums

Conversation

@jackfirth

@jackfirth jackfirth commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Fixes a semantics-changing bug in quasiquote-to-list, found while implementing #122 (no pre-existing issue tracks it).

The rule's unquoted syntax class matched non-unquoted elements with literal-constant, which accepts (quote x) forms. But inside a quasiquoted list, 'x is plain data:

(define y 2)
`(1 ,y 'x)      ; evaluates to '(1 2 (quote x))
(list 1 y 'x)   ; evaluates to '(1 2 x)  — the rule's suggested replacement

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-literal syntax class moves from hash-shortcuts.rkt — which introduced it to dodge this exact trap in #794 — to a shared module in default-recommendations/private/. Also fixes an "equialent" → "equivalent" typo in the descriptions of quasiquote-to-list and quasiquote-to-append.

🤖 Generated with Claude Code

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>
@jackfirth jackfirth enabled auto-merge (squash) July 7, 2026 09:10
@jackfirth jackfirth merged commit 5c079cc into master Jul 7, 2026
5 checks passed
@jackfirth jackfirth deleted the fix-quasiquote-to-list-quoted-datums branch July 7, 2026 09:14

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resyntax analyzed 4 files in this pull request and found no issues.

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.

1 participant