]> Cypherpunks repositories - gostls13.git/commit
types2: provide error codes to error reporting
authorRobert Griesemer <gri@golang.org>
Thu, 8 Sep 2022 01:45:09 +0000 (18:45 -0700)
committerGopher Robot <gobot@golang.org>
Tue, 13 Sep 2022 12:37:11 +0000 (12:37 +0000)
commitf4a587ba6e5c5195152f47afee2700664524c11e
treed88c31f63a156da0808984b70c39761f3c199c7f
parent54182ff54a687272dd7632c3a963e036ce03cb7c
types2: provide error codes to error reporting

This CL adds a suitable error code to every error reporting,
matching what go/types already does.

For now, the error codes are not progagated through the API,
but eventually they will be available to clients.

Also, for now the errorcodes.go file is a 1:1 copy (with
adjusted package name) of go/types/errorcodes.go.
A subsequent CL will factor out this file.

In contrast to go/types, for errors due to incorrect Go version,
the error code is always _UnsupportedFeature. In go/types, the
error sometimes is related to the specific operation.

Change-Id: I18771bc3d00bbdbf6d705bf25f2aea3c3d977b1c
Reviewed-on: https://go-review.googlesource.com/c/go/+/429355
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
20 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/errorcodes.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/index.go
src/cmd/compile/internal/types2/infer.go
src/cmd/compile/internal/types2/instantiate.go
src/cmd/compile/internal/types2/interface.go
src/cmd/compile/internal/types2/labels.go
src/cmd/compile/internal/types2/resolver.go
src/cmd/compile/internal/types2/signature.go
src/cmd/compile/internal/types2/stmt.go
src/cmd/compile/internal/types2/struct.go
src/cmd/compile/internal/types2/typeset.go
src/cmd/compile/internal/types2/typexpr.go
src/cmd/compile/internal/types2/union.go