aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-08-12 12:00:42 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-08-12 12:00:42 -0400
commit1ba549a5efd458c62439dc7b5d400b3f5f823b26 (patch)
treea025c042a42c0e3ae5bd6e1e875b769804847ccb /src/server
parent613c9e6d59dfcdc72dfb3fcc72e63f1ed277cbfc (diff)
Show poly struct information on types from external packages and resolve identifier poly types
Diffstat (limited to 'src/server')
-rw-r--r--src/server/analysis.odin1
-rw-r--r--src/server/collector.odin2
-rw-r--r--src/server/documentation.odin5
-rw-r--r--src/server/generics.odin5
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])