Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed Dec 27, 2024
1 parent 2ea4e57 commit caa6411
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions vlib/v/comptime/comptimeinfo.v
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,12 @@ pub fn (mut ct ComptimeInfo) get_type_or_default(node ast.Expr, default_typ ast.
ast.SelectorExpr {
if node.expr is ast.Ident && node.expr.ct_expr {
struct_typ := ct.resolver.unwrap_generic(ct.get_type(node.expr))
if field := ct.table.find_field(ct.table.sym(struct_typ), node.field_name) {
return field.typ
struct_sym := ct.table.final_sym(struct_typ)
// Struct[T] can have field with generic type
if struct_sym.info is ast.Struct && struct_sym.info.generic_types.len > 0 {
if field := ct.table.find_field(struct_sym, node.field_name) {
return field.typ
}
}
}
}
Expand Down

0 comments on commit caa6411

Please sign in to comment.