From a993fb04d8a24219aeace6d8294db1419195678f Mon Sep 17 00:00:00 2001 From: kbkpbot Date: Sat, 24 May 2025 16:05:25 +0800 Subject: [PATCH] parser: fix duplicate mod imports (fix #24552) (#24559) --- vlib/sync/chan_mod_sync_test.v | 10 ++++++++++ vlib/v/parser/module.v | 3 +++ 2 files changed, 13 insertions(+) create mode 100644 vlib/sync/chan_mod_sync_test.v diff --git a/vlib/sync/chan_mod_sync_test.v b/vlib/sync/chan_mod_sync_test.v new file mode 100644 index 000000000..8dab4d381 --- /dev/null +++ b/vlib/sync/chan_mod_sync_test.v @@ -0,0 +1,10 @@ +module sync + +struct ChanStruct { + workers []chan bool +} + +fn test_chan_mod_sync() { + _ := chan bool{cap: 1} + assert true +} diff --git a/vlib/v/parser/module.v b/vlib/v/parser/module.v index 7781750fb..1eec26299 100644 --- a/vlib/v/parser/module.v +++ b/vlib/v/parser/module.v @@ -43,6 +43,9 @@ fn (mut p Parser) register_used_import_for_symbol_name(sym_name string) { } fn (mut p Parser) register_auto_import(alias string) { + if p.mod == alias { + return + } if alias !in p.imports { p.imports[alias] = alias p.table.imports << alias -- 2.39.5