Skip to content

Commit

Permalink
parser: suggest better error for lock
Browse files Browse the repository at this point in the history
  • Loading branch information
Delta456 committed Jul 26, 2024
1 parent e7fe57b commit 244a3be
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion vlib/v/parser/lock.v
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ fn (mut p Parser) lock_expr() ast.LockExpr {
for {
is_rlock := p.tok.kind == .key_rlock
if !is_rlock && p.tok.kind != .key_lock {
p.unexpected(expecting: '`lock` or `rlock`')
p.unexpected(expecting: 'expecting one or more shared variable names')
}
p.next()
if p.tok.kind == .lcbr {
Expand Down
3 changes: 3 additions & 0 deletions vlib/v/parser/tests/lock_var_name_assign_err.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
vlib/v/parser/tests/lock_var_name_assign_err.vv:1:6: error: unexpected token `:=`, expecting expecting one or more shared variable names
1 | lock := 12
| ~~
1 change: 1 addition & 0 deletions vlib/v/parser/tests/lock_var_name_assign_err.vv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lock := 12

0 comments on commit 244a3be

Please sign in to comment.