Files
sx/examples/0834-modules-namespace-alias-own-target-pin.sx
agra fbbfcb268c fix(0114): gate alias-qualified calls to one-level carry, pin to target
The lowerCall namespace branch routed alias.fn() through the global
qualified registration (first-wins) at any import depth, and through the
global last-wins bare map for comptime/generic members. Plain-identifier
alias roots now resolve via the carry-aware namespaceAliasVerdict:

- visible alias (own edge or ONE flat hop): the member dispatches the
  TARGET module's own fn (namespaceFnMember + fd-keyed bareAuthorFuncId),
  so two modules' same-named aliases each call their own target.
- two direct flat imports carrying the alias to distinct targets:
  loud ambiguity diagnostic.
- alias only reachable beyond one hop: "namespace 'X' is not visible".
- foreign / builtin / #compiler members keep the literal-symbol path.

Regressions: examples 0832 (two-hop), 0833 (carried collision),
0834 (own-target pin / first-wins repair).
2026-06-11 09:16:03 +03:00

16 lines
644 B
Plaintext

// Two modules each declare their OWN alias `t` to different targets, and the
// targets export the SAME member name `f`. Each module's `t.f()` dispatches
// its OWN target's `f` — a.sx gets x.sx's (1), b.sx gets y.sx's (2). The
// caller here never uses `t` itself, so no ambiguity arises.
//
// Regression (issue 0114): the global qualified-fn map registered `t.f`
// first-wins, so both modules used to call whichever registered first.
#import "modules/std.sx";
#import "0834-modules-namespace-alias-own-target-pin/a.sx";
#import "0834-modules-namespace-alias-own-target-pin/b.sx";
main :: () {
print("{} {}\n", use_a(), use_b());
}