mirror of
https://github.com/odin-lang/Odin.git
synced 2025-12-31 18:32:12 +00:00
Fix polymorphic record types with constant value parameters
This commit is contained in:
@@ -140,10 +140,11 @@ struct TypeUnion {
|
||||
Entity *type_name; /* Entity_TypeName */ \
|
||||
}) \
|
||||
TYPE_KIND(Generic, struct { \
|
||||
i64 id; \
|
||||
String name; \
|
||||
Type * specialized; \
|
||||
Scope *scope; \
|
||||
i64 id; \
|
||||
String name; \
|
||||
Type * specialized; \
|
||||
Scope * scope; \
|
||||
Entity *entity; \
|
||||
}) \
|
||||
TYPE_KIND(Pointer, struct { Type *elem; }) \
|
||||
TYPE_KIND(Opaque, struct { Type *elem; }) \
|
||||
@@ -1988,6 +1989,15 @@ Selection lookup_field_with_selection(Type *type_, String field_name, bool is_ty
|
||||
return sel;
|
||||
}
|
||||
}
|
||||
} else if (type->kind == Type_Union) {
|
||||
Scope *s = type->Union.scope;
|
||||
if (s != nullptr) {
|
||||
Entity *found = scope_lookup_current(s, field_name);
|
||||
if (found != nullptr && found->kind != Entity_Variable) {
|
||||
sel.entity = found;
|
||||
return sel;
|
||||
}
|
||||
}
|
||||
} else if (type->kind == Type_BitSet) {
|
||||
return lookup_field_with_selection(type->BitSet.elem, field_name, true, sel, allow_blank_ident);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user