Surface rename of the signed integer family: s1..s64 become i1..i64
(u1..u64, usize, isize unchanged). 'string' keeps the s-prefix arm in
name classification; width parsing moves to the i-prefix arm next to
isize.
Internal TypeId tags follow the surface (.s8/.s16/.s32/.s64 ->
.i8/.i16/.i32/.i64), as do mono-key mangle fragments (ptr_i64,
tu_i64_bool) and all display/diagnostic formatting (i{d}).
Migrated in the same sweep: stdlib + examples + issue repros + FFI C
companions (shared symbol names like ffi_id_i64), expected
stdout/stderr/ir snapshots, specs.md, readme.md, CLAUDE.md/AGENTS.md,
implementation_plan.md, docs/, issue writeups. Vendored stb_image and
historical flow state left untouched.
zig build test: 426/426; examples suite: 595/595.
30 lines
1.3 KiB
Plaintext
30 lines
1.3 KiB
Plaintext
// An array dimension accepts any compile-time numeric constant whose value is a
|
|
// positive INTEGRAL number — an integral float (`4.0`) folds to its integer just
|
|
// like `4`. A float-typed const (`N : f64 : 4.0`), an untyped-float const
|
|
// (`M :: 4.0`), and a direct float literal (`[4.0]i64`) all lay out the same
|
|
// `[4]i64` as the integer spelling, so element store/read is in bounds.
|
|
//
|
|
// Regression (issue 0083 / F0.4 attempt 8, Agra ruling): an integral float used
|
|
// as a dimension was wrongly rejected "must be a compile-time integer constant".
|
|
// The shared const-int evaluator now folds an integral float literal (and a
|
|
// float-typed module const) via `program_index.floatToIntExact`; a non-integral
|
|
// float (`4.5`) is still rejected (see 1132).
|
|
#import "modules/std.sx";
|
|
|
|
N : f64 : 4.0; // float-typed const
|
|
M :: 4.0; // untyped float const
|
|
|
|
main :: () {
|
|
a : [N]i64 = ---; // dim from a float-typed const
|
|
a[0] = 10; a[3] = 40;
|
|
print("a len={} a0={} a3={}\n", a.len, a[0], a[3]);
|
|
|
|
b : [M]i64 = ---; // dim from an untyped float const
|
|
b[1] = 21;
|
|
print("b len={} b1={}\n", b.len, b[1]);
|
|
|
|
c : [4.0]i64 = ---; // direct integral-float-literal dim
|
|
c[2] = 32;
|
|
print("c len={} c2={}\n", c.len, c[2]);
|
|
}
|