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.
28 lines
1.0 KiB
Plaintext
28 lines
1.0 KiB
Plaintext
// Interning a large (~64KB) array type and using `{}` formatting elsewhere must
|
|
// NOT scalarize into an O(N) SelectionDAG (which crashed `sx build` / made
|
|
// `sx run` take ~12s). The array Any-unbox formats via a SLICE VIEW of its
|
|
// storage — no whole-array load.
|
|
//
|
|
// Regression (issue 0125): `any_to_string`'s `case array:` arm used to do
|
|
// `array_to_string(cast(type) val)`, loading the whole [65536]u8 by value and
|
|
// reading each element off the loaded aggregate. Now the dispatcher builds a
|
|
// `{ptr,len}` slice view of the payload pointer and formats that — output is
|
|
// identical (`[a, b, c]`), and a large unrelated array type costs nothing.
|
|
|
|
#import "modules/std.sx";
|
|
|
|
f :: () {
|
|
buf : [65536]u8 = ---;
|
|
buf[0] = 65; // 'A'
|
|
out(string.{ ptr = @buf[0], len = 1 });
|
|
out("\n");
|
|
}
|
|
|
|
main :: () -> i32 {
|
|
f();
|
|
print("{}\n", 5); // an int format — unaffected by the big array
|
|
small : [3]i64 = .[7, 8, 9];
|
|
print("{}\n", small); // array format still renders the element list
|
|
return 0;
|
|
}
|