Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fmt: extend import import alias reference map for submodules #21200

Merged
merged 4 commits into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions vlib/v/fmt/fmt.v
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ pub fn fmt(file ast.File, mut table ast.Table, pref_ &pref.Preferences, is_debug
pub fn (mut f Fmt) process_file_imports(file &ast.File) {
for imp in file.imports {
f.mod2alias[imp.mod] = imp.alias
f.mod2alias[imp.mod.all_after('${file.mod.name}.')] = imp.alias
for sym in imp.syms {
f.mod2alias['${imp.mod}.${sym.name}'] = sym.name
f.mod2alias['${imp.mod.all_after_last('.')}.${sym.name}'] = sym.name
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module vlas

// `internal/blas` has to be intact as submodule directory structure for the test to be reliable.
import internal.blas

fn C.LAPACKE_dlange(matrix_layout blas.MemoryLayout) f64

pub fn c_trans(trans bool) blas.Transpose {
return if trans { .trans } else { .no_trans }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module vlas

import submod_import_alias.vlas.internal.blas

fn C.LAPACKE_dlange(matrix_layout blas.MemoryLayout) f64

pub fn c_trans(trans bool) blas.Transpose {
return if trans { .trans } else { .no_trans }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module vlas

import submod_import_alias.vlas.internal.blas

fn C.LAPACKE_dlange(matrix_layout internal.blas.MemoryLayout) f64

pub fn c_trans(trans bool) internal.blas.Transpose {
return if trans { .trans } else { .no_trans }
}