diff --git a/src/pkg/go/parser/parser.go b/src/pkg/go/parser/parser.go index ef610209e81..45713327df5 100644 --- a/src/pkg/go/parser/parser.go +++ b/src/pkg/go/parser/parser.go @@ -464,7 +464,7 @@ func (p *parser) makeIdentList(list *vector.Vector) []*ast.Ident { if !isIdent { pos := x.(ast.Expr).Pos() p.errorExpected(pos, "identifier") - idents[i] = &ast.Ident{pos, ast.NewObj(ast.Err, pos, "")} + ident = &ast.Ident{pos, ast.NewObj(ast.Err, pos, "_")} } idents[i] = ident } diff --git a/src/pkg/go/parser/parser_test.go b/src/pkg/go/parser/parser_test.go index 9e37551623f..c177b2eb816 100644 --- a/src/pkg/go/parser/parser_test.go +++ b/src/pkg/go/parser/parser_test.go @@ -34,6 +34,7 @@ var validPrograms = []interface{}{ `package main; func main() { if f(T{}) {} }` + "\n", `package main; func main() { _ = (<-chan int)(x) }` + "\n", `package main; func main() { _ = (<-chan <-chan int)(x) }` + "\n", + `package main; func f(func() (func() int))` + "\n", }