diff options
author | Robert Griesemer <gri@golang.org> | 2021-03-11 16:34:01 -0800 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2021-03-13 00:38:58 +0000 |
commit | 16ad1ea8417bb842204bf7c982e3f19969b67458 (patch) | |
tree | 60e0ca42041744743a37134d821cf735a8c16189 /src/cmd/compile/internal/types2/call.go | |
parent | 7b47f9a5f2092dcbc1546304f1f1b739883fa4c4 (diff) | |
download | go-16ad1ea8417bb842204bf7c982e3f19969b67458.tar.gz go-16ad1ea8417bb842204bf7c982e3f19969b67458.zip |
cmd/compile/internal/types2: simplify error reporting API (cleanup)
- Remove specialized errorf functions for invalid AST/argument/operation.
Instead use prefix constants with the error message.
- Replace several calls to Checker.errorf with calls to Checker.error
if there are no arguments to format.
- Replace a handful of %s format verbs with %v to satisfy vet check.
- Add a basic test that checks that we're not using Checker.errorf when
we should be using Checker.error.
Change-Id: I7bc7c14f3cf774689ec8cd5782ea31b6e30dbcd6
Reviewed-on: https://go-review.googlesource.com/c/go/+/300995
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Diffstat (limited to 'src/cmd/compile/internal/types2/call.go')
-rw-r--r-- | src/cmd/compile/internal/types2/call.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/types2/call.go b/src/cmd/compile/internal/types2/call.go index 320e12d4d6..93f4c51937 100644 --- a/src/cmd/compile/internal/types2/call.go +++ b/src/cmd/compile/internal/types2/call.go @@ -158,7 +158,7 @@ func (check *Checker) call(x *operand, call *syntax.CallExpr) exprKind { sig := asSignature(x.typ) if sig == nil { - check.invalidOpf(x, "cannot call non-function %s", x) + check.errorf(x, invalidOp+"cannot call non-function %s", x) x.mode = invalid x.expr = call return statement @@ -248,7 +248,7 @@ func (check *Checker) exprOrTypeList(elist []syntax.Expr) (xlist []*operand, ok } } if 0 < ntypes && ntypes < len(xlist) { - check.errorf(xlist[0], "mix of value and type expressions") + check.error(xlist[0], "mix of value and type expressions") ok = false } } |