You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Checker::is_string calls a Tcl / iRules braced_word a string literal
whatever role it plays, so bca find --type string reports a proc
body, an if body and an iRules when handler as string literals.
#1318 built the predicate that settles this — a braced word is a value
when the command it is passed to takes a value, and a script otherwise
— but it could not apply it here, because Checker::is_string takes
neither code nor ancestors.
That is a proc body — the block whose commands the walk descends into
— reported as a string literal. The literal half is already right: after #1318 the same command reports {a b} and {c d} for lappend x {a b} / puts {c d}, which are strings. Only the script
role is wrong.
src/checker/tcl.rs and src/checker/irules.rs both carry
and BracedWord is the script kind. Alterator::alterate lists the
same three.
Why this is not a Tcl-only edit
fnis_string(node:&Node) -> bool
is the trait signature (src/checker.rs), and impl_simple_is_string!
generates it for most of the twenty-odd languages. Deciding a Tcl braced
word's role needs the source bytes (the enclosing command's leading
word) and the ancestor chain, so honouring it means widening the
signature — either by adding an is_string_with_code sibling with a
forwarding default, the shape Getter::get_op_type_with_code and Getter::get_space_kind_with_code already use, or by widening is_string itself and updating every impl and call site.
Note the _with_code trap in .claude/rules/grammar-dispatch.md §7:
if a sibling method is added, every call site on the walk must use the _with_code spelling, or the override silently never fires.
Scope
Decide between a _with_code sibling and a signature widening, and
enumerate the call sites either way.
Cross-walk Alterator::alterate, which lists the same kinds
(grammar-dispatch §7).
Pin the answer with a bca find --type string test per dialect: a
script body must not be reported, and the lappend x {a b} literal
that is reported today must stay reported.
Summary
Checker::is_stringcalls a Tcl / iRulesbraced_worda string literalwhatever role it plays, so
bca find --type stringreports aprocbody, an
ifbody and an iRuleswhenhandler as string literals.#1318 built the predicate that settles this — a braced word is a value
when the command it is passed to takes a value, and a script otherwise
— but it could not apply it here, because
Checker::is_stringtakesneither
codenorancestors.Evidence
At the pinned grammars, after #1318:
That is a
procbody — the block whose commands the walk descends into— reported as a string literal. The literal half is already right: after
#1318 the same command reports
{a b}and{c d}forlappend x {a b}/puts {c d}, which are strings. Only the scriptrole is wrong.
src/checker/tcl.rsandsrc/checker/irules.rsboth carryand
BracedWordis the script kind.Alterator::alteratelists thesame three.
Why this is not a Tcl-only edit
is the trait signature (
src/checker.rs), andimpl_simple_is_string!generates it for most of the twenty-odd languages. Deciding a Tcl braced
word's role needs the source bytes (the enclosing command's leading
word) and the ancestor chain, so honouring it means widening the
signature — either by adding an
is_string_with_codesibling with aforwarding default, the shape
Getter::get_op_type_with_codeandGetter::get_space_kind_with_codealready use, or by wideningis_stringitself and updating every impl and call site.Note the
_with_codetrap in.claude/rules/grammar-dispatch.md§7:if a sibling method is added, every call site on the walk must use the
_with_codespelling, or the override silently never fires.Scope
_with_codesibling and a signature widening, andenumerate the call sites either way.
BracedWordthrough the fix(getter): Tcl/iRules braced literals still fabricate a block outside special-cased commands #1318 role predicate(
Getter::is_value_braced_word), which currently lives onGetterand would need to be reachable from
Checkeror hoisted.Alterator::alterate, which lists the same kinds(grammar-dispatch §7).
bca find --type stringtest per dialect: ascript body must not be reported, and the
lappend x {a b}literalthat is reported today must stay reported.
Related
get_op_typearm insrc/getter/tcl.rscarries a pointer to this issue.