diff --git a/vlib/v/fmt/fmt.v b/vlib/v/fmt/fmt.v index 45c5757dff..ebebd5333e 100644 --- a/vlib/v/fmt/fmt.v +++ b/vlib/v/fmt/fmt.v @@ -2429,6 +2429,7 @@ pub fn (mut f Fmt) string_inter_literal(node ast.StringInterLiteral) { } pub fn (mut f Fmt) type_expr(node ast.TypeNode) { + f.mark_types_import_as_used(node.typ) f.write(f.table.type_to_str_using_aliases(node.typ, f.mod2alias)) } diff --git a/vlib/v/fmt/tests/import_selective_expected.vv b/vlib/v/fmt/tests/import_selective_expected.vv index 4d3f9517a9..5854ab504e 100644 --- a/vlib/v/fmt/tests/import_selective_expected.vv +++ b/vlib/v/fmt/tests/import_selective_expected.vv @@ -11,6 +11,7 @@ import mod { InterfaceField, InterfaceMethodArg, InterfaceMethodRet, + RightOfIs, StructEmbed, StructField, StructMethodArg, @@ -34,6 +35,9 @@ interface Interface { } fn f(v FnArg) FnRet { + if v is RightOfIs { + } + return {} } diff --git a/vlib/v/fmt/tests/import_selective_input.vv b/vlib/v/fmt/tests/import_selective_input.vv index cb92d42dc9..3ddb69b661 100644 --- a/vlib/v/fmt/tests/import_selective_input.vv +++ b/vlib/v/fmt/tests/import_selective_input.vv @@ -19,6 +19,8 @@ import mod { FnArg, FnRet, + + RightOfIs, } struct Struct { @@ -37,6 +39,8 @@ interface Interface { } fn f(v FnArg) FnRet { + if v is RightOfIs {} + return {} }