From cf2df338177dd14f1e77006ec419f2805b54138b Mon Sep 17 00:00:00 2001 From: Sirac Ozmen Date: Sun, 8 Nov 2026 16:05:45 +0300 Subject: [PATCH] test(tools): ask for K0604 where the right of an assignment empties the 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 --- tools/check-commands.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/check-commands.sh b/tools/check-commands.sh index 9272cc12..bb543df6 100755 --- a/tools/check-commands.sh +++ b/tools/check-commands.sh @@ -5047,6 +5047,7 @@ K0604|run|struct S {\n tag: i32\n xs: [i32; 4]\n}\n\nfn main() -> i32 {\n K0604|run|struct S {\n tag: i32\n xs: [i32; 4]\n}\n\nfn main() -> i32 {\n let ss: [S; 2] = [S(1, [1, 2, 3, 4]), S(2, [5, 6, 7, 8])]\n let i = 0\n let j = 4\n ss[i].xs[j] = 9\n return ss[1].tag\n}|index 4 is outside 4 of them K0604|run|struct S {\n tag: i32\n xs: [i32; 3]\n}\n\nstruct B {\n a: i64\n ss: [S; 2]\n}\n\nfn main() -> i32 {\n let bs: [B] = array()\n push(bs, B(1, [S(1, [1, 2, 3]), S(2, [4, 5, 6])]))\n let i = 2\n let j = 0\n bs[0].ss[i].xs[j] = 9\n return 0\n}|index 2 is outside 2 of them K0604|run|struct S {\n tag: i32\n xs: [i32; 3]\n}\n\nstruct B {\n a: i64\n ss: [S; 2]\n}\n\nfn main() -> i32 {\n let bs: [B] = array()\n push(bs, B(1, [S(1, [1, 2, 3]), S(2, [4, 5, 6])]))\n let i = 0\n let j = 3\n bs[0].ss[i].xs[j] += 9\n return bs[0].ss[1].tag\n}|index 3 is outside 3 of them +K0604|run|struct S {\n tag: i32\n xs: [i32; 3]\n}\n\nstruct B {\n a: i64\n ss: [S; 2]\n}\n\nfn emptied(bs: [B]) -> i32 {\n clear(bs)\n return 9\n}\n\nfn main() -> i32 {\n let bs: [B] = array()\n push(bs, B(1, [S(1, [1, 2, 3]), S(2, [4, 5, 6])]))\n let i = 1\n let j = 2\n bs[0].ss[i].xs[j] = emptied(bs)\n return 0\n}|index 0 is outside an array of length 0 K0604|run|fn main() -> i32 {\n let a: [i32] = array()\n let i = 5\n return a[i]\n}|index 5 is outside an array of length 0 K0604|run|fn main() -> i32 {\n let i = 9\n return i32("ab"[i])\n}|index 9 is outside text of 2 bytes K0619|tick 2|fn onEvent(e: text) -> i32 {\n return 0\n}\n\nfn main() -> i32 {\n return 0\n}|`onEvent` takes `text`, and tick has `i32` to give it