parser: multiple names error

pull/4675/head
yuyi 2020-05-02 00:18:58 +08:00 committed by GitHub
parent de272654f1
commit b21be7f670
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 0 deletions

View File

@ -0,0 +1,5 @@
vlib/v/checker/tests/multi_names_err.v:2:4: error: unexpected name `a`
1 | fn main() {
2 | a a a a := 1
| ^
3 | }

View File

@ -0,0 +1,3 @@
fn main() {
a a a a := 1
}

View File

@ -472,6 +472,8 @@ pub fn (mut p Parser) stmt() ast.Stmt {
return ast.GotoLabel{
name: name
}
} else if p.tok.kind == .name && p.peek_tok.kind == .name {
p.error_with_pos('unexpected name `$p.peek_tok.lit`', p.peek_tok.position())
}
epos := p.tok.position()
expr := p.expr(0)