From c95e8dff960840599d1cf87f330a5fa2cbfa99b1 Mon Sep 17 00:00:00 2001 From: Brad Lewis <22850972+BradLewis@users.noreply.github.com> Date: Fri, 6 Feb 2026 16:21:12 +1100 Subject: Fix hover info for constant unary exprs --- src/server/ast.odin | 2 +- tests/hover_test.odin | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/server/ast.odin b/src/server/ast.odin index 07f2169..b872e11 100644 --- a/src/server/ast.odin +++ b/src/server/ast.odin @@ -376,7 +376,7 @@ merge_attributes :: proc(attrs: []^ast.Attribute, foreign_attrs: []^ast.Attribut // a const variable declaration, so we do a quick check here to distinguish the cases. is_variable_declaration :: proc(expr: ^ast.Expr) -> bool { #partial switch v in expr.derived { - case ^ast.Comp_Lit, ^ast.Basic_Lit, ^ast.Type_Cast, ^ast.Call_Expr, ^ast.Binary_Expr: + case ^ast.Comp_Lit, ^ast.Basic_Lit, ^ast.Type_Cast, ^ast.Call_Expr, ^ast.Binary_Expr, ^ast.Unary_Expr: return true case: return false diff --git a/tests/hover_test.odin b/tests/hover_test.odin index 630f4d7..02cde4e 100644 --- a/tests/hover_test.odin +++ b/tests/hover_test.odin @@ -6024,6 +6024,16 @@ ast_hover_proc_poly_params_where_clause :: proc(t: ^testing.T) { } test.expect_hover(t, &source, "test.$T: int") } + +@(test) +ast_hover_constant_unary_expr :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + F{*}OO :: ~u32(0) + `, + } + test.expect_hover(t, &source, "test.FOO :: ~u32(0)") +} /* Waiting for odin fix -- cgit v1.2.3