builder: fix the uhm `fine` module lookup bug (part 1)

pull/12619/head
Delyan Angelov 2021-11-29 16:30:45 +02:00
parent bbc47562b3
commit 6749979534
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
1 changed files with 5 additions and 4 deletions

View File

@ -197,10 +197,11 @@ pub fn (mut b Builder) parse_imports() {
if name == '' {
name = file.mod.short_name
}
if name != mod {
// v.parsers[pidx].error_with_token_index('bad module definition: ${v.parsers[pidx].file_path} imports module "$mod" but $file is defined as module `$p_mod`', 1
b.parsed_files[i].errors << b.error_with_pos('bad module definition: $ast_file.path imports module "$mod" but $file.path is defined as module `$name`',
ast_file.path, imp.pos)
sname := name.all_after_last('.')
smod := mod.all_after_last('.')
if sname != smod {
msg := 'bad module definition: $ast_file.path imports module "$mod" but $file.path is defined as module `$name`'
b.parsed_files[i].errors << b.error_with_pos(msg, ast_file.path, imp.pos)
}
}
b.parsed_files << parsed_files