1
0
mirror of https://github.com/golang/go synced 2024-11-19 23:34:40 -07:00

cmd/compile/internal/syntax: better error recovery after missing type

R=go1.11.

This is just a copy of the fix for #23434:
https://go-review.googlesource.com/c/go/+/87898.

Test pending test harness for the syntax package.

Change-Id: I52409aebe13ec784ddd7e41190a81c7e126bdd0c
Reviewed-on: https://go-review.googlesource.com/87901
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Robert Griesemer 2018-01-16 17:00:51 -08:00
parent be9a1774f2
commit 670494827c

View File

@ -1036,7 +1036,7 @@ func (p *parser) type_() Expr {
if typ == nil { if typ == nil {
typ = p.bad() typ = p.bad()
p.syntax_error("expecting type") p.syntax_error("expecting type")
p.advance() p.advance(_Comma, _Colon, _Semi, _Rparen, _Rbrack, _Rbrace)
} }
return typ return typ