Skip to content

Commit

Permalink
markused: fix -skip-unused on a short program, that prints array (fix
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp authored Jan 11, 2025
1 parent 62de56f commit 81b421b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions vlib/v/markused/markused.v
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ pub fn mark_used(mut table ast.Table, mut pref_ pref.Preferences, ast_files []&a
builderptr_idx + '.write_rune',
]
}
if !table.used_features.arr_init {
table.used_features.arr_init = table.used_features.print_types.keys().any(table.type_to_str(it).contains('[]'))
}
if table.used_features.arr_init || table.used_features.comptime_for {
include_panic_deps = true
core_fns << '__new_array'
Expand Down
Empty file.
Empty file.
4 changes: 4 additions & 0 deletions vlib/v/tests/skip_unused/call_arguments.vv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fn main() {
args := arguments()
assert args.len > 0
}

0 comments on commit 81b421b

Please sign in to comment.