Commit 8a089c07 authored by Robert Griesemer's avatar Robert Griesemer

go/parser: slightly improved error message by adding hint

It's difficult to make this much better w/o much
more effort. This is a rare case and probably not
worth it.

Fixes #6052.

R=golang-codereviews, bradfitz, adonovan
CC=golang-codereviews
https://golang.org/cl/49740045
parent e598bf1c
......@@ -1752,7 +1752,7 @@ func (p *parser) makeExpr(s ast.Stmt) ast.Expr {
if es, isExpr := s.(*ast.ExprStmt); isExpr {
return p.checkExpr(es.X)
}
p.error(s.Pos(), "expected condition, found simple statement")
p.error(s.Pos(), "expected condition, found simple statement (missing parentheses around composite literal?)")
return &ast.BadExpr{From: s.Pos(), To: s.End()}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment