fix(stdlib/E4): bare generic head selects visible author; qualified missing-member diagnoses

E4 non-transitive type rule had two generic-head author-selection holes:

#1 A BARE generic struct head / alias with a single bare-VISIBLE author still
   instantiated a NON-visible 2-flat-hop same-name template, because the
   `.unregistered` gate arm fell through to the global last-wins
   `struct_template_map` winner. Add `bareVisibleStructTemplate`: after the
   visibility gate passes, select the source-keyed template authored by the
   single bare-visible author (own-wins, else the one 1-hop flat author) and
   instantiate THAT instead of the global map's last-wins entry. Null (→ the
   global map, byte-identical) when the visible author IS the canonical one
   (the common single-author case) or the picture isn't a clean single author.
   Applied at every bare generic-struct head/alias site (annotation `.call` /
   `.parameterized_type_expr`, alias-registration `.call` /
   `.parameterized_type_expr`, array-literal head).

#2 A QUALIFIED head `a.Box(..)` whose namespace `a` authors no member `Box`
   silently fell back to the bare global template, instantiating an unrelated
   module's `Box`. Add `qualifiedMemberMissing`: a qualified head whose known
   namespace lacks the member now emits "namespace 'a' has no member 'Box'" and
   poisons with `.unresolved`; a qualified head NEVER reaches the bare global map.

Regressions: 0774 (bare head + bare alias, 2-hop same-name → size=8 alias=8,
fail-before 16 16); 0775 (qualified missing member → diagnostic + exit 1,
fail-before size=16 exit 0).
This commit is contained in:
agra
2026-06-08 18:39:53 +03:00
parent 8c59acbd25
commit 246883073c
13 changed files with 238 additions and 15 deletions

View File

@@ -0,0 +1 @@
size=8 alias=8 x=1 a=2

View File

@@ -0,0 +1,5 @@
error: namespace 'a' has no member 'Box'
--> examples/0775-modules-qualified-generic-missing-member.sx:20:9
|
20 | x : a.Box(s64) = .{ x = 1, y = 2 };
| ^^^^^^^^^^