Files
sx/examples/diagnostics/1162-diagnostics-const-write-rejected.sx
agra 66bdc70bf1 test: group examples into per-category folders
Move examples/*.sx and their expected/ snapshots into per-category
subfolders (examples/<category>/...). Folder = leading filename token,
with ffi-objc/ffi-jni kept whole; filenames are unchanged. The corpus
runner and LSP sweep now discover each category's expected/ dir, while
issues/ stays flat. Example 1058's repo-root-relative companion import
is made file-relative. Path strings embedded in 164 snapshots were
regenerated (path-only changes). Test-layout docs in CLAUDE.md updated.
2026-06-21 14:41:34 +03:00

20 lines
592 B
Plaintext

// Writes through a module constant are compile errors — for every target
// chain rooted at a const: a struct const's field (this used to compile
// and BUS-ERROR at runtime — issue 0116), an array const's element,
// a compound assignment, and a bare scalar const. A local that shadows
// the const name stays writable (see 0177/0178 for the value semantics).
#import "modules/std.sx";
Color :: struct { r, g, b: i64; }
WHITE :: Color.{ r = 255, g = 255, b = 255 };
K : [4]i64 : .[11, 22, 33, 44];
N : i64 : 4;
main :: () {
WHITE.r = 0;
K[0] = 5;
K[1] += 2;
N = 9;
}