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) {
|
||||
name := f.short_module(node.enum_name)
|
||||
f.write(name + '.' + node.val)
|
||||
f.mark_import_as_used(name)
|
||||
}
|
||||
|
||||
pub fn (mut f Fmt) ident(node ast.Ident) {
|
||||
|
|
|
@ -6,6 +6,7 @@ import os {
|
|||
user_os,
|
||||
}
|
||||
import mod {
|
||||
Enum,
|
||||
FnArg,
|
||||
FnRet,
|
||||
InterfaceField,
|
||||
|
@ -40,6 +41,8 @@ fn f(v FnArg) FnRet {
|
|||
}
|
||||
_ = v as RightOfAs
|
||||
|
||||
println(Enum.val)
|
||||
|
||||
return {}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,8 @@ import mod {
|
|||
|
||||
RightOfIs,
|
||||
RightOfAs,
|
||||
|
||||
Enum
|
||||
}
|
||||
|
||||
struct Struct {
|
||||
|
@ -43,6 +45,8 @@ fn f(v FnArg) FnRet {
|
|||
if v is RightOfIs {}
|
||||
_ = v as RightOfAs
|
||||
|
||||
println(Enum.val)
|
||||
|
||||
return {}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue