Skip to content

executor: scan-mode substring parse probes via the non-reporting pre-scan (Refs #3225) - #3253

Merged
caomengxuan666 merged 3 commits into
masterfrom
fix/3225-subscript-diag-dup
Nov 10, 2026
Merged

caomengxuan666 merged 3 commits into
masterfrom
fix/3225-subscript-diag-dup

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

Refs #3225

What changed

The parameter-expansion error pre-scan (a verdict-only pass layered over
the real expansion) parsed ${var:offset:length} substrings through the
REPORTING element fetch, so a bad array subscript was printed once by the
scan's NULL probe (twice, via the operator-value error fallback) and once
more by the real expansion — three reports where GNU prints one
(subst.c:9777 parameter_brace_expand fetches the parameter once; the
diagnostic itself is arrayfunc.c:1483 err_badarraysub).

  • parameter_core.rs: parse_parameter_substring gains a scan-mode twin,
    parse_parameter_substring_for_scan, whose NULL probe derives from the
    non-evaluating pre_scan_operator_value (the same discipline the
    operator arms already used). Only a provably-set parameter continues
    the full parse; unset or undecidable shapes take the NULL shortcut,
    which is verdict-equivalent for the scan's only question (the substring
    error fires only for a non-NULL value). The real expansion path is
    untouched.
  • parameter_errors.rs: the substring negative-length arm calls the scan
    twin; pre_scan_operator_value visibility widened to
    pub(in crate::executor).
  • Pins in tests/issue1555_scalar_subscript_bad_subscript_regressions.rs:
    the existing combined pattern+substring cell already expected the GNU
    count (2) and was red at 4 on the base; four new cells pin the substring
    form alone (quoted / unquoted / real-array OOB), the non-literal
    subscript substring forms plus the i++ side-effect count, the pattern
    forms staying at one report, and the verdict set staying unchanged.

Evidence (Simular box, head 41cbc14, branch base 9ec0355)

  • Head pin stem: 16 passed / 0 failed, with a per-test line for each of
    the 16 cells (box log fc3225-logs3/head-issue1555.log).
  • Base with the new pin file: 12 passed / 4 failed — the failures are
    exactly the pre-registered cells (the combined form, the substring
    form, the non-literal substring form, the verdict cell); the pattern
    cell is green on both sides.
  • Neighbour stems: issue1600 10/10, issue2343 5/5, issue2794 7/7,
    issue3024 23/23, issue3063 22/22, issue755 11/11, issue772 6/6,
    parameter_transform_tests 18/18 (see the note below).
  • Lib: head 1207 passed / 0 failed; base 1207 passed / 0 failed —
    failure name sets identical (empty on both sides).
  • cargo fmt --check: clean. Marker-literals lint: clean.
  • -D warnings: the lib and this PR's pin target check clean. A full
    --all-targets check stops at one error that pre-dates this change —
    a dead helper at tests/issue2634_extdebug_bash_argc_sticky.rs:46,
    reproduced identically on the base tree (test-hygiene face, unrelated
    to this diff).

Note on parameter_transform_tests: run in a bare worktree whose target
dir lives outside the tree, all 18 cells fail at their output redirect
(target/...-output.txt: No such file or directory) before any
semantics run; with the in-tree target dir present the stem passes
18/18 on the head. Recorded here so that red is not misread later.

Merge note

The branch base (9ec0355) pre-dates PR #3164 (landed as beab07d),
which touched the same two executor files in different functions;
expect a small same-file conflict surface at update-branch time.

本 PR 删除了什么

Nothing. No code or tests are removed: one probe call in the scan arm
is replaced by its scan-mode twin, one visibility is widened, and four
pin cells are added.

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