fmt: fix removal of selective imported map key type (#10235)
parent
6b683d31ac
commit
ddcc22a778
|
@ -35,7 +35,6 @@ const (
|
||||||
'vlib/v/tests/interop_test.v', /* bad comment formatting */
|
'vlib/v/tests/interop_test.v', /* bad comment formatting */
|
||||||
'vlib/v/tests/string_interpolation_test.v' /* TODO byteptr: &byte.str() behaves differently than byteptr.str() */,
|
'vlib/v/tests/string_interpolation_test.v' /* TODO byteptr: &byte.str() behaves differently than byteptr.str() */,
|
||||||
'vlib/v/gen/js/tests/js.v', /* local `hello` fn, gets replaced with module `hello` aliased as `hl` */
|
'vlib/v/gen/js/tests/js.v', /* local `hello` fn, gets replaced with module `hello` aliased as `hl` */
|
||||||
'vlib/v/tests/map_enum_keys_test.v' /* temporary here, till PR#10235 is merged */,
|
|
||||||
'examples/c_interop_wkhtmltopdf.v' /* &charptr --> &&char */,
|
'examples/c_interop_wkhtmltopdf.v' /* &charptr --> &&char */,
|
||||||
]
|
]
|
||||||
vfmt_verify_list = [
|
vfmt_verify_list = [
|
||||||
|
|
|
@ -2078,7 +2078,9 @@ pub fn (mut f Fmt) lock_expr(node ast.LockExpr) {
|
||||||
pub fn (mut f Fmt) map_init(node ast.MapInit) {
|
pub fn (mut f Fmt) map_init(node ast.MapInit) {
|
||||||
if node.keys.len == 0 {
|
if node.keys.len == 0 {
|
||||||
if node.typ > ast.void_type {
|
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))
|
f.write(f.table.type_to_str_using_aliases(node.typ, f.mod2alias))
|
||||||
} else {
|
} else {
|
||||||
// m = map{}
|
// m = map{}
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
import math.complex { Complex }
|
import math.complex { Complex }
|
||||||
|
import gg { MouseButton }
|
||||||
|
|
||||||
|
fn keep_imported_enum_map_key() {
|
||||||
|
bm := map[MouseButton]string{}
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
assert *(&f64(&byte(&num) + __offsetof(Complex, re))) == 1.0
|
assert *(&f64(&byte(&num) + __offsetof(Complex, re))) == 1.0
|
||||||
|
|
Loading…
Reference in New Issue