lang: slice-of-protocol variadic ..xs: []P erases each arg to the protocol
packVariadicCallArgs stored the raw concrete arg into a [N x P] array when the
element type was a protocol, so an 8-byte struct landed in a 16-byte {ctx,
vtable} slot -> garbage vtable -> Bus error on dispatch. Now, when the slice
element type is a protocol, each arg is xx-erased to the protocol value via
buildProtocolErasure (same impl-driven machinery as the xx cast). This makes
..xs: []P the runtime, protocol-erased counterpart to the comptime
heterogeneous pack ..xs: P (which stays comptime-only): xs[runtime_i].method()
now works in an ordinary loop.
specs.md: full variadic/pack form-comparison table (concrete-vs-erased,
comptime-vs-runtime). Regression: examples/202. Issue 0052 (FIXED). 237 green.
This commit is contained in:
1
tests/expected/202-slice-of-protocol-variadic.exit
Normal file
1
tests/expected/202-slice-of-protocol-variadic.exit
Normal file
@@ -0,0 +1 @@
|
||||
0
|
||||
3
tests/expected/202-slice-of-protocol-variadic.txt
Normal file
3
tests/expected/202-slice-of-protocol-variadic.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
[0]=A
|
||||
[1]=B
|
||||
[2]=A
|
||||
Reference in New Issue
Block a user