Files
sx/examples/1137-diagnostics-value-param-type-fn-no-cascade.sx
agra d8076b9333 lang: rename signed integer types sN -> iN
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.
2026-06-12 09:31:53 +03:00

28 lines
1.3 KiB
Plaintext

// A FAILED value-param bind on a type-RETURNING FUNCTION must emit exactly its
// own diagnostic and NOT cascade a bogus `field '…' not found on '<fn>'` when the
// binding is later field-accessed. The type-fn binder must poison the binding to
// `.unresolved` (the diagnosed-poison sentinel) — exactly like the struct binder —
// so the downstream `.len` is suppressed, not reported as a second error.
//
// Regression (issue 0083): the type-fn path (`instantiateTypeFunction`) fell
// through to an empty-struct placeholder named after the function on a failed
// value-param bind, so `a.len` produced a second `field 'len' not found on
// 'MakeC'` error. The struct binder already returned `.unresolved` here; the
// type-fn binder now matches it. Three failure modes, three clean diagnostics,
// zero field cascades:
// - value-param overflow via an aliased integer constraint (`$K: Count`),
// - a non-const value-param arg (`get()`),
// - an unknown TYPE arg (`NoSuchType`) — must still report the unknown type.
#import "modules/std.sx";
Count :: u32;
MakeC :: ($K: Count, $T: Type) -> Type { return [K]T; }
get :: () -> u32 { return 4; }
main :: () {
a : MakeC(5000000000, i64) = ---;
b : MakeC(get(), i64) = ---;
c : MakeC(3, NoSuchType) = ---;
print("unreachable {} {} {}\n", a.len, b.len, c.len);
}