aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-03 16:59:11 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-03 19:48:15 -0400
commit2edc388c40b4431cdfdc3d915fe9a139768aa783 (patch)
tree4d24043b53535b882c1d72cec4bf64e4d0c3290a
parent5ff21d6abb6747f584b488a61d2048e298dbf786 (diff)
Add SymbolMapValue to selector resolve in the index case
-rw-r--r--src/server/analysis.odin7
-rw-r--r--tests/hover_test.odin17
2 files changed, 22 insertions, 2 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin
index 7170935..0a2fe1d 100644
--- a/src/server/analysis.odin
+++ b/src/server/analysis.odin
@@ -1842,8 +1842,11 @@ resolve_implicit_selector :: proc(
}
}
- if array, ok := symbol.value.(SymbolFixedArrayValue); ok {
- return resolve_type_expression(ast_context, array.len)
+ #partial switch value in symbol.value {
+ case SymbolFixedArrayValue:
+ return resolve_type_expression(ast_context, value.len)
+ case SymbolMapValue:
+ return resolve_type_expression(ast_context, value.key)
}
}
diff --git a/tests/hover_test.odin b/tests/hover_test.odin
index 18c2ced..5e6a66f 100644
--- a/tests/hover_test.odin
+++ b/tests/hover_test.odin
@@ -1961,6 +1961,23 @@ ast_hover_enum_field_definition_with_type :: proc(t: ^testing.T) {
}
test.expect_hover(t, &source, "test.Foo: .A")
}
+
+@(test)
+ast_hover_enum_map_key :: proc(t: ^testing.T) {
+ source :=test.Source {
+ main = `package test
+ Foo :: enum {
+ A = 1,
+ B,
+ }
+ main :: proc() {
+ m: map[Foo]int
+ m[.A{*}] = 2
+ }
+ `
+ }
+ test.expect_hover(t, &source, "test.Foo: .A")
+}
/*
Waiting for odin fix