// A BARE generic struct head used as a STATIC-METHOD-CALL target // (`Box(i64).make(7)`) must instantiate — and call the method of — the template // authored by the single bare-VISIBLE author, NOT the global last-wins // `struct_template_map` (and its name-keyed `Box.make`), which a NON-visible // 2-flat-hop same-name template can win. // // `b.sx` declares a one-field `Box($T)` (size 8) with its own `make`, and itself // flat-imports `c.sx`, which declares a two-field `Box($T)` (size 16) with its // own `make`. This file flat-imports ONLY `b.sx`, so `b.Box` is one flat hop away // (visible) and `c.Box` is two hops away (NOT bare-visible, mirrors // 0764/0774/0706). The static-method head `Box(i64).make(7)` must select `b.Box` // (size 8) for BOTH the instantiated type layout and the method body. // // Regression (Phase E4 finding #1, static-method site): before the static-method // head consulted the source-keyed visible author, `size_of(Box(i64))` correctly // picked the visible `b.Box` (8) but `Box(i64).make(7)` instantiated the global // last-wins `c.Box` and ran `c.Box.make`, returning a 16-byte value. Fail-before // printed `size=8 xtype=16 x=7`. #import "modules/std.sx"; #import "0776-modules-bare-generic-static-method-visible-author/b.sx"; main :: () -> i32 { x := Box(i64).make(7); print("size={} xtype={} x={}\n", size_of(Box(i64)), size_of(type_of(x)), x.x); 0 }