From 70b92ddad3e9759fe44afe78c1723c874ffc0642 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Tue, 26 Jan 2010 11:41:38 -0800 Subject: [PATCH] Bug in go/parser when coverting identifier lists. Fixes #567. R=rsc CC=golang-dev https://golang.org/cl/195041 --- src/pkg/go/parser/parser.go | 2 +- src/pkg/go/parser/parser_test.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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", }