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.
2.9 KiB
0122 — whole-program passes resolve/diagnose under a stale ambient source
RESOLVED (2026-06-11, same session — found and fixed during the std.sx-as-pure-re-exports restructure, Agra-directed). Three whole-program passes ran under whatever
current_source_filethe previous pipeline phase happened to leave behind, instead of pinning the context per declaration:
ErrorAnalysis.convergeClosureShapeSets(error_analysis.zig) — resolves closure-literal param/return annotations; a stale context made example-declared nominal types (Point,Color) fail the E4 visibility gate withtype 'X' is not visibleattributed to nonsense std.sx spans. Fixed: pinsetCurrentSourceFileperfn_ast_mapentry frombody.source_file(already stamped by resolveImports).ErrorFlow.checkErrorFlow(error_flow.zig) — the flow walk resolves types viainferExprTypeAND emits its reject diagnostics; both used the ambient file. Fixed: pin per decl.- The
UnknownTypeCheckerunknown-type loop (semantic_diagnostics.zig) — emitted with the ambient file (checkBindingNamesbeside it already saved/restored per node). Fixed: pindiagnostics.current_source_fileper decl.Latent on master for all three — the ambient just happened to be the main file with the old single-file std.sx; the restructured std.sx (namespace part-file imports) reordered the pipeline's last-touched module and exposed them. Pinned coverage: examples 0129 / 1047 / 1049 / 1052 / 1053 / 1056 (closure shapes with nominal types, error-flow reject attribution) fail without the fixes once std.sx is the re-export facade. Gates: zig build test 426/426, suite 588/588.
Symptom
With a std.sx whose first declarations are namespace imports, programs
using closures with user-struct parameter types failed
type 'Point' is not visible; #import the module that declares it
attributed to meaningless std.sx spans, and error-flow / unknown-type
diagnostics for main-file code rendered against std.sx's line table
(e.g. expected examples/foo.sx:22:21, got std.sx:16:25).
Reproduction
Against the pre-fix compiler with the re-export std.sx:
#import "modules/std.sx";
Point :: struct { x, y: i32; }
main :: () {
f := closure((p: Point) -> Point => Point.{ x = p.x + 1, y = p.y });
r := f(Point.{ x = 1, y = 2 });
out("done\n");
}
Investigation prompt
(Resolved — kept for the record.) The root pattern: any pass that runs
after module scanning and either resolves source-gated names or emits
diagnostics MUST pin the visibility/rendering context per declaration
(setCurrentSourceFile(decl.source_file) — syncs the lowering context
and the diagnostics renderer), never inherit the ambient. Fn bodies
carry body.source_file (stamped by resolveImports) for fn-keyed
walks. When auditing for siblings, check every lowerRoot phase that
walks fn_ast_map or the program decl list.