var b = true;
pub fn main() void {
var x: []const []const u8 = &.{"foo"}; // okay
_ = &x;
var y = if (b) x else &.{"foo"}; // error: PTR fails
_ = &y;
}
i don’t remember what PTR stands for, but I think it’s fine for the type inference to fail here. if you give the if expression a result type (by annotating the type of y), the code compiles, so Zig not being smarter about type coercion is A-okay with me in this instance.
pear type revolution
latest proposal about peer type resolution: https://codeberg.org/ziglang/zig/issues/35197