aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-26 19:17:56 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-26 19:17:56 -0400
commit8dee06afd7c1883e57b2ffc88473a403d39d4a6f (patch)
tree693eb9a5f776f1a837bb81c82850446dc15cd650
parentb9a91fe83b5a908d508f3d958ec65648ede989e5 (diff)
Correctly resolve enum value_decl
-rw-r--r--src/server/analysis.odin6
-rw-r--r--tests/hover_test.odin17
2 files changed, 23 insertions, 0 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin
index 91fa2c1..6cbc14d 100644
--- a/src/server/analysis.odin
+++ b/src/server/analysis.odin
@@ -2283,6 +2283,12 @@ resolve_implicit_selector :: proc(
}
}
+ if position_context.value_decl != nil {
+ if symbol, ok := resolve_type_expression(ast_context, position_context.value_decl.type); ok {
+ return symbol, ok
+ }
+ }
+
return {}, false
}
diff --git a/tests/hover_test.odin b/tests/hover_test.odin
index ece2c1d..783d484 100644
--- a/tests/hover_test.odin
+++ b/tests/hover_test.odin
@@ -3025,6 +3025,23 @@ ast_hover_builtin_clamp_from_proc:: proc(t: ^testing.T) {
}
test.expect_hover(t, &source, "test.m: f64")
}
+
+@(test)
+ast_hover_enum_explicit_type :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ Foo :: enum {
+ A,
+ B,
+ }
+
+ main :: proc() {
+ foo: Foo = .A{*}
+ }
+ `,
+ }
+ test.expect_hover(t, &source, "test.Foo: .A")
+}
/*
Waiting for odin fix