fix(stdlib/E4): own-wins at non-leaf bare-type sites + type-fn head ambiguity
attempt-6: address Adi's two in-scope findings (#3 deferred to E6). #1 E4-own-author-type-arg (silent-wrong): the bare-TYPE gate returned `.proceed` for the querying source's OWN author, so the non-leaf sites (reflection / type-arg / array-literal / type-value / match arm) dropped it and re-resolved a same-name flat import via global `findByName`. headTypeGate now resolves the own author to ITS per-source TypeId (mirroring selectNominalLeaf's own-wins, 0754); the type-as-value and type-match sites, which only consumed the poison bit and re-resolved globally, now route through the gate and use the `.resolved` author. size_of(Widget) with an own + imported Widget now yields main's own size, not the import's. #2 E4-type-fn-head-ambiguity (silent-wrong): headFnLeak only checked isNameVisible, so two flat same-name type-returning functions both reported "visible" and one was silently instantiated. It now diagnoses >=2 distinct direct flat type-fn authors (no own author) as ambiguous before the isNameVisible short-circuit, consistent with the parameterized struct / protocol heads and the leaf (0755/0767). Own / single / diamond-collapse type-fn heads still resolve. Regressions: 0768 (own-wins at every non-leaf bare-type site, fail-before reflection=16 -> pass-after 8) and 0769 (two flat Make type-fns -> ambiguity diagnostic exit 1). README: own-wins + type-fn-head ambiguity at every bare-type site.
This commit is contained in:
13
readme.md
13
readme.md
@@ -415,11 +415,14 @@ generic head) — is likewise not visible and is rejected (`type 'X' is not visi
|
||||
wherever a bare type name is named — a value/field annotation, a reflection /
|
||||
type-arg slot (`size_of(T)`, `size_of(*T)`), a typed array-literal head (`T.[…]`),
|
||||
a parameterized head (`Box(s64)`), or a type-as-value / type-match arm — not just
|
||||
plain annotations. Ambiguity is enforced at every one of those sites too, exactly
|
||||
like a bare call: a bare type that two or more flat imports each declare is
|
||||
**ambiguous and rejected** (`type 'X' is ambiguous: it is declared in multiple
|
||||
flat-imported modules; qualify the reference or remove the duplicate import`) — never
|
||||
a silent pick of one author. (A library's own *internal* type references still resolve: a generic
|
||||
plain annotations. **Own-wins** holds at every one of those sites too, exactly like
|
||||
a bare call: when the querying module declares its OWN same-name type, that bare
|
||||
reference resolves to ITS author — never a same-name flat import. Ambiguity is
|
||||
enforced at every one of those sites as well: a bare type (including a type-returning
|
||||
function head) that two or more flat imports each declare — with no own author to
|
||||
win — is **ambiguous and rejected** (`type 'X' is ambiguous: it is declared in
|
||||
multiple flat-imported modules; qualify the reference or remove the duplicate
|
||||
import`) — never a silent pick of one author. (A library's own *internal* type references still resolve: a generic
|
||||
struct / pack fn / protocol body is instantiated in the module that defines it, so
|
||||
e.g. `List(T).append`'s `alloc: Allocator` is visible there regardless of the call
|
||||
site.)
|
||||
|
||||
Reference in New Issue
Block a user