fix complier error from alias of named union

example
```odin
Scope :: any_dec

any_dec :: union {
  ^type_incomplete_declaration,
  ^type_enum_declaration,
  ...

sym_scope :: struct {
  syms : map[StrHandle][dynamic]symbol,
  parent_scope : Scope,
}

sym_scope_make :: proc(parent : Scope, alloc : mem.Allocator) -> sym_scope {
  return sym_scope{make(map[StrHandle][dynamic]symbol, 0, alloc), parent} ---sometimes error here
}
```
depending on where the alias was declared, can output
```
Error: Cannot assign value 'parent' of type 'any_dec' to 'union {^type_incomplete_declaration, ...}' in a structure literal
        ... sym_scope{make(map[StrHandle][dynamic]symbol, 0, alloc), parent}
```

haven't been able to recreate a minimal reproduceable test case yet
This commit is contained in:
gco committed 2026-10-11 11:00:05 +11:00
1 parent ed63154d8c
commit b4d08925f2
1 file changed
+6 -1
+6 -1
View File
@@ -1998,7 +1998,12 @@ gb_internal Entity *check_ident(CheckerContext *c, Operand *o, Ast *n, Type *nam
}
// Keep struct aliases named so recursive fields retain their alias edge.
if (bt != nullptr && bt->kind != Type_Struct) {
o->type = bt;
if (bt->kind == Type_Union) {
o->type = base_named_type(o->type);
}
else {
o->type = bt;
}
}
}
break;