diff options
| author | LemonBoy <thatlemon@gmail.com> | 2019-09-13 09:29:35 +0200 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-09-24 01:09:26 -0400 |
| commit | 5fb7af26abbdf8f23007c2ccb4114e40ca0f450d (patch) | |
| tree | b77b5723938032486e01cb5f833a452a29b1d6c6 /src | |
| parent | 93367adaa770944a13a8d44628dfefe1abe91906 (diff) | |
| download | zig-5fb7af26abbdf8f23007c2ccb4114e40ca0f450d.tar.gz zig-5fb7af26abbdf8f23007c2ccb4114e40ca0f450d.zip | |
Fix result loc unwrapping with optional in error union
Fixes #2899
Diffstat (limited to 'src')
| -rw-r--r-- | src/ir.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index 4e6752a0fa..b3906d8b61 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -15496,7 +15496,8 @@ static IrInstruction *ir_resolve_result(IrAnalyze *ira, IrInstruction *suspend_s IrInstruction *unwrapped_err_ptr = ir_analyze_unwrap_error_payload(ira, suspend_source_instr, result_loc, false, true); ZigType *actual_payload_type = actual_elem_type->data.error_union.payload_type; - if (actual_payload_type->id == ZigTypeIdOptional && value_type->id != ZigTypeIdOptional) { + if (actual_payload_type->id == ZigTypeIdOptional && value_type->id != ZigTypeIdOptional && + value_type->id != ZigTypeIdNull) { return ir_analyze_unwrap_optional_payload(ira, suspend_source_instr, unwrapped_err_ptr, false, true); } else { return unwrapped_err_ptr; |
