Open IntegratedQuantum opened 2 months ago
Some alpha state code
Maybe someone will come up with a neat way to type match declarations and definitions?
Examples given in the original ziglang proposal were
test {
const s: ?**const S = try .getGlobal();
_ = s;
}
const S = struct {
x: usize,
var g: *const S = &.{ .x = 1 };
fn getGlobal() anyerror!?**const S {
return &g;
}
};
and
const S = struct {
const init: anyerror!anyerror!????S = .{};
};
test {
const s: ????S = try try .init;
_ = s;
}
(doubt it's practicality, but apparently it passes)
This is a fairly new addition to the language (https://github.com/ziglang/zig/pull/21264) and it would be nice if zls would autocomplete these, and show some more information (like function parameters and doc comments) when hovering over a decl literal.