Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed Jan 17, 2025
1 parent ea1364d commit f535069
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion vlib/v/checker/fn.v
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,9 @@ fn (mut c Checker) call_expr(mut node ast.CallExpr) ast.Type {
if c.pref.skip_unused && !c.is_builtin_mod && c.mod == 'main'
&& !c.table.used_features.external_types {
if node.is_method {
c.table.used_features.external_types = true
if c.table.sym(node.left_type).is_builtin() {
c.table.used_features.external_types = true
}
} else if node.name.contains('.') {
c.table.used_features.external_types = true
}
Expand Down
4 changes: 4 additions & 0 deletions vlib/v/checker/struct.v
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,10 @@ fn (mut c Checker) struct_init(mut node ast.StructInit, is_field_zero_struct_ini
node.typ = c.expected_type
}
}
if c.pref.skip_unused && !c.is_builtin_mod && !c.table.used_features.external_types {
type_str := c.table.type_to_str(node.typ)
c.table.used_features.external_types = type_str.contains('.') && type_str.len > 1
}
struct_sym := c.table.sym(node.typ)
mut old_inside_generic_struct_init := false
mut old_cur_struct_generic_types := []ast.Type{}
Expand Down

0 comments on commit f535069

Please sign in to comment.