kpumuk commented on PR #3414:
URL: https://github.com/apache/thrift/pull/3414#issuecomment-4343695384
Not fixed completely. Passed checks:
- Nested forward typedef union now compiles and reads the boxed value.
- Plain typedef alias to union does not get spuriously boxed.
- Optional regular struct field with an unknown union variant becomes `None`.
- Required regular struct field propagates `UnknownUnionVariant`.
- Multi-unknown-field union returns `InvalidData`.
- Empty union returns `EmptyUnion`.
Still failing:
- RPC result wrapper still swallows `UnknownUnionVariant`.
Generated code for `SvcGetResult` still has:
```rust
match Response::read_from_in_protocol(i_prot) {
Ok(val) => { f_0 = Some(val); },
Err(thrift::Error::Protocol(ref e)) if e.kind ==
ProtocolErrorKind::UnknownUnionVariant => {
},
Err(e) => return Err(e),
}
```
So `SvcGetResult::read_from_in_protocol()` returns:
```text
Ok(SvcGetResult { result_value: None })
```
Then `ok_or()` would still report:
```text
ApplicationErrorKind::MissingResult
```
Root cause: `suppress_unknown` is based only on field optionality. RPC
result success fields are generated as optional, so result wrappers still take
the suppression path.
This should be limited to optional `T_REGULAR` fields, not all optional
fields.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]