From 9a77c0ab819a4af38d6c1b793956ada4335751ba Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Wed, 24 Jun 2020 16:58:11 +0200 Subject: [PATCH] parser: fix the for loop check --- vlib/v/parser/for.v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vlib/v/parser/for.v b/vlib/v/parser/for.v index 2cdebd9324..a1e77a8715 100644 --- a/vlib/v/parser/for.v +++ b/vlib/v/parser/for.v @@ -73,7 +73,7 @@ fn (mut p Parser) for_stmt() ast.Stmt { key_var_name = val_var_name val_var_pos = p.tok.position() val_var_name = p.check_name() - if key_var_name == val_var_name { + if key_var_name == val_var_name && key_var_name != '_' { p.error_with_pos('key and value in a for loop cannot be the same', val_var_pos) } if p.scope.known_var(key_var_name) {