ffi any_to_string optional dispatch — expected-failing lock-in

`examples/178-any-to-string-optional.sx` prints a struct whose
three fields are `?s64` / `?string` / `?bool`, in both Some and
None form. The struct-print path goes through `field_value(s, i)
-> Any` and then `any_to_string(Any)`. Today: `any_to_string`
has no `case optional:` arm and `resolveTypeCategoryTags` has no
"optional" category — every optional field falls through to the
`<?>` default. Expected output captures the working post-fix
form (`a: 42`, `b: hi`, `c: true` for Some; `null` across the
board for None).

The next commit adds `optional_to_string` + `case optional:` to
std and "optional" to `resolveTypeCategoryTags`. Variadic
auto-unwrap (`packVariadicCallArgs`) keeps printing direct
`print(opt)` calls correctly today; this fix closes the gap for
struct fields, slice elements, and anywhere else an optional
flows through Any.
This commit is contained in:
agra
2026-05-28 07:50:59 +03:00
parent 432da229a7
commit 54e404bca1
3 changed files with 34 additions and 0 deletions

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1,2 @@
S{a: 42, b: hi, c: true}
S{a: null, b: null, c: null}