mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
fmt: fix removal of selective imported map key type (#10235)
This commit is contained in:
@@ -2078,7 +2078,9 @@ pub fn (mut f Fmt) lock_expr(node ast.LockExpr) {
|
||||
pub fn (mut f Fmt) map_init(node ast.MapInit) {
|
||||
if node.keys.len == 0 {
|
||||
if node.typ > ast.void_type {
|
||||
f.mark_types_import_as_used(node.typ)
|
||||
sym := f.table.get_type_symbol(node.typ)
|
||||
info := sym.info as ast.Map
|
||||
f.mark_types_import_as_used(info.key_type)
|
||||
f.write(f.table.type_to_str_using_aliases(node.typ, f.mod2alias))
|
||||
} else {
|
||||
// m = map{}
|
||||
|
@@ -1,4 +1,9 @@
|
||||
import math.complex { Complex }
|
||||
import gg { MouseButton }
|
||||
|
||||
fn keep_imported_enum_map_key() {
|
||||
bm := map[MouseButton]string{}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
assert *(&f64(&byte(&num) + __offsetof(Complex, re))) == 1.0
|
||||
|
Reference in New Issue
Block a user