Skip to content

Commit

Permalink
checker: fix undefined reference to interface struct field regression…
Browse files Browse the repository at this point in the history
… (after #21025) (#21030)
  • Loading branch information
ttytm committed Mar 15, 2024
1 parent aded18a commit 84a52ae
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions vlib/v/checker/struct.v
Expand Up @@ -654,10 +654,11 @@ or use an explicit `unsafe{ a[..] }`, if you do not want a copy of the slice.',
}
}
if exp_type_sym.kind == .interface_ {
if got_type_sym.kind != .interface_ && !c.inside_unsafe
&& !got_type.is_any_kind_of_pointer()
&& c.type_implements(got_type, exp_type, init_field.pos) {
c.mark_as_referenced(mut &init_field.expr, true)
if c.type_implements(got_type, exp_type, init_field.pos) {
if !c.inside_unsafe && got_type_sym.kind != .interface_
&& !got_type.is_any_kind_of_pointer() {
c.mark_as_referenced(mut &init_field.expr, true)
}
}
} else if got_type != ast.void_type && got_type_sym.kind != .placeholder
&& !exp_type.has_flag(.generic) {
Expand Down

0 comments on commit 84a52ae

Please sign in to comment.