fmt: do not prepend mod to selectively imported types from nested module (#8805)
parent
ab6517c5fc
commit
600f6ad2a0
|
@ -80,9 +80,11 @@ pub fn fmt(file ast.File, table &table.Table, pref &pref.Preferences, is_debug b
|
||||||
|
|
||||||
pub fn (mut f Fmt) process_file_imports(file &ast.File) {
|
pub fn (mut f Fmt) process_file_imports(file &ast.File) {
|
||||||
for imp in file.imports {
|
for imp in file.imports {
|
||||||
f.mod2alias[imp.mod.all_after_last('.')] = imp.alias
|
mod := imp.mod.all_after_last('.')
|
||||||
|
f.mod2alias[mod] = imp.alias
|
||||||
for sym in imp.syms {
|
for sym in imp.syms {
|
||||||
f.mod2alias['${imp.mod}.$sym.name'] = sym.name
|
f.mod2alias['${imp.mod}.$sym.name'] = sym.name
|
||||||
|
f.mod2alias['${mod}.$sym.name'] = sym.name
|
||||||
f.mod2alias[sym.name] = sym.name
|
f.mod2alias[sym.name] = sym.name
|
||||||
f.import_syms_used[sym.name] = false
|
f.import_syms_used[sym.name] = false
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,18 @@
|
||||||
import math { max, min }
|
import math { max, min }
|
||||||
|
import math.complex { complex, Complex }
|
||||||
import os {
|
import os {
|
||||||
user_os,
|
user_os,
|
||||||
file_ext,
|
file_ext,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn imaginary(im f64) Complex {
|
||||||
|
return complex(0, im)
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println(max(0.1, 0.2))
|
println(max(0.1, 0.2))
|
||||||
println(min(0.1, 0.2))
|
println(min(0.1, 0.2))
|
||||||
println(user_os())
|
println(user_os())
|
||||||
println(file_ext('main.v'))
|
println(file_ext('main.v'))
|
||||||
|
println(imaginary(1))
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,18 @@
|
||||||
import math { max,
|
import math { max,
|
||||||
min,
|
min,
|
||||||
}
|
}
|
||||||
|
import math.complex { complex, Complex }
|
||||||
import os {
|
import os {
|
||||||
input, user_os, file_ext }
|
input, user_os, file_ext }
|
||||||
|
|
||||||
|
fn imaginary(im f64) Complex {
|
||||||
|
return complex(0, im)
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println(max(0.1, 0.2))
|
println(max(0.1, 0.2))
|
||||||
println(min(0.1, 0.2))
|
println(min(0.1, 0.2))
|
||||||
println(user_os())
|
println(user_os())
|
||||||
println(file_ext('main.v'))
|
println(file_ext('main.v'))
|
||||||
|
println(imaginary(1))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue