]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile/internal/types2: simplify error reporting API (cleanup)
authorRobert Griesemer <gri@golang.org>
Fri, 12 Mar 2021 00:34:01 +0000 (16:34 -0800)
committerRobert Griesemer <gri@golang.org>
Sat, 13 Mar 2021 00:38:58 +0000 (00:38 +0000)
commit16ad1ea8417bb842204bf7c982e3f19969b67458
tree60e0ca42041744743a37134d821cf735a8c16189
parent7b47f9a5f2092dcbc1546304f1f1b739883fa4c4
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>
13 files changed:
src/cmd/compile/internal/types2/assignments.go
src/cmd/compile/internal/types2/builtins.go
src/cmd/compile/internal/types2/call.go
src/cmd/compile/internal/types2/check.go
src/cmd/compile/internal/types2/decl.go
src/cmd/compile/internal/types2/errorcalls_test.go [new file with mode: 0644]
src/cmd/compile/internal/types2/errors.go
src/cmd/compile/internal/types2/expr.go
src/cmd/compile/internal/types2/labels.go
src/cmd/compile/internal/types2/resolver.go
src/cmd/compile/internal/types2/stmt.go
src/cmd/compile/internal/types2/typexpr.go
src/cmd/compile/internal/types2/version.go