diff --git a/vlib/v/fmt/fmt.v b/vlib/v/fmt/fmt.v index 60899e5af6..6550fb73be 100644 --- a/vlib/v/fmt/fmt.v +++ b/vlib/v/fmt/fmt.v @@ -1694,6 +1694,7 @@ fn (mut f Fmt) write_generic_call_if_require(node ast.CallExpr) { name = 'JS.' + name } f.write(name) + f.mark_import_as_used(name) if i != node.concrete_types.len - 1 { f.write(', ') } diff --git a/vlib/v/fmt/tests/import_selective_keep.vv b/vlib/v/fmt/tests/import_selective_keep.vv index 592a63524b..5a7603eec4 100644 --- a/vlib/v/fmt/tests/import_selective_keep.vv +++ b/vlib/v/fmt/tests/import_selective_keep.vv @@ -1,12 +1,16 @@ import math.complex { Complex } import gg { MouseButton } import time { Duration } +import modtest { Test } fn keep_imported_enum_map_key() { bm := map[MouseButton]string{} } +fn generic() {} + fn main() { _ := Duration(10) // keep cast type assert *(&f64(&byte(&num) + __offsetof(Complex, re))) == 1.0 + generic() }