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.
4.1 KiB
0077 — reserved type-name binding diagnostic skips imported modules
Status: RESOLVED.
Root cause: the reserved-name binding diagnostic (issue 0076) only ran over main-file decls (
UnknownTypeChecker.run'smain_filefilter). An imported module'si2 := …was never checked and reached lowering, where the address-of family loaded the whole aggregate and passed it by value to a*Boxparam — LLVM verifier abort.Fix: the binding check (
checkBindingNamesinsrc/ir/semantic_diagnostics.zig) now walks EVERY compiled module — no main-file filter — visiting everyvar/:=/typed-local binding name and function/lambda/struct-method parameter at any depth, and descending thenamespace_declthat amod :: #importwraps so imported-module decls are reached. The walk tracks each module'ssource_file(via the diagnostic list'scurrent_source_file, saved/restored per node) so the diagnostic renders against the imported module's text. Rejection still defers to the parser'sname_class.Type.fromNameclassifier (no drift). The unknown-type check (issue 0064) stays main-file-only. No lowering special-case; the.identifier-only address-of paths are unchanged.Stdlib audit: the only reserved-name bindings under
library/were twou1locals inlibrary/modules/ui/renderer.sx(lines 203, 382); the UV-coord locals were renamedu_min/u_max/v_min/v_max. No reserved parameter names or other reserved bindings exist inlibrary/orexamples/.Regression test:
examples/1120-diagnostics-imported-reserved-type-name.sx(+ companion1120-diagnostics-imported-reserved-type-name/mod.sx) — an imported module declaringi2 := …now emits the clean diagnostic at the import's declaration site (exit 1), not an LLVM abort.
Symptom
An imported module can still declare a parameter or var binding whose name is a
reserved/builtin type name. Observed: the imported-module repro below reaches
lowering and fails LLVM verification by passing a loaded struct value to a
*Box parameter. Expected: the same declaration-site diagnostic used for
main-file issue 0076 should reject the imported module's i2 binding before
lowering.
Reproduction
Create these two files under the repo root, then run
./zig-out/bin/sx run .sx-tmp/issue0077_main.sx.
.sx-tmp/issue0077_mod.sx:
#import "modules/std.sx";
Box :: struct { total: i64 = 0; count: i64 = 0; }
update :: (self: *Box, n: i64) {
self.total += n;
self.count += 1;
}
run_imported_reserved_name :: () -> i32 {
i2 := Box.{ total = 0, count = 0 };
update(@i2, 5);
i2.update(7);
print("imported i2 total={} count={}\n", i2.total, i2.count);
return 0;
}
.sx-tmp/issue0077_main.sx:
#import "modules/std.sx";
mod :: #import ".sx-tmp/issue0077_mod.sx";
main :: () -> i32 {
return mod.run_imported_reserved_name();
}
Current output on flow/sx-foundation/F0.1:
LLVM verification failed: Call parameter type does not match function signature!
%load = load { i64, i64 }, ptr %alloca, align 8, !dbg !461
ptr call void @update(ptr %0, { i64, i64 } %load, i64 5), !dbg !462
Investigation prompt
Investigate and fix issue 0077 in the sx compiler. The suspected area is
src/ir/semantic_diagnostics.zig, especially
UnknownTypeChecker.run and its main_file filter. Attempt 2 for issue 0076
added checkBindingName, but it only runs over main-file declarations; imported
modules are still trusted and can hit the original LLVM verifier failure. The
fix likely needs to apply reserved-type-name binding diagnostics to all user
source modules that are lowered, while preserving the existing trusted-stdlib
or library convention only where intentionally required. Also audit existing
reserved-name bindings in library/ (for example u1 := ... in
library/modules/ui/renderer.sx) and rename any source that will become
newly illegal under the corrected rule.
Verification: run the two-file repro above and expect a clean diagnostic at the
imported module's i2 := ... declaration, not LLVM verification failure. Then
run zig build, zig build test, and bash tests/run_examples.sh.