Files
sx/examples/0707-modules-import-dir-scan-order.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

30 lines
1.2 KiB
Plaintext

// Regression test for issue-0039 — directory-import scan order.
//
// When a directory is imported, the resolver iterates files
// alphabetically. Inside the directory, `aaa_uses.sx` comes BEFORE
// `types.sx` but its `make_my` returns `MyEnum` (defined in
// `types.sx`). The combined directory module must put `aaa_uses.sx`'s
// transitive imports (which include `MyEnum`) into the global scan
// stream BEFORE `aaa_uses.sx`'s own decls so the tagged_union for
// MyEnum is registered before `make_my`'s return type is resolved.
//
// Pre-fix, the dir-import implementation appended each file's
// `own_decls` before its `decls`, which inverted that order and
// caused `MyEnum` to be registered as a placeholder struct via the
// `resolveTypeName` fallback. The later `enum_decl` scan then
// short-circuited via `findByName` and never upgraded the placeholder
// to the real tagged_union, surfacing as "cannot infer enum type
// for '.b'" at the `return .b(42)` site.
#import "modules/std.sx";
#import "0707-modules-import-dir-scan-order";
main :: () -> i32 {
e := make_my();
if e == {
case .a: { print("a\n"); }
case .b: (v) { print("b={}\n", v); }
}
0
}