Files
sx/examples/0765-modules-import-reflection-type-non-transitive.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

// `#import` is non-transitive for a type named in a REFLECTION / type-arg slot
// (`size_of(T)`, `size_of(*T)`) and in a TYPED ARRAY-LITERAL annotation
// (`T.[...]`), exactly like a bare leaf annotation (0763), a parameterized head
// (0764), and values/functions (0706): when A imports B and B imports C, A must
// NOT see C's top-level types here either. This file imports `b.sx` (which
// imports `c.sx`) and references C's `Nums` / `COnly` in those positions — each
// is rejected with a "type ... is not visible; #import the module that declares
// it" diagnostic, BEFORE the global type table can resolve it.
//
// `b.sx` ↔ `c.sx` together still compile: `b_sizes` / `b_arr` resolve `Nums` /
// `COnly` because b.sx directly imports c.sx (one flat hop there, two from a
// file that imports b.sx).
//
// Regression (Phase E4): before the bare-TYPE gate reached the reflection
// type-arg and array-literal leaf sites, these 2-flat-hop references leaked
// through the global `type_alias_map` / `findByName` / `type_bridge` lookup.
#import "modules/std.sx";
#import "0765-modules-import-reflection-type-non-transitive/b.sx";
main :: () -> i32 {
print("{}\n", size_of(Nums));
print("{}\n", size_of(*COnly));
xs := Nums.[1, 2];
print("{} {}\n", xs[0], xs[1]);
0
}