checker: clarify duplicate import error (#10150)
parent
bf69d20353
commit
f7cd95472a
|
@ -110,7 +110,8 @@ pub fn (mut c Checker) check(ast_file &ast.File) {
|
||||||
for i, ast_import in ast_file.imports {
|
for i, ast_import in ast_file.imports {
|
||||||
for j in 0 .. i {
|
for j in 0 .. i {
|
||||||
if ast_import.mod == ast_file.imports[j].mod {
|
if ast_import.mod == ast_file.imports[j].mod {
|
||||||
c.error('module name `$ast_import.mod` duplicate', ast_import.mod_pos)
|
c.error('`$ast_import.mod` was already imported on line ${
|
||||||
|
ast_file.imports[j].mod_pos.line_nr + 1}', ast_import.mod_pos)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
vlib/v/checker/tests/import_duplicate_err.vv:2:8: error: module name `time` duplicate
|
vlib/v/checker/tests/import_duplicate_err.vv:2:8: error: `time` was already imported on line 1
|
||||||
1 | import time
|
1 | import time
|
||||||
2 | import time
|
2 | import time
|
||||||
| ~~~~
|
| ~~~~
|
||||||
|
|
Loading…
Reference in New Issue