]> Cypherpunks repositories - gostls13.git/commitdiff
go/parser: slightly improved error message by adding hint
authorRobert Griesemer <gri@golang.org>
Thu, 9 Jan 2014 22:51:23 +0000 (14:51 -0800)
committerRobert Griesemer <gri@golang.org>
Thu, 9 Jan 2014 22:51:23 +0000 (14:51 -0800)
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

src/pkg/go/parser/parser.go

index c4523318f2614773d54b5b856931f79495a9f333..d8cde99de2347bc539054d3df39a74f1a8467e87 100644 (file)
@@ -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()}
 }