diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-09-16 15:14:40 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-09-16 15:19:54 -0400 |
| commit | f3223ddbaeed978da5de5d70667f146637b07293 (patch) | |
| tree | c6ca53edaf12148ad8e4ca63be8d7eee984c52a6 /src/server | |
| parent | fc61cb706555c41d8b5afe1cf2bc93d343d960e4 (diff) | |
Correctly resolve generic variadic args
Diffstat (limited to 'src/server')
| -rw-r--r-- | src/server/generics.odin | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/server/generics.odin b/src/server/generics.odin index cec9926..984cb8e 100644 --- a/src/server/generics.odin +++ b/src/server/generics.odin @@ -207,6 +207,26 @@ resolve_poly :: proc( return found } + case ^ast.Ellipsis: + if call_array, ok := call_node.derived.(^ast.Array_Type); ok { + found := false + + if array_is_soa(call_array^) { + return false + } + + if poly_type, ok := p.expr.derived.(^ast.Poly_Type); ok { + if ident, ok := unwrap_ident(poly_type.type); ok { + save_poly_map(ident, call_array.elem, poly_map) + } + + if poly_type.specialization != nil { + return resolve_poly(ast_context, call_array.elem, call_symbol, p.expr, poly_map) + } + found |= true + } + return found + } case ^ast.Map_Type: if call_map, ok := call_node.derived.(^ast.Map_Type); ok { found := false @@ -425,6 +445,12 @@ find_and_replace_poly_type :: proc(expr: ^ast.Expr, poly_map: ^map[string]^ast.E } } } + case ^ast.Ellipsis: + if expr, ok := get_poly_map(v.expr, poly_map); ok { + v.expr = expr + v.pos.file = expr.pos.file + v.end.file = expr.end.file + } } return visitor |