Skip to content

test(tools): ask for K0604 when an assignment's right empties the array - #263

Open
siracozmen01 wants to merge 1 commit into
mainfrom
shrink-row
Open

siracozmen01 wants to merge 1 commit into
mainfrom
shrink-row

Conversation

@siracozmen01

Copy link
Copy Markdown
Contributor

Problem

#257 writes a run inside one of a run at two running indexes. The value on the right of = is worked out before the place is written, so it can empty the array the place is in. Nothing held that case. bs[0].ss[i].xs[j] = emptied(bs), where emptied clears bs, is refused with K0604 "index 0 is outside an array of length 0" (a K0505 before #257). The reviewer of #257 asked for it as a row.

Change

tools/check-commands.sh: one RUNNING row beside #257's two, with struct S { tag: i32; xs: [i32; 3] }, struct B { a: i64; ss: [S; 2] }, i = 1 and j = 2, expecting index 0 is outside an array of length 0.

Verification

  • sh tools/check-commands.sh $(find examples lib -name '*.kest' | sort) passes against a build of main: 218 wordings of 107 refusals seen.
  • The program run alone says the same K0604 at line 21, column 5 under both kest and kest-debug.

Closes #262

…he array

A right-hand side is worked out before the place it is written to, so it can empty the array that place is in. Nothing held that case for a run inside one of a run; it is refused with K0604 at the index, and now a row of check-commands.sh asks for it beside #257's.

Closes #262
@siracozmen01 siracozmen01 changed the title test(tools): ask for K0604 where the right of an assignment empties the array test(tools): ask for K0604 when an assignment's right empties the array Nov 8, 2026

This branch has not been deployed

No deployments
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.

Nothing asks for K0604 when the right of an assignment empties the array it writes into

1 participant