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.2 KiB
Plaintext
30 lines
1.2 KiB
Plaintext
// A generic struct's VALUE param (`$N: u32`) is a compile-time integer, not a
|
|
// type. Naming it in a TYPE position — here a field type `x: N` — must emit a
|
|
// clean diagnostic, NOT silently compile.
|
|
//
|
|
// The parser marks any reference to a struct's own type param `is_generic`
|
|
// (so `x: T` for a real `$T: Type` resolves without a `$`). That marking is
|
|
// the same for a value param, so the unknown-type walk used to skip `x: N`
|
|
// entirely; the field's type leaf then resolved to the `.unresolved` sentinel
|
|
// and PANICKED at LLVM emission ("unresolved type reached LLVM emission").
|
|
//
|
|
// The checker now distinguishes TYPE params (`$T: Type`, `$T: SomeProtocol`,
|
|
// the `..$Ts` pack) from VALUE params (`$N: u32`) using the binder's own rule:
|
|
// a value param named in a type position gets the tailored hint. A value param
|
|
// in a VALUE position (a `[N]u8` array dimension, a `Vector` lane count) still
|
|
// works (see 0147 / 0201).
|
|
//
|
|
// Expected: `error: 'N' is a value parameter, not a type`; exit 1.
|
|
// Regression (stdlib E3).
|
|
#import "modules/std.sx";
|
|
|
|
Bad :: struct($N: u32) {
|
|
x: N;
|
|
}
|
|
|
|
main :: () -> i32 {
|
|
b : Bad(3) = .{ x = 1 };
|
|
print("{}\n", b.x);
|
|
return 0;
|
|
}
|