fmt: do not prepend mod to selectively imported types from nested module (#8805)

pull/8811/head
zakuro 2021-02-18 04:42:26 +09:00 committed by GitHub
parent ab6517c5fc
commit 600f6ad2a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 1 deletions

View File

@ -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) {
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 {
f.mod2alias['${imp.mod}.$sym.name'] = sym.name
f.mod2alias['${mod}.$sym.name'] = sym.name
f.mod2alias[sym.name] = sym.name
f.import_syms_used[sym.name] = false
}

View File

@ -1,12 +1,18 @@
import math { max, min }
import math.complex { complex, Complex }
import os {
user_os,
file_ext,
}
fn imaginary(im f64) Complex {
return complex(0, im)
}
fn main() {
println(max(0.1, 0.2))
println(min(0.1, 0.2))
println(user_os())
println(file_ext('main.v'))
println(imaginary(1))
}

View File

@ -1,12 +1,18 @@
import math { max,
min,
}
import math.complex { complex, Complex }
import os {
input, user_os, file_ext }
fn imaginary(im f64) Complex {
return complex(0, im)
}
fn main() {
println(max(0.1, 0.2))
println(min(0.1, 0.2))
println(user_os())
println(file_ext('main.v'))
println(imaginary(1))
}