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:
1
tests/expected/178-any-to-string-optional.exit
Normal file
1
tests/expected/178-any-to-string-optional.exit
Normal file
@@ -0,0 +1 @@
|
||||
0
|
||||
2
tests/expected/178-any-to-string-optional.txt
Normal file
2
tests/expected/178-any-to-string-optional.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
S{a: 42, b: hi, c: true}
|
||||
S{a: null, b: null, c: null}
|
||||
Reference in New Issue
Block a user