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:
agra
2026-06-08 15:22:10 +03:00
parent 382f78f49b
commit cb9ef381b5
13 changed files with 203 additions and 31 deletions

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1,5 @@
reflection=8
array=16
typeval_eq=true
match=111
dep=24

View File

@@ -0,0 +1 @@
1

View File

@@ -0,0 +1,5 @@
error: type 'Make' is ambiguous: it is declared in multiple flat-imported modules; qualify the reference or remove the duplicate import
--> examples/0769-modules-ambiguous-type-fn-head.sx:19:32
|
19 | print("size={}\n", size_of(Make(s64)));
| ^^^^

View File

@@ -0,0 +1 @@