Skip to content

Commit a993fb0

Browse files
authored
parser: fix duplicate mod imports (fix #24552) (#24559)
1 parent a8aeae2 commit a993fb0

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

‎vlib/sync/chan_mod_sync_test.v‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module sync
2+
3+
struct ChanStruct {
4+
workers []chan bool
5+
}
6+
7+
fn test_chan_mod_sync() {
8+
_ := chan bool{cap: 1}
9+
assert true
10+
}

‎vlib/v/parser/module.v‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ fn (mut p Parser) register_used_import_for_symbol_name(sym_name string) {
4343
}
4444

4545
fn (mut p Parser) register_auto_import(alias string) {
46+
if p.mod == alias {
47+
return
48+
}
4649
if alias !in p.imports {
4750
p.imports[alias] = alias
4851
p.table.imports << alias

0 commit comments

Comments
 (0)