From 8108406b5c7be2875502260a0168636976a7bbbc Mon Sep 17 00:00:00 2001 From: Brad Lewis <22850972+BradLewis@users.noreply.github.com> Date: Sun, 28 Sep 2025 19:57:46 -0400 Subject: Find and replace poly types for call expr --- src/server/generics.odin | 6 ++++++ tests/hover_test.odin | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/src/server/generics.odin b/src/server/generics.odin index 6f0be73..e8abdaf 100644 --- a/src/server/generics.odin +++ b/src/server/generics.odin @@ -463,6 +463,12 @@ find_and_replace_poly_type :: proc(expr: ^ast.Expr, poly_map: ^map[string]^ast.E v.pos.file = expr.pos.file v.end.file = expr.end.file } + case ^ast.Call_Expr: + for &arg in v.args { + if expr, ok := get_poly_map(arg, poly_map); ok { + arg = expr + } + } } return visitor diff --git a/tests/hover_test.odin b/tests/hover_test.odin index d0b844e..f2ff18c 100644 --- a/tests/hover_test.odin +++ b/tests/hover_test.odin @@ -5112,6 +5112,29 @@ ast_hover_matrix_index_twice :: proc(t: ^testing.T) { } test.expect_hover(t, &source, "test.b: f32") } + +@(test) +ast_hover_parapoly_proc_slice_param_return :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + + Iter :: struct(T: typeid) { + slice: []T, + index: int, + } + + make_iter :: proc(slice: []$T) -> Iter(T) { + return { slice, 0 } + } + + main :: proc() { + slice := []string{} + i{*}t := make_iter(slice) + } + `, + } + test.expect_hover(t, &source, "test.it: test.Iter(string)") +} /* Waiting for odin fix -- cgit v1.2.3