vfmt: keep selective imported names used for generic calls
parent
7c7d59acee
commit
f9079b6700
|
@ -1694,6 +1694,7 @@ fn (mut f Fmt) write_generic_call_if_require(node ast.CallExpr) {
|
|||
name = 'JS.' + name
|
||||
}
|
||||
f.write(name)
|
||||
f.mark_import_as_used(name)
|
||||
if i != node.concrete_types.len - 1 {
|
||||
f.write(', ')
|
||||
}
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
import math.complex { Complex }
|
||||
import gg { MouseButton }
|
||||
import time { Duration }
|
||||
import modtest { Test }
|
||||
|
||||
fn keep_imported_enum_map_key() {
|
||||
bm := map[MouseButton]string{}
|
||||
}
|
||||
|
||||
fn generic<T>() {}
|
||||
|
||||
fn main() {
|
||||
_ := Duration(10) // keep cast type
|
||||
assert *(&f64(&byte(&num) + __offsetof(Complex, re))) == 1.0
|
||||
generic<Test>()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue