Files
sx/tests/expected/192-pack-non-conform.txt
agra fc4d239fdd lang 2.4: enforce protocol-pack conformance per position
Each argument bound to a `..xs: P` pack must conform to P — previously the
constraint was decorative (any type was accepted). `lowerPackFnCall` now
captures the pack param's constraint protocol and checks each pack arg via a
new `packArgConformsTo`, which accepts: a plain-protocol impl
(`protocol_thunk_map`), any parameterised impl `P(<args>) for T` (scan of
`param_impl_map` for a `P\x00…\x00mangle(T)` key — the per-element type-args
are inferred from the impl, not written out), or an arg already erased to P's
own protocol struct. Non-conformers get a per-position error pointing at the
argument. Only enforced for a known protocol constraint.

Regression: examples/192-pack-non-conform.sx (a struct lacking `impl Show` in a
`..xs: Show` pack → diagnostic, exit 1).
2026-05-29 18:01:48 +03:00

6 lines
256 B
Plaintext

error: pack argument of type 'Naked' does not conform to protocol 'Show'
--> /Users/agra/projects/sx/examples/192-pack-non-conform.sx:22:30
|
22 | print("{}\n", howmany(a, n)); // `n` does not conform to Show
| ^