Skip to content

Bare for statements: 2 loops recovered, and 235 of the 240 sites I cited were out of scope #2591

Description

@gHashTag

Third of the three optional-parenthesis defects, after while (#2588) and if (#2589). parse_for_stmt carried the same mandatory expect(TokenKind::LParen).

Not a copy of the other two

The iterable list terminates on ), which the bare form never produces. It ends at the capture payload |x| or at the body {, so both become terminators and the closing paren becomes conditional.

Two earlier attempts broke the build by editing the loop condition in place from a truncated terminal reading of it. This replaced the whole block against its exact text, read programmatically rather than through sed.

The scope I cited was wrong

I justified the work as "240 sites, the largest known". Measured by dialect:

bare `for` in Rust-dialect specs: 235 in 28 files
bare `for` in pure t27 specs:       5 in  3 files

235 of 240 are in files the emitter cannot fix anyway (#2398). The real population inside the measured corpus is five.

Third time this session a site count misled me about an error count, after Trit at 36 specs / 8 errors (#2578) and the behavior DSL at 2991 lines / 1 error (#2582). The lesson was written down twice before this.

Measured, with a control

                     HEAD (no fix)   with fix
file/schema.t27           0             1
github/e2e_full_flow      0             0
interop/gf_cross_lang     0             1

valid:                  204           204
total errors:           670           670
spec parse gate:        111 events, ratchet holds

Two loops recovered that were being discarded. Zero on both counters.

The control matters: without measuring HEAD I could not have distinguished "the fix works" from "these loops always emitted". Reverting, rebuilding, measuring and restoring cost two builds and is the only reason the claim is defensible.

Why it lands despite measuring zero

#2573 set the standard that a change with no measured effect and no demonstrated need should not land, and reverted one of mine on it. This clears that bar differently: the effect is demonstrated, it is just not an error-count effect. Two loops that vanished now reach the output, the same shape as the 161 methods in #2584.

e2e_full_flow.t27 still emits none of its three — a further blocker behind this one, unexamined.

Boundary

  • specs/github/tests/e2e_full_flow.t27

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions