Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed Dec 24, 2024
1 parent f432f66 commit 239e808
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion vlib/v/gen/c/cgen.v
Original file line number Diff line number Diff line change
Expand Up @@ -4209,6 +4209,7 @@ fn (mut g Gen) selector_expr(node ast.SelectorExpr) {
mut field_typ := ast.void_type
mut is_option_unwrap := false
mut is_dereferenced := node.expr is ast.SelectorExpr && node.expr.expr_type.is_ptr()
&& !node.expr.typ.is_ptr()
&& g.table.final_sym(node.expr.expr_type).kind in [.interface, .sum_type]
if f := g.table.find_field_with_embeds(sym, node.field_name) {
field_sym := g.table.sym(f.typ)
Expand Down Expand Up @@ -4391,7 +4392,7 @@ fn (mut g Gen) selector_expr(node ast.SelectorExpr) {
}
g.write(field_name)
if is_option_unwrap {
if field_typ.is_ptr() {
if field_typ.is_ptr() && g.table.final_sym(node.expr_type).kind in [.sum_type, .interface] {
g.write('->')
} else {
g.write('.')
Expand Down

0 comments on commit 239e808

Please sign in to comment.