summaryrefslogtreecommitdiff
path: root/src/go/types/index.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2022-10-10 13:55:40 -0700
committerGopher Robot <gobot@golang.org>2022-10-12 23:00:28 +0000
commit19095e109d0ae037828c519dda0af307b8a01813 (patch)
tree1a7744708931a1adaa3bbe3faaae5587eb3736a5 /src/go/types/index.go
parent1a7f08cf408ff4c4f05be25839a0d7c5ec28ed05 (diff)
downloadgo-git-19095e109d0ae037828c519dda0af307b8a01813.tar.gz
go/types, types2: remove need for invalidAST prefix in error calls
Since we already provide the error code, the prefix can be deduced automatically. Except for the changes in errors.go, the updates were made with regex find-and-replaces: check\.error\((.+), InvalidSyntaxTree, invalidAST\+ => check.error($1, InvalidSyntaxTree, check\.errorf\((.+), InvalidSyntaxTree, invalidAST\+ => check.errorf($1, InvalidSyntaxTree, Change-Id: Ia02fc56ac7a8524bdf0c404ff2696435408327e9 Reviewed-on: https://go-review.googlesource.com/c/go/+/441975 Run-TryBot: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/go/types/index.go')
-rw-r--r--src/go/types/index.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/go/types/index.go b/src/go/types/index.go
index e1ce74ff9f..45d591e31c 100644
--- a/src/go/types/index.go
+++ b/src/go/types/index.go
@@ -276,7 +276,7 @@ func (check *Checker) sliceExpr(x *operand, e *ast.SliceExpr) {
// spec: "Only the first index may be omitted; it defaults to 0."
if e.Slice3 && (e.High == nil || e.Max == nil) {
- check.error(inNode(e, e.Rbrack), InvalidSyntaxTree, invalidAST+"2nd and 3rd index required in 3-index slice")
+ check.error(inNode(e, e.Rbrack), InvalidSyntaxTree, "2nd and 3rd index required in 3-index slice")
x.mode = invalid
return
}
@@ -331,7 +331,7 @@ L:
// is reported and the result is nil.
func (check *Checker) singleIndex(expr *typeparams.IndexExpr) ast.Expr {
if len(expr.Indices) == 0 {
- check.errorf(expr.Orig, InvalidSyntaxTree, invalidAST+"index expression %v with 0 indices", expr)
+ check.errorf(expr.Orig, InvalidSyntaxTree, "index expression %v with 0 indices", expr)
return nil
}
if len(expr.Indices) > 1 {