const T = struct { a: i32, b: i32 };
var t: ?*const T = &.{ .a = 0, .b = 0 };
t = &.{ .a = 1, .b = 1 };
I don't get completions for a and b, and can't go to their definitions.
I sort-of tried to poke at it myself, and so far managed to get resolution working (can go to definition of a and b) and completions for line 2, but not line 3 and not in function arguments with an arg type of ?*const T.
I simply tried to resolve optional unwrap when resolving address_of operator.
--- a/src/analysis.zig
+++ b/src/analysis.zig
@@ -6728,24 +6728,29 @@ pub fn resolveExpressionTypeFromAncestors(
.address_of => {
std.debug.assert(node == tree.nodeData(ancestors[0]).node);
const expr_ty = try analyser.resolveExpressionType(
handle,
ancestors[0],
ancestors[1..],
) orelse return null;
if (try analyser.resolveDerefType(expr_ty)) |ty| {
return ty;
}
+ if (try analyser.resolveOptionalUnwrap(expr_ty)) |ty| {
+ if (try analyser.resolveDerefType(ty)) |tty| {
+ return tty;
+ }
+ }
I don't get completions for
aandb, and can't go to their definitions.I sort-of tried to poke at it myself, and so far managed to get resolution working (can go to definition of
aandb) and completions for line 2, but not line 3 and not in function arguments with an arg type of?*const T.I simply tried to resolve optional unwrap when resolving address_of operator.