Describe the bug
Chaining multiple .? (optional field select) operations does not work correctly. Each .? in the chain wraps the result in an additional Optional, producing Optional(Optional(Optional(...))) instead of a flat Optional.
For example:
a.?b.?c.?d.orValue("default")
fails at runtime, while the equivalent [?] index syntax works fine:
a[?"b"][?"c"][?"d"].orValue("default")
cel-go seems to handle this correctly: The Go reference implementation unwraps an optional operand before applying qualifiers: https://github.com/google/cel-go/blob/master/interpreter/attributes.go#L1298
To Reproduce
Check which components this affects:
Sample expression and input that reproduces the issue:
a.?b.?c.?d.orValue("default")
Expected behavior
A clear and concise description of what you expected to happen.
a.?b.?c.?d.orValue("default") should behave the same way as a[?"b"][?"c"][?"d"].orValue("default"), not throw.
Describe the bug
Chaining multiple .? (optional field select) operations does not work correctly. Each .? in the chain wraps the result in an additional Optional, producing Optional(Optional(Optional(...))) instead of a flat Optional.
For example:
fails at runtime, while the equivalent [?] index syntax works fine:
cel-go seems to handle this correctly: The Go reference implementation unwraps an optional operand before applying qualifiers: https://github.com/google/cel-go/blob/master/interpreter/attributes.go#L1298
To Reproduce
Check which components this affects:
Sample expression and input that reproduces the issue:
Expected behavior
A clear and concise description of what you expected to happen.
a.?b.?c.?d.orValue("default")should behave the same way asa[?"b"][?"c"][?"d"].orValue("default"), not throw.