xx args with a slice target now bridges a comptime pack to a runtime slice: []Any boxes each element to Any; []P xx-erases each to the protocol (reusing the slice-of-protocol erasure from 0052). New lowerPackToSlice; the unary-op arm intercepts xx <pack> before the pack-as-value diagnostic. This is the working forward to a runtime []Any/[]P helper -- log_count(xx args) -> 3 -- so the 2.7 pack-as-value diagnostics now suggest xx <name> for the call case. examples/204-pack-xx-to-slice.sx (both []Any and []P paths); 203 help text updated. issue 0053 FIXED. 239 examples + unit green.
44 lines
2.1 KiB
Plaintext
44 lines
2.1 KiB
Plaintext
error: pack 'xs' has no runtime value — a pack is comptime-only and can't be used as a value here
|
|
--> /Users/agra/projects/sx/examples/203-pack-as-value.sx:14:40
|
|
|
|
|
14 | storage :: (..xs: Show) -> void { y := xs; _ = y; } // A: store
|
|
| ^^
|
|
|
|
help: to store it, materialize a tuple: `(..xs)`
|
|
|
|
|
14 | storage :: (..xs: Show) -> void { y := xs; _ = y; } // A: store
|
|
| ^^
|
|
|
|
error: pack 'xs' has no runtime value — a pack is comptime-only and can't be used as a value here
|
|
--> /Users/agra/projects/sx/examples/203-pack-as-value.sx:15:40
|
|
|
|
|
15 | call :: (..xs: Show) -> void { sink(xs); } // B: pass to a call
|
|
| ^^
|
|
|
|
help: materialize a tuple `(..xs)` to store it, or `xx xs` to convert it to an expected `[]Any`/`[]P` slice
|
|
|
|
|
15 | call :: (..xs: Show) -> void { sink(xs); } // B: pass to a call
|
|
| ^^
|
|
|
|
error: pack 'xs' has no runtime value — a pack is comptime-only and can't be used as a value here
|
|
--> /Users/agra/projects/sx/examples/203-pack-as-value.sx:16:42
|
|
|
|
|
16 | ret :: (..xs: Show) -> s64 { return xs; } // C: return
|
|
| ^^
|
|
|
|
help: to return it, return a tuple `(..xs)` and make the return type that tuple
|
|
|
|
|
16 | ret :: (..xs: Show) -> s64 { return xs; } // C: return
|
|
| ^^
|
|
|
|
error: pack 'xs' has no runtime value — a pack is comptime-only and can't be used as a value here
|
|
--> /Users/agra/projects/sx/examples/203-pack-as-value.sx:17:39
|
|
|
|
|
17 | iter :: (..xs: Show) -> void { for xs : (x) { _ = x; } } // D: runtime iterate
|
|
| ^^
|
|
|
|
help: to iterate at comptime use `inline for 0..xs.len (i)`; for a runtime loop declare it as `..xs: []P` (a protocol slice) instead of a pack
|
|
|
|
|
17 | iter :: (..xs: Show) -> void { for xs : (x) { _ = x; } } // D: runtime iterate
|
|
| ^^
|