[port #1055] internal/literals: preserve constant string expression semantics - #7
Open
luantak wants to merge 2 commits into
Open
[port #1055] internal/literals: preserve constant string expression semantics#7luantak wants to merge 2 commits into
luantak wants to merge 2 commits into
Conversation
luantak: don't invent a custom nodeParents map — find parents via the astutil cursor walk; make exit conditions clear. Also comment the exact failures covered in literals.txtar. Co-authored-by: Paul <luantak@pm.me>
cursor
Bot
force-pushed
the
cursor/maremagnum-pr-1055-literals-constant-selection-2676
branch
from
August 11, 2026 21:05
7dab957 to
89e48e2
Compare
luantak
marked this pull request as ready for review
August 12, 2026 00:09
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.
Validity: valid
Correctness fix: rewriting strings under folded constant expressions can break array lengths / keyed indexes, and can leave dead decoders. Selecting only the largest eligible string (and only suppressing children when the parent itself is in range) is the right semantics for
-literals.Upstream
burrowers#1055
Commit layout
Commit 1 is Maremagnum's from burrowers#1055 (author preserved as on the upstream commit:
autoprofiler <autoprofiler@local.invalid>); following commit(s) address luantak/mvdan review feedback and are authored by the Cursor/luantak port side.07eb04f autoprofiler | internal/literals: preserve constant string expression semantics89e48e2 Cursor Agent | Address review feedback: walk parents via astutil.Apply ancestryWhat this ports
Feedback applied (luantak requested changes)
nodeParentsmap — parents are walked from theastutil.Applycursor ancestry with clear exit conditions (non-expression ancestor; constant non-string parent; eligible parent string).literals.txtarfor the exact things that broke before (constant-context array lengths/keyed indexes; oversize concat suppressing an eligible child).Testing
go test -short ./internal/literals/✅go test -run 'TestScript/literals$' .✅Remaining risks
literals.txtarcases.Notes for Paul
Ready for your inspection. Not merged.