Skip to content

#3073: positions in the compiler are isize; the len() casts that fed them go - #3097

Merged
ehartford merged 1 commit into
mainfrom
i3073
Nov 8, 2026
Merged

ehartford merged 1 commit into
mainfrom
i3073

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Closes #3073.

A declaration sweep driven by D183's lint. Every .len() as i32 in src/ was stripped (758 sites), and the lint named the declaration each narrowing flowed into: an i32 parameter, variable or field that holds a length, a mark or an index into a list widens to isize (D108, D114) and its casts fall away; one that is stored into an i32 table (the AST, type and MIR arrays, comptime values), passed to the C bridge, or returned as a table id keeps its width, and the cast returns at the value's binding, where it is the real narrowing.

About a hundred parameters, six variables and seven fields widened; with check src/main.w is clean. The census's len-cast count falls 784 → 617; what remains is the table floor, where the cast says what it means. Method and tools are described on #3073.

No behavior change intended: a widened parameter accepts what it did (an i32 widens into isize implicitly) and every narrowing left is a cast that was there before. Gate running; battery next.

…them go

A declaration sweep driven by D183's lint. Every `.len() as i32` in src/ was
stripped (758 sites), and the lint named the declaration each narrowing
flowed into: an `i32` parameter, variable or field that holds a length, a
mark or an index into a list widens to `isize` (D108, D114) and its casts
fall away; one that is stored into an i32 table (the AST, type and MIR
arrays, comptime values), passed to the C bridge, or returned as a table id
keeps its width, and the cast returns at the value's binding, where it is
the real narrowing.

About a hundred parameters, six variables and seven fields widened;
`check src/main.w` is clean. The census's len-cast count falls 784 -> 617;
what remains is the table floor, where the cast says what it means.
@ehartford
ehartford marked this pull request as ready for review November 8, 2026 19:42
@ehartford

Copy link
Copy Markdown
Contributor Author

Battery GREEN on 481f5a7: with run tools/battery.w rc=0, wall 486 s, status green. Gate green (526 s).

@ehartford
ehartford merged commit c534f3c into main Nov 8, 2026
@ehartford
ehartford deleted the i3073 branch November 8, 2026 19:42
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.

The pinned seed predates D183: len() into an i32 parameter still needs as i32 in src/ (807 sites); goes with the next seed

1 participant