zls icon indicating copy to clipboard operation
zls copied to clipboard

Peer type resolution: `S` and `??S` should produce `??S`

Open FnControlOption opened this issue 8 months ago • 0 comments

For example:

const std = @import("std");

const S = struct { i: i32 };

pub fn main() void {
    var runtime_bool: bool = true;
    _ = &runtime_bool;

    const foo: S = .{ .i = 1 };
    const bar: ??S = null;
    const baz = if (runtime_bool) foo else bar;
    std.debug.print("{}\n", .{@TypeOf(baz)}); // => ??S
}

Extracted from #2258

Initial implementation attempt: 18fda3a

FnControlOption avatar Apr 22 '25 04:04 FnControlOption