Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed Jan 16, 2025
1 parent 40b574b commit 87e8a9c
Show file tree
Hide file tree
Showing 2 changed files with 23 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 @@ -5106,7 +5106,8 @@ fn (mut g Gen) ident(node ast.Ident) {
}
}
if node.obj.ct_type_var != .smartcast && node.obj.is_unwrapped {
g.write('.data')
dot := if obj_sym.is_heap() { '->' } else { '.' }
g.write('${dot}data')
}
g.write(')')
}
Expand Down
21 changes: 21 additions & 0 deletions vlib/v/tests/options/option_heap_var_test.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@[heap]
struct Foo {
a int
}

struct EdgeService {
foo Foo
}

fn t[S](s S) {
}

fn test_main() {
mut svc := ?EdgeService(EdgeService{})
if svc != none {
t(svc)
assert true
} else {
assert false
}
}

0 comments on commit 87e8a9c

Please sign in to comment.