Parsing (go test -run Parse -src=x.go)
//+build ignore
package p
func bad() {
if f()) {
return
}
}
results in:
parser_test.go:26: x.go:6:11: syntax error: unexpected ), expecting semicolon or newline
parser_test.go:26: x.go:6:11: syntax error: unexpected f, expecting { after if clause
The problem is due to an incorrectly set up variable when parsing statement headers.
The 2nd error is suppressed when using cmd/compile because it's on the same line.