Skip to content

fix: collect ?-inputs only from symbols in >leaf/>sequence expressions - #64

Open
caiotheodoro wants to merge 1 commit into
nubank:mainfrom
caiotheodoro:fix/question-mark-in-string-literals
Open

caiotheodoro wants to merge 1 commit into
nubank:mainfrom
caiotheodoro:fix/question-mark-in-string-literals

Conversation

@caiotheodoro

Copy link
Copy Markdown

fix: collect ?-inputs only from symbols in >leaf/>sequence expressions

Fixes #59

Summary

  • expression-symbols filtered expression-tree leaves with (complement seqable?).
    Strings are seqable?, so tree-seq descended into string literals and yielded
    Character leaves — a \? char then passed the ? prefix check, was treated as
    an input, and crashed macroexpansion via (resolve \?) (Character → Symbol CCE).
  • Any ? inside a string/char literal — e.g. (>leaf (str "url/" ?id "?q=1")) —
    made the >leaf/>sequence form fail to compile.
  • Now filters symbol?, which is all ?-input discovery operates on.

Test plan

  • Added regression deftest covering ?-strings, \? char literals, ?-strings
    inside >sequence fns, and real inputs mixed with ?-strings — all CCE on the
    old implementation.
  • lein test equivalent (full suite): 55 tests, 264 assertions, 0 failures.

expression-symbols collected every non-seqable leaf of the expression
tree. Strings are seqable, so tree-seq descended into string literals
and yielded Character leaves; a '?' character (from any string or char
literal containing '?', e.g. (str "?x") or \?) passed the '?'
prefix check in question-mark-symbols and was treated as an input
symbol, crashing macroexpansion with a ClassCastException when
assert-not-shadowing! called resolve on the Character.

Filtering with symbol? collects only actual symbols, which is what the
'?'-input syntax operates on.

Fixes nubank#59
Copilot AI balanced review requested due to automatic review settings November 24, 2026 00:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

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.

Bug? expression-symbols

2 participants