lang: qualified namespace members in value position + alias carry
Two coupled capabilities on the road to the std restructure (current/PLAN-STDLIB.md, issue 0114): 1. alias.Type.method() / alias.Type as a call head, alias.CONST, and alias.Enum.variant now resolve — previously only alias.fn() and type-position alias.Type worked. objectIsValue treats an alias-rooted field_access as a type head; the call path strips the alias to the existing Type.method machinery; lowerFieldAccess resolves alias.CONST pinned to the target module and alias.Enum.x as a typed enum literal; resolveTypeWithBindings resolves qualified type_exprs pinned to the target. 2. The carry rule: namespaceAliasTarget resolves an alias from the file's own edges first, then from DIRECT flat imports (one level), diagnosing two distinct carried targets as ambiguous. All qualified shapes work through a carried alias — the std.sx namespace tail (mem.GPA.init() etc.) is now expressible. Regression: examples/0831-modules-namespace-alias-carry.sx (direct + carried, all seven shapes).
This commit is contained in:
@@ -503,6 +503,9 @@ pub const CallResolver = struct {
|
||||
const obj_name: []const u8 = switch (obj.data) {
|
||||
.identifier => |id| id.name,
|
||||
.type_expr => |te| te.name,
|
||||
// `alias.Type` (namespace-rooted prefix) is a type head, not a
|
||||
// value — `mem.GPA.init()` must take the namespace-call path.
|
||||
.field_access => return self.l.namespaceRootedMember(obj) == null,
|
||||
else => return true,
|
||||
};
|
||||
if (self.l.scope) |scope| {
|
||||
|
||||
Reference in New Issue
Block a user