diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-09-06 10:37:18 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-09-06 10:37:52 -0400 |
| commit | 932350baa98fc3a040a714d974ec0654794acef4 (patch) | |
| tree | 44d9bbf1c80981eadf5a1adac578857bf43a8e85 /src | |
| parent | 52d1144a1110bb54de9d9a52646e96f584fe6d78 (diff) | |
Store the identifier rather than the specialization for poly types when the types match
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/generics.odin | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/server/generics.odin b/src/server/generics.odin index 33543cf..cec9926 100644 --- a/src/server/generics.odin +++ b/src/server/generics.odin @@ -61,7 +61,20 @@ resolve_poly :: proc( return true } else if type != nil { if ident, ok := unwrap_ident(type); ok { - save_poly_map(ident, specialization, poly_map) + call_node_id := reflect.union_variant_typeid(call_node.derived) + specialization_id := reflect.union_variant_typeid(specialization.derived) + if call_node_id == specialization_id { + // if the specialization type matches the type of the parameter passed to the proc + // we store that rather than the specialization so we can follow it correctly + // for things like `textDocument/typeDefinition` + save_poly_map( + ident, + make_ident_ast(ast_context, call_node.pos, call_node.end, call_symbol.name), + poly_map, + ) + } else { + save_poly_map(ident, specialization, poly_map) + } } } |