Skip to content

Commit

Permalink
checker: fix inability to use multiple import some modname as _ in …
Browse files Browse the repository at this point in the history
…the same .v file (fix #19899) (#19900)
  • Loading branch information
shove70 committed Nov 16, 2023
1 parent e787620 commit 9e2b238
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion vlib/v/checker/checker.v
Expand Up @@ -221,7 +221,7 @@ pub fn (mut c Checker) check(mut ast_file ast.File) {
} else if ast_import.mod == ast_file.imports[j].alias {
c.error('`${ast_file.imports[j].mod}` was already imported as `${ast_import.alias}` on line ${
ast_file.imports[j].mod_pos.line_nr + 1}', ast_import.mod_pos)
} else if ast_import.alias == ast_file.imports[j].alias {
} else if ast_import.alias != '_' && ast_import.alias == ast_file.imports[j].alias {
c.error('`${ast_file.imports[j].mod}` was already imported on line ${
ast_file.imports[j].alias_pos.line_nr + 1}', ast_import.alias_pos)
}
Expand Down
7 changes: 7 additions & 0 deletions vlib/v/tests/import_aliases_test.v
@@ -0,0 +1,7 @@
// for issue 19899: Multiple import some_mod as _ results in error
import os as _
import io as _

fn test_multiple_import_as_blank_ident() {
assert true
}

0 comments on commit 9e2b238

Please sign in to comment.