aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2026-02-08 12:31:44 +1100
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2026-02-08 12:31:44 +1100
commit187e8033a37207cb38db9453d8e17299227716e7 (patch)
tree9968a468f0db1ac1cb364b3cf7c8165524adf04d
parent8f0f0f62358f321d3612a45ae8c6600fc17db4b9 (diff)
Fix parapoly union types being overridden incorrectly
-rw-r--r--src/server/generics.odin2
-rw-r--r--tests/hover_test.odin21
2 files changed, 22 insertions, 1 deletions
diff --git a/src/server/generics.odin b/src/server/generics.odin
index 8aa111f..82f71c1 100644
--- a/src/server/generics.odin
+++ b/src/server/generics.odin
@@ -894,7 +894,7 @@ resolve_poly_union :: proc(ast_context: ^AstContext, poly_params: ^ast.Field_Lis
for arg, i in call_expr.args {
if ident, ok := arg.derived.(^ast.Ident); ok {
if expr, ok := poly_map[ident.name]; ok {
- symbol_value.types[i] = expr
+ call_expr.args[i] = expr
}
}
}
diff --git a/tests/hover_test.odin b/tests/hover_test.odin
index 02cde4e..df65f3a 100644
--- a/tests/hover_test.odin
+++ b/tests/hover_test.odin
@@ -6034,6 +6034,27 @@ ast_hover_constant_unary_expr :: proc(t: ^testing.T) {
}
test.expect_hover(t, &source, "test.FOO :: ~u32(0)")
}
+
+@(test)
+ast_hover_union_multiple_poly :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ Foo :: struct($T: typeid) {}
+ Bar :: struct{}
+
+ Bazz :: union($T: typeid) {
+ Foo(T),
+ Bar,
+ }
+
+ main :: proc() {
+ T :: distinct int
+ bazz: Ba{*}zz(T)
+ }
+ `,
+ }
+ test.expect_hover(t, &source, "test.Bazz :: union(T) {\n\tFoo(T),\n\tBar,\n}")
+}
/*
Waiting for odin fix