Files
sx/examples/0211-generics-struct-alias-head-rich.sx
agra f2db8ecc53 lang: generic struct head aliases bind the template (fix 0120) — alias-follow from each author's source in head selection; loud unknown-type on the .call type tail
BoxAlias :: Box; / Box :: r.Box; now resolve instantiation, methods,
annotations, and chains through the aliased template, and re-export one
flat-import level as ordinary own decls (the facade shape the std.sx
restructure needs). selectGenericStructHead consults aliasedStructTemplate
(nominal.zig) before the global template map — own-wins/single-flat alias
author, each hop pinned to the alias author's source, ns.X RHS through
namespaceAliasVerdictFrom, depth-capped. resolveTypeCallWithBindings'
silent .unresolved tail (panicked in LLVM emission) now diagnoses
"unknown type". Also aligns the stale pre-existing calls.test.zig UFCS
plan test with the opt-in model (a47ea14). Regression: examples/0211
(+rich/+facade). Gates: zig build test 426/426, suite 587/587.
2026-06-11 18:09:01 +03:00

16 lines
361 B
Plaintext

// Companion of 0211: the authoring module — a plain fn, a plain struct,
// and a generic struct, all re-exported by -facade.sx via alias decls.
#import "modules/std.sx";
helper :: () -> s64 { 7 }
Thing :: struct {
v: s64;
init :: () -> Thing { Thing.{ v = 42 } }
}
Box :: struct ($T: Type) {
item: T;
get :: (b: *Box(T)) -> T { b.item }
}