fmt: fix removal of selective imported Enum (#10729)
parent
a1088275b9
commit
cb14e42af8
|
@ -1804,6 +1804,7 @@ pub fn (mut f Fmt) dump_expr(node ast.DumpExpr) {
|
||||||
pub fn (mut f Fmt) enum_val(node ast.EnumVal) {
|
pub fn (mut f Fmt) enum_val(node ast.EnumVal) {
|
||||||
name := f.short_module(node.enum_name)
|
name := f.short_module(node.enum_name)
|
||||||
f.write(name + '.' + node.val)
|
f.write(name + '.' + node.val)
|
||||||
|
f.mark_import_as_used(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn (mut f Fmt) ident(node ast.Ident) {
|
pub fn (mut f Fmt) ident(node ast.Ident) {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import os {
|
||||||
user_os,
|
user_os,
|
||||||
}
|
}
|
||||||
import mod {
|
import mod {
|
||||||
|
Enum,
|
||||||
FnArg,
|
FnArg,
|
||||||
FnRet,
|
FnRet,
|
||||||
InterfaceField,
|
InterfaceField,
|
||||||
|
@ -40,6 +41,8 @@ fn f(v FnArg) FnRet {
|
||||||
}
|
}
|
||||||
_ = v as RightOfAs
|
_ = v as RightOfAs
|
||||||
|
|
||||||
|
println(Enum.val)
|
||||||
|
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,8 @@ import mod {
|
||||||
|
|
||||||
RightOfIs,
|
RightOfIs,
|
||||||
RightOfAs,
|
RightOfAs,
|
||||||
|
|
||||||
|
Enum
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Struct {
|
struct Struct {
|
||||||
|
@ -43,6 +45,8 @@ fn f(v FnArg) FnRet {
|
||||||
if v is RightOfIs {}
|
if v is RightOfIs {}
|
||||||
_ = v as RightOfAs
|
_ = v as RightOfAs
|
||||||
|
|
||||||
|
println(Enum.val)
|
||||||
|
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue