1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

fmt: fix removal of Abc in import mod { Abc }, where Abc is used in a x is Abc expression (#10286)

This commit is contained in:
zakuro 2021-05-31 23:35:16 +09:00 committed by GitHub
parent cb19079d53
commit 90292ce981
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 0 deletions

View File

@ -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) { 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)) f.write(f.table.type_to_str_using_aliases(node.typ, f.mod2alias))
} }

View File

@ -11,6 +11,7 @@ import mod {
InterfaceField, InterfaceField,
InterfaceMethodArg, InterfaceMethodArg,
InterfaceMethodRet, InterfaceMethodRet,
RightOfIs,
StructEmbed, StructEmbed,
StructField, StructField,
StructMethodArg, StructMethodArg,
@ -34,6 +35,9 @@ interface Interface {
} }
fn f(v FnArg) FnRet { fn f(v FnArg) FnRet {
if v is RightOfIs {
}
return {} return {}
} }

View File

@ -19,6 +19,8 @@ import mod {
FnArg, FnArg,
FnRet, FnRet,
RightOfIs,
} }
struct Struct { struct Struct {
@ -37,6 +39,8 @@ interface Interface {
} }
fn f(v FnArg) FnRet { fn f(v FnArg) FnRet {
if v is RightOfIs {}
return {} return {}
} }