From 2661d6f23fb419998d64fa968a885884146792cb Mon Sep 17 00:00:00 2001 From: Brad Lewis <22850972+BradLewis@users.noreply.github.com> Date: Mon, 17 Nov 2025 05:45:45 -0500 Subject: Add missing unary expr operands --- src/server/analysis.odin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/server/analysis.odin') diff --git a/src/server/analysis.odin b/src/server/analysis.odin index c9a6275..5cd42e3 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -1226,7 +1226,7 @@ internal_resolve_type_expression :: proc(ast_context: ^AstContext, node: ^ast.Ex ok := internal_resolve_type_expression(ast_context, v.expr, out) if v.op.kind == .And { out.pointers += 1 - } else if v.op.kind == .Sub || v.op.kind == .Add { + } else if v.op.kind == .Sub || v.op.kind == .Add || v.op.kind == .Not || v.op.kind == .Xor { if value, ok := out.value.(SymbolProcedureValue); ok { if len(value.return_types) > 0 { type := value.return_types[0].type -- cgit v1.2.3 From 2c192f7b69b89d4d7dc3367fe5a736c858643129 Mon Sep 17 00:00:00 2001 From: Brad Lewis <22850972+BradLewis@users.noreply.github.com> Date: Mon, 17 Nov 2025 05:56:21 -0500 Subject: Fix hover type for proc calls wrapped in parens --- src/server/analysis.odin | 13 ++++++++++++- tests/hover_test.odin | 14 ++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) (limited to 'src/server/analysis.odin') diff --git a/src/server/analysis.odin b/src/server/analysis.odin index 5cd42e3..723ec85 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -1244,7 +1244,18 @@ internal_resolve_type_expression :: proc(ast_context: ^AstContext, node: ^ast.Ex out.pointers -= 1 return ok case ^Paren_Expr: - return internal_resolve_type_expression(ast_context, v.expr, out) + ok = internal_resolve_type_expression(ast_context, v.expr, out) + if value, ok := out.value.(SymbolProcedureValue); ok { + if len(value.return_types) > 0 { + type := value.return_types[0].type + if type == nil { + type = value.return_types[0].default_value + } + ok = internal_resolve_type_expression(ast_context, type, out) + return ok + } + } + return ok case ^Slice_Expr: out^, ok = resolve_slice_expression(ast_context, v, v.expr) return ok diff --git a/tests/hover_test.odin b/tests/hover_test.odin index ea27cc8..282ffb7 100644 --- a/tests/hover_test.odin +++ b/tests/hover_test.odin @@ -5689,6 +5689,20 @@ ast_hover_negate_function_call :: proc(t: ^testing.T) { } test.expect_hover(t, &source, "test.bar: bool") } + +@(test) +ast_hover_function_call_with_parens :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + foo :: proc() -> bool {} + + main :: proc() { + b{*}ar := (foo()) + } + `, + } + test.expect_hover(t, &source, "test.bar: bool") +} /* Waiting for odin fix -- cgit v1.2.3