Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lv37 authored Sep 24, 2023
1 parent a1028f1 commit c58dd10
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions vlib/v/gen/c/cgen.v
Original file line number Diff line number Diff line change
Expand Up @@ -2271,13 +2271,11 @@ fn (mut g Gen) get_sumtype_casting_fn(got_ ast.Type, exp_ ast.Type) string {
if got == exp || g.sumtype_definitions[i] {
return fn_name
}
if exp_sym.kind == .sum_type {
for {
if got_sym.idx in (exp_sym.info as ast.SumType).variants {
break
}
got_sym = g.table.sym(got_sym.parent_idx)
for {
if got_sym.parent_idx == 0 || got_sym.idx in (exp_sym.info as ast.SumType).variants {
break
}
got_sym = g.table.sym(got_sym.parent_idx)
}
g.sumtype_definitions[i] = true
g.sumtype_casting_fns << SumtypeCastingFn{
Expand Down

0 comments on commit c58dd10

Please sign in to comment.