zls icon indicating copy to clipboard operation
zls copied to clipboard

No type inference when orelse RHS is a block

Open Vexu opened this issue 1 year ago • 1 comments

Zig Version

0.14.0-dev.564+75cf7fca9

Zig Language Server Version

dfe958e4d1a9ba503cfafd39164f090daea70109

Client / Code Editor / Extensions

vscode

Steps to Reproduce and Observed Behavior

test {
    var s: ?u32 = undefined;
    var a = s orelse {
        return;
    };
    var b = s orelse return;
    var c = s.?;
    _ = .{ &s, &a, &b, &c };
}

Expected Behavior

a, b, and c should all be inferred to be u32s but a is not.

Relevant log output

No response

Vexu avatar Aug 05 '24 09:08 Vexu

The issue should now be resolved after merging my MR.

7phs avatar Nov 17 '24 11:11 7phs

fixed by #2084

Techatrix avatar Apr 29 '25 16:04 Techatrix