Commit a916f06
committed
fix: Handle
The `try` operator in Zig unwraps an error union. When passed to
create_unary_op, it was falling through to the default case which
returned UnaryOp::Minus, causing values to be negated.
Now `try` is handled specially to just return the operand unchanged,
which is correct behavior for the simple case where we're not
implementing full error handling semantics.
Test: `try riskyOp()` now returns 77 instead of -77try expression as pass-through instead of negation1 parent 8a9f0f8 commit a916f06
1 file changed
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1100 | 1100 | | |
1101 | 1101 | | |
1102 | 1102 | | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
1103 | 1110 | | |
1104 | 1111 | | |
1105 | 1112 | | |
| |||
0 commit comments