checker: clarify duplicate import error (#10150)

pull/10161/head
Lukas Neubert 2021-05-21 05:12:38 +02:00 committed by GitHub
parent bf69d20353
commit f7cd95472a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -110,7 +110,8 @@ pub fn (mut c Checker) check(ast_file &ast.File) {
for i, ast_import in ast_file.imports {
for j in 0 .. i {
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)
}
}
}

View File

@ -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
2 | import time
| ~~~~