resolveForwardIdentifierAliases now resolves a forward alias A :: B against B AS SEEN FROM A's own source via selectNominalLeaf (E1's source-keyed nominal leaf over type_aliases_by_source / moduleTypeAuthor), never the global type_alias_map / global findByName. The already-resolved guard is per-source (aliasResolvedInSource). .pending routes back into the fixpoint; .undeclared / .not_visible leave A unwritten (no global last-wins leak). This is the sequencing pin before E2: a global fixpoint binds A to a same-name B authored by a different module (e.g. a namespaced import that pollutes the global alias map last-wins), re-opening 0105 one layer down once shadows register. Writes stay on the unified putTypeAlias helper (E1 no-drift invariant); the single graph-walk in resolver.zig is untouched. Regression: examples/0750-modules-forward-alias-source-aware — a forward alias A :: B with main's own B :: u64 and a namespaced same-name B :: u8; A must bind main's u64 (300), not the global last-wins u8 (44).
11 lines
430 B
Plaintext
11 lines
430 B
Plaintext
// Namespaced helper module. It authors a top-level type alias `B` whose
|
|
// spelling collides with the importer's own `B`. Because the import is
|
|
// NAMESPACED (`ns :: #import`), `dep.B` is NOT flat-visible to the importer —
|
|
// but its alias write still lands in the global `type_alias_map` (last-wins),
|
|
// which is exactly what the source-aware forward-alias fixpoint must ignore.
|
|
B :: u8;
|
|
|
|
width :: () -> s32 {
|
|
return 8;
|
|
}
|