From dd4ff896dbd188762bcadede367552544d08a860 Mon Sep 17 00:00:00 2001 From: Brad Lewis <22850972+BradLewis@users.noreply.github.com> Date: Thu, 13 Nov 2025 15:40:23 -0500 Subject: Correctly resolve struct usings that are paren exprs --- src/server/symbol.odin | 6 +++++- tests/hover_test.odin | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/server/symbol.odin b/src/server/symbol.odin index b6239da..2869e5c 100644 --- a/src/server/symbol.odin +++ b/src/server/symbol.odin @@ -543,7 +543,11 @@ expand_usings :: proc(ast_context: ^AstContext, b: ^SymbolStructValueBuilder) { append(&b.usings, u) derived := field_expr.derived - if ptr, ok := field_expr.derived.(^ast.Pointer_Type); ok { + if param, ok := derived.(^ast.Paren_Expr); ok { + derived = param.expr.derived + } + + if ptr, ok := derived.(^ast.Pointer_Type); ok { (ptr.elem != nil) or_continue derived = ptr.elem.derived } diff --git a/tests/hover_test.odin b/tests/hover_test.odin index 6ecfbd9..a24f448 100644 --- a/tests/hover_test.odin +++ b/tests/hover_test.odin @@ -5612,6 +5612,22 @@ ast_hover_local_proc_docs :: proc(t: ^testing.T) { } test.expect_hover(t, &source, "test.foo :: proc()\n foo doc") } + +@(test) +ast_hover_struct_using_with_parentheses :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + Foo :: struct { + using bar: (struct { a: int }), + } + main :: proc() { + foo: Foo + foo.a{*} + } + `, + } + test.expect_hover(t, &source, "Foo.a: int") +} /* Waiting for odin fix -- cgit v1.2.3