lang 2.4: protocol-interface method calls on pack elements + conformance fix

Calling a protocol method on a pack element now works: `xs[i].greet()` on a
`..xs: Greeter` pack dispatches to the concrete element's impl, and elements
may be heterogeneous (Dog, Cat). This is the protocol-interface access the
pack is for. (Protocol method decls omit the implicit `self`; impls list it —
the earlier malformed `(self: *Self)` decls were why dispatch looked broken.)

Also fixes packArgConformsTo for non-parameterised protocols: it queried
`protocol_thunk_map`, which is only populated lazily when a protocol VALUE is
built with `xx`, so it false-negatived valid conformers. Now it queries
impl-declaration state directly — `param_impl_map` for parameterised protocols,
or `<ty>.<method>` entries in `fn_ast_map` for non-parameterised ones.

examples/193-protocol-pack-methods.sx (heterogeneous Dog+Cat pack, per-element
greet(), order-independent).
This commit is contained in:
agra
2026-05-29 18:53:32 +03:00
parent fc4d239fdd
commit a67627a691
4 changed files with 65 additions and 13 deletions

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1,3 @@
dog+cat=903
cat+dog=903
dog+dog=7