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.
33 lines
1.4 KiB
Plaintext
33 lines
1.4 KiB
Plaintext
// A type-RETURNING function with a value parameter (`$K: u32`) used as a TYPE
|
|
// annotation: `b : Make(N, i64)` where `Make :: ($K, $T) -> Type { return [K]T; }`.
|
|
// A named-const value arg (`Make(N, i64)`), a const-expression value arg
|
|
// (`Make(M + 1, i64)`), and the literal form (`Make(3, i64)`) all instantiate to
|
|
// the SAME type — the array copy `b : Make(3, i64) = a` type-checks only because
|
|
// the three spellings name one `[3]i64`.
|
|
//
|
|
// Regression (issue 0083 / F0.4 attempt 6): the unknown-type checker walked the
|
|
// value-param position as a type name ("unknown type 'N'"), and the
|
|
// parameterized-type-annotation path never routed to `instantiateTypeFunction`,
|
|
// nor did that binder resolve a non-struct/union return shape (`return [K]T`).
|
|
// The value arg now folds through the shared const-int evaluator and the type
|
|
// function resolves its general return-type expression with bindings active.
|
|
#import "modules/std.sx";
|
|
|
|
N :: 3;
|
|
M :: 2;
|
|
|
|
Make :: ($K: u32, $T: Type) -> Type { return [K]T; }
|
|
|
|
main :: () {
|
|
a : Make(N, i64) = ---; // named-const value param
|
|
a[0] = 10; a[1] = 20; a[2] = 30;
|
|
print("named: len={} a0={} a2={}\n", a.len, a[0], a[2]);
|
|
|
|
e : Make(M + 1, i64) = ---; // const-expr value param (M + 1 == 3)
|
|
e[0] = 1; e[2] = 9;
|
|
print("expr: len={} e2={}\n", e.len, e[2]);
|
|
|
|
b : Make(3, i64) = a; // same instantiation → array copy type-checks
|
|
print("copy: len={} b2={}\n", b.len, b[2]);
|
|
}
|