aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBradley Lewis <22850972+BradLewis@users.noreply.github.com>2025-12-03 08:45:04 +1100
committerGitHub <noreply@github.com>2025-12-03 08:45:04 +1100
commit787544c10e5842efc9990a12de680b471333ba4a (patch)
tree74953ac58e4f2d64c10e4822e9ef3085d3997a06
parent0cf7f19eb147ae20c7427395397a08627de23264 (diff)
parent5695cf05f8ec56f880fd4d9d7f8d125588e8c93d (diff)
Merge pull request #1202 from BradLewis/fix/generic-struct-field-with-default-value
Fix crash when using a generic proc in a struct field with a default value
-rw-r--r--src/server/generics.odin12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/server/generics.odin b/src/server/generics.odin
index fc22942..db858cc 100644
--- a/src/server/generics.odin
+++ b/src/server/generics.odin
@@ -761,9 +761,15 @@ resolve_poly_struct :: proc(ast_context: ^AstContext, b: ^SymbolStructValueBuild
// need to be updated
if data.parent_proc.params != nil {
for &param in data.parent_proc.params.list {
- if param_ident, ok := param.type.derived.(^ast.Ident); ok {
- if param_ident.name == ident.name {
- param.type = expr
+ type := param.type
+ if type == nil {
+ type = param.default_value
+ }
+ if type != nil {
+ if param_ident, ok := type.derived.(^ast.Ident); ok {
+ if param_ident.name == ident.name {
+ param.type = expr
+ }
}
}
}