Repository navigation
[AUTOMATED] fix(cli): resolve every name/type assertion against the output it was shown - #789
Merged
Merged
Conversation
mahaloz
force-pushed
the
fix/assert-two-local-names
branch
2 times, most recently
from
October 1, 2026 19:38
97030d3 to
035c518
Compare
…utput it was shown Two `--assert name` directives on two different register locals, each accepted alone, rejected the second with `No symbol named:` in either order: mapping the first local's Symbol cleared the analysis, which emptied the HighVariables the next directive looks its identifier up in. The pass is now left intact (both surfaces rebuild the IR from the scope for the second pass anyway), and the Funcdata records every Symbol a batch renamed, retyped or created, keyed by the identifier the pass printed. An identifier first means the variable printed under it, so directives on different locals no longer depend on their order and `name a b` + `name b a` is a swap instead of a silent no-op; failing that it means the variable an earlier directive gave that name. The console `rename`/`retype` commands and the in-process plane share one resolver. Fixes #784 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017cAUeUBnQ9xRA9oRJNGWjw
…ster in one batch Giving two register locals that share a register at different widths (`char *s // rax`, `uint4 v1 // eax`) a Symbol each made the second pass fold them into one variable (`s._0_4_ = 0`). The later directive is now rejected and names the one it lost to, which also lets the scope container check go back to its original form. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017cAUeUBnQ9xRA9oRJNGWjw
…enamed away and given away Two holes in the batch rules: - `name v2 tmp`, `name v1 v2`, `type v2 ...`: the printed reading of `v2` picked the local already renamed to `tmp`, silently. When the variable printed under an identifier was renamed away earlier in the batch and an earlier directive gave that identifier to another local, the directive is now rejected naming both. - The vN allocator ignored name-locked Symbols, so after `name v1 v3` + `name v3 v1` an untouched local also took `v1` and the printer pushed the caller's `v1` to `v1_1`. Every default now skips a name a name-locked local Symbol holds; with no such Symbol the numbering is unchanged (byte-identical over 2,336 corpus functions). calleenamedlocals' s4 relied on that collision: it now renames both slots to `w` for the collision coverage, and asserts that `rename v2 v1` alone leaves the caller's `v1` on the slot it named (#18, #19; stages baseline re-recorded, two keys added). The console rename/retype commands get the current function through one helper instead of a discarded read_symbol. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017cAUeUBnQ9xRA9oRJNGWjw
… another local After `name v5 v4`, a later `type v4 int` or `name v4 x` named two locals: the one printed as v4 and the one just renamed to v4. The printed one was picked silently, where main had applied the directive to the renamed one. Both readings now reject as ambiguous, naming both locals. A `name` whose new name the pass also printed still takes the printed reading, so swaps and rotations keep working. Adds a stack+register pair to the batch fixture, and a DWARF fixture showing that a source local or parameter named `v1` keeps its name now that default numbering skips name-locked Symbols. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Ps66ZCFPLywq9AKHBuDXNU
`name v1 v2` then `name v2 v2` named both locals `v2` through the swap exemption; it is now rejected as ambiguous like any other reuse. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Ps66ZCFPLywq9AKHBuDXNU
mahaloz
force-pushed
the
fix/assert-two-local-names
branch
from
October 1, 2026 21:18
9f8f7cf to
dc60805
Compare
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.
The problem
Two
--assert namedirectives on two different register locals each work alone, but in one run the second is rejected withNo symbol named:, and reversing them reverses which one fails. A swap (name a b+name b a) was worse: both came backappliedand nothing changed.The fix
name a b+name b aswaps. An identifier that output does not contain may name what an earlier directive renamed a local to (name v1 rcthentype rc unsigned int).name v5 v4thentype v4 intgivesAmbiguous name: v4 is both the local printed as v4 and the local printed as v5 (now v4). The exception is anamewhose new name was also printed, as in a swap or rotation; it renames the local printed under the identifier.vNdefault for an untouched local now skips any name a name-locked Symbol holds. Before, aftername v1 v3+name v3 v1an untouched third local also tookv1and the printer pushed the caller'sv1tov1_1.rename/retypecommands and the in-process (--json) path share one resolver.char *s // rax,uint4 v1 // eax) cannot both get a symbol: the second pass folds them into one variable (s._0_4_ = 0). The later directive is rejected and names the earlier one.Behaviour changes beyond the fix:
name v5 v4, main applied a latertype v4 intorname v4 xto the local just renamedv4(unless both were stack slots, where it rejected it); that batch is now rejected.name v1 v2+name v2 v3, withv3also printed, renames the local printed asv2, where main renamed the first local twice.name v2 credbufthentype v2 char[8]now retypescredbufinstead of being rejected.v1) is a name-locked Symbol too, so it keeps its name and the defaults skip it. Main printeduint1 v1; uint8 v1_1;for bash'ssize_t v1; now it isuint8 v1;. This renames locals in 5 of 3,107 bash O0 functions (names only);lsandsortat O2 andsdiffat O0 are byte-identical.calleenamedlocalsstage'srename v2 v1no longer collides (the caller'sv1stays on the slot it named); its collision coverage now renames both slots tow.The tests
kuna-cli/tests/local_name_batch.rson a new fixture (localnamebatch_x86_64, source beside it): the reported pair in both orders, three renames, stack, register and mixed pairs, swaps and a rotation among three locals, rename-then-retype, and the width, ambiguity and overlap rejections, each run through the text and--jsonsurfaces. Everything except the stack-pair control fails on main. A DWARF fixture (dwarfvnames_x86_64, C source beside it) checks that a sourcev1keeps its name.tests/cli/two-register-local-names-in-one-batch.json: the reported case; fails on main.calleenamedlocalsAnalysis-tier: MIPS16 ISA_MODE decode-mode painting #18/Analysis-tier: cross-arch _start→main idiom (AArch64/ARM/RISC-V) #19 (stages baseline re-recorded, two keys added) fail on main.Fixes #784
🤖 Generated with Claude Code
https://claude.ai/code/session_01Ps66ZCFPLywq9AKHBuDXNU