From cceb115d109c6fc86d8f6aa9cbe19517437e1519 Mon Sep 17 00:00:00 2001 From: Brad Lewis <22850972+BradLewis@users.noreply.github.com> Date: Mon, 22 Sep 2025 21:09:41 -0400 Subject: Correct resolving basic type aliases of keywords by using the underlying ident name rather than the symbol name --- src/server/analysis.odin | 13 ++++++++----- tests/hover_test.odin | 29 +++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/src/server/analysis.odin b/src/server/analysis.odin index 1e570b4..25f85c5 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -340,19 +340,22 @@ are_symbol_basic_same_keywords :: proc(a, b: Symbol) -> bool { if are_keyword_aliases(a.name, b.name) { return true } - if a.name != b.name { + a_value, a_ok := a.value.(SymbolBasicValue) + if !a_ok { return false } - if _, ok := a.value.(SymbolBasicValue); !ok { + + b_value, b_ok := b.value.(SymbolBasicValue) + if !b_ok { return false } - if _, ok := b.value.(SymbolBasicValue); !ok { + if a_value.ident.name != b_value.ident.name { return false } - if _, ok := keyword_map[a.name]; !ok { + if _, ok := keyword_map[a_value.ident.name]; !ok { return false } - if _, ok := keyword_map[b.name]; !ok { + if _, ok := keyword_map[b_value.ident.name]; !ok { return false } diff --git a/tests/hover_test.odin b/tests/hover_test.odin index 3063d13..9d65d8c 100644 --- a/tests/hover_test.odin +++ b/tests/hover_test.odin @@ -4999,6 +4999,35 @@ ast_hover_proc_overload_generic_map :: proc(t: ^testing.T) { } test.expect_hover(t, &source, "test.clear :: proc(m: ^$T/map[$K]$V)") } + +@(test) +ast_hover_proc_overload_basic_type_alias :: proc(t: ^testing.T) { + packages := make([dynamic]test.Package, context.temp_allocator) + + append(&packages, test.Package{pkg = "my_package", source = `package my_package + Bar :: int + `}) + + source := test.Source { + main = `package test + import "my_package" + + foo_int :: proc(i: int) {} + foo_string :: proc(s: string) {} + foo :: proc { + foo_int, + foo_string, + } + + main :: proc() { + bar: my_package.Bar + f{*}oo(bar) + } + `, + packages = packages[:], + } + test.expect_hover(t, &source, "test.foo :: proc(i: int)") +} /* Waiting for odin fix -- cgit v1.2.3