Skip to content

Commit abe97b6

Browse files
authored
checker: allow for _ being used as both import x as _ and fn f(_ int) { (fix (#26219) #26230
1 parent 1f961a9 commit abe97b6

3 files changed

Lines changed: 10 additions & 0 deletions

File tree

‎vlib/v/checker/checker.v‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6073,6 +6073,9 @@ fn (mut c Checker) deprecate_old_isreftype_and_sizeof_of_a_guessed_type(is_guess
60736073
}
60746074

60756075
fn (c &Checker) check_import_sym_conflict(ident string) bool {
6076+
if ident == '_' {
6077+
return false
6078+
}
60766079
for import_sym in c.file.imports {
60776080
// Check if alias exists or not
60786081
if !import_sym.alias.is_blank() {

‎vlib/v/checker/tests/discard_import_usage.out‎

Whitespace-only changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import os as _
2+
3+
fn test_fn(_ int) {}
4+
5+
fn main() {
6+
test_fn(12)
7+
}

0 commit comments

Comments
 (0)