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.
19 lines
631 B
Plaintext
19 lines
631 B
Plaintext
// A struct constant with a NON-serializable initializer field (a call, a
|
|
// runtime read) keeps INLINE RE-LOWERING semantics: the initializer is
|
|
// evaluated AT EACH USE. This is the documented contract for this class
|
|
// — `CALL.r` may differ between reads and side effects run per use.
|
|
// For evaluate-once semantics use `NAME :: #run f();`.
|
|
|
|
#import "modules/std.sx";
|
|
|
|
Color :: struct { r, g, b: i64; }
|
|
counter : i64 = 0;
|
|
bump :: () -> i64 { counter += 1; counter }
|
|
CALL :: Color.{ r = bump(), g = 0, b = 0 };
|
|
|
|
main :: () {
|
|
print("use1={}\n", CALL.r);
|
|
print("use2={}\n", CALL.r);
|
|
print("counter={}\n", counter);
|
|
}
|