mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vfmt: keep selective imported names used for generic calls
This commit is contained in:
parent
15c62bc8e8
commit
634e8c3624
@ -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
Block a user