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.
This commit is contained in:
@@ -1186,8 +1186,16 @@ pub const Lowering = struct {
|
||||
/// edges of flat edges do not chain). Two distinct carried targets for
|
||||
/// the same alias are ambiguous.
|
||||
pub fn namespaceAliasVerdict(self: *Lowering, alias: []const u8) AliasVerdict {
|
||||
const edges = self.program_index.namespace_edges orelse return .none;
|
||||
const from = self.current_source_file orelse return .none;
|
||||
return self.namespaceAliasVerdictFrom(alias, from);
|
||||
}
|
||||
|
||||
/// `namespaceAliasVerdict` with an explicit querying source — for callers
|
||||
/// resolving an alias on behalf of ANOTHER module (e.g. following a const
|
||||
/// alias decl whose RHS is `ns.X`: `ns` binds in the alias author's file,
|
||||
/// not the use site's).
|
||||
pub fn namespaceAliasVerdictFrom(self: *Lowering, alias: []const u8, from: []const u8) AliasVerdict {
|
||||
const edges = self.program_index.namespace_edges orelse return .none;
|
||||
if (edges.getPtr(from)) |own| {
|
||||
if (own.get(alias)) |t| return .{ .target = t };
|
||||
}
|
||||
@@ -1679,6 +1687,7 @@ pub const Lowering = struct {
|
||||
pub const rawNamedTypePtr = lower_nominal.rawNamedTypePtr;
|
||||
pub const buildGenericStructTemplate = lower_nominal.buildGenericStructTemplate;
|
||||
pub const qualifiedStructTemplate = lower_nominal.qualifiedStructTemplate;
|
||||
pub const aliasedStructTemplate = lower_nominal.aliasedStructTemplate;
|
||||
pub const qualifiedMemberMissing = lower_nominal.qualifiedMemberMissing;
|
||||
pub const bareVisibleStructDecl = lower_nominal.bareVisibleStructDecl;
|
||||
pub const bareVisibleStructTemplate = lower_nominal.bareVisibleStructTemplate;
|
||||
|
||||
Reference in New Issue
Block a user