diff options
| author | Bradley Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-08-12 14:28:16 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-12 14:28:16 -0400 |
| commit | a061543c302e07ed29531289de3fd438ea98e395 (patch) | |
| tree | a025c042a42c0e3ae5bd6e1e875b769804847ccb /src | |
| parent | 8e745a69fc240a899165aedd403f8c56e59d3630 (diff) | |
| parent | 1ba549a5efd458c62439dc7b5d400b3f5f823b26 (diff) | |
Merge pull request #865 from BradLewis/fix/struct-hover-poly-info
Fix/struct hover poly info
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/analysis.odin | 1 | ||||
| -rw-r--r-- | src/server/collector.odin | 2 | ||||
| -rw-r--r-- | src/server/documentation.odin | 5 | ||||
| -rw-r--r-- | src/server/generics.odin | 5 |
4 files changed, 10 insertions, 3 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin index 8b736c3..41b2d32 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -2338,6 +2338,7 @@ resolve_symbol_return :: proc(ast_context: ^AstContext, symbol: Symbol, ok := tr for type in v.types { append(&b.types, clone_expr(type, context.temp_allocator, nil)) } + b.poly = cast(^ast.Field_List)clone_type(v.poly, context.temp_allocator, nil) resolve_poly_struct(ast_context, &b, v.poly) } diff --git a/src/server/collector.odin b/src/server/collector.odin index cc72509..4af9d7c 100644 --- a/src/server/collector.odin +++ b/src/server/collector.odin @@ -162,8 +162,8 @@ collect_struct_fields :: proc( } } + b.poly = cast(^ast.Field_List)clone_type(struct_type.poly_params, collection.allocator, &collection.unique_strings) value := to_symbol_struct_value(b) - value.poly = cast(^ast.Field_List)clone_type(struct_type.poly_params, collection.allocator, &collection.unique_strings) return value } diff --git a/src/server/documentation.odin b/src/server/documentation.odin index 6ec0e07..e68ea1a 100644 --- a/src/server/documentation.odin +++ b/src/server/documentation.odin @@ -772,7 +772,10 @@ write_symbol_type_information :: proc(sb: ^strings.Builder, ast_context: ^AstCon fmt.sbprintf(sb, "%s%s", pointer_prefix, symbol.type_name) } - if v, ok := symbol.value.(SymbolUnionValue); ok { + #partial switch v in symbol.value { + case SymbolUnionValue: + write_poly_list(sb, v.poly, v.poly_names) + case SymbolStructValue: write_poly_list(sb, v.poly, v.poly_names) } return true diff --git a/src/server/generics.odin b/src/server/generics.odin index a629d3e..7eea7a2 100644 --- a/src/server/generics.odin +++ b/src/server/generics.odin @@ -676,7 +676,10 @@ resolve_poly_struct :: proc(ast_context: ^AstContext, b: ^SymbolStructValueBuild continue } - if poly, ok := param.type.derived.(^ast.Typeid_Type); ok { + if ident, ok := param.type.derived.(^ast.Ident); ok { + poly_map[ident.name] = ast_context.call.args[i] + b.poly_names[i] = node_to_string(ast_context.call.args[i]) + } else if poly, ok := param.type.derived.(^ast.Typeid_Type); ok { if ident, ok := name.derived.(^ast.Ident); ok { poly_map[ident.name] = ast_context.call.args[i] b.poly_names[i] = node_to_string(ast_context.call.args[i]) |