aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types2/errors.go
AgeCommit message (Collapse)Author
2021-08-05[dev.typeparams] cmd/compile/internal/types2: cleanup panic callsRobert Griesemer
End-users are not expected to deal with the details of panics, so providing extra information such as an "internal error" prefix or the name of the function invoking the panic are not helpful. Remove unnecessary panic verbiage if it is readily available from a stack trace (such as the function where it happens, and the fact that is is an "internal error"). Change-Id: I5f86bae6d2cca7c04ce692d17257da7ddee206d7 Reviewed-on: https://go-review.googlesource.com/c/go/+/339969 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-07-26[dev.typeparams] cmd/compile/internal/types2: fix a bug in package ↵Robert Griesemer
qualification logic This is a partial port of https://golang.org/cl/330629, containing only the actual bug fix and adjustements to another test file. The respective test case has not been ported yet as it requires some bigger adjustments. For #46905 Change-Id: Ibd20658b8a31855da20cf56e24bcce9560656ca0 Reviewed-on: https://go-review.googlesource.com/c/go/+/336350 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> TryBot-Result: Go Bot <gobot@golang.org>
2021-04-28types2: disambiguate package qualifiers in error messagesRobert Griesemer
This is a port of the go/types CL https://golang.org/cl/313035 with minor adjustments (use of package syntax rather than go/ast). Change-Id: I89410efb3d27be85fdbe827f966c2c91ee5693b5 Reviewed-on: https://go-review.googlesource.com/c/go/+/314410 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-04-06cmd/compile/internal/types2: review of pos.go and move into syntax packageRobert Griesemer
This moves the two helper functions startPos and endPos into the syntax package where they belong. Export the functions and adjust dependent code. Change-Id: I8170faeadd7cfa8f53009f81fcffd50ec0fc6a98 Reviewed-on: https://go-review.googlesource.com/c/go/+/305578 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-04-03cmd/compile/internal/types2: review of errors.goRobert Griesemer
The changes between (equivalent, and reviewed) go/types/errors.go and errors.go can be seen by comparing patchset 1 and 2. The actual changes are removing the "// UNREVIEWED" marker. The go/types version is significantly different as it handles error codes but doesn't have some of the types2 changes. Change-Id: I48f79ce31490db938c830df7d38e247d55d54f2d Reviewed-on: https://go-review.googlesource.com/c/go/+/305577 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-03-13cmd/compile/internal/types2: simplify error reporting API (cleanup)Robert Griesemer
- 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>
2021-03-10cmd/compile/internal/types2: better error reporting framework (starting point)Robert Griesemer
Until now, errors which came with additional details (e.g., a declaration cycle error followed by the list of objects involved in the cycle, one per line) were reported as an ordinary error followed by "secondary" errors, with the secondary errors marked as such by having a tab-indented error message. This approach often required clients to filter these secondary errors (as they are not new errors, they are just clarifying a previously reported error). This CL introduces a new internal error_ type which permits accumulating various error information that may then be reported as a single error. Change-Id: I25b2f094facd37e12737e517f7ef8853d465ff77 Reviewed-on: https://go-review.googlesource.com/c/go/+/296689 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-01-08[dev.typeparams] cmd/compile/internal/syntax: remove ShortString, use String ↵Robert Griesemer
instead Follow-up on feedback by mdempsky@ in https://golang.org/cl/282552 . Change-Id: I1e5bb2d67cc8ae29fed100b87d18a33b3e2069eb Reviewed-on: https://go-review.googlesource.com/c/go/+/282672 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-01-08[dev.typeparams] cmd/compile/internal/types2: use syntax printer to print ↵Robert Griesemer
expressions The syntax package has a full-fledged node printer. Use that printer to create the expression strings needed in error messages, and remove the local (essentially) duplicate code for creating expression strings. Change-Id: I03673e5e79b3c1470f8073ebbe840a90fd9053ec Reviewed-on: https://go-review.googlesource.com/c/go/+/282553 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-12-07[dev.typeparams] cmd/compile/internal/types2: correct error position for ↵Robert Griesemer
inherited const init expression Enabled fixedbugs/issue8183.go for run.go with new typechecker now that issue is fixed. Fixes #42992. Updates #42991. Change-Id: I23451999983b740d5f37ce3fa75ee756daf1a44f Reviewed-on: https://go-review.googlesource.com/c/go/+/275517 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2020-10-27[dev.typeparams] cmd/compile: enable type-checking of generic codeRobert Griesemer
This change makes a first connection between the compiler and types2. When the -G flag is provided, the compiler accepts code using type parameters; with this change generic code is also type-checked (but then compilation ends). Change-Id: I0fa6f6213267a458a6b33afe8ff26869fd838a63 Reviewed-on: https://go-review.googlesource.com/c/go/+/264303 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-10-21[dev.typeparams] cmd/compile/internal/importer, types2: initial check-in of ↵Robert Griesemer
types2 and importer This is a copy of the importer and types2 (unreviewed) prototype version excluding the testdata directory containing tests (see below). Each file is marked with the comment // UNREVIEWED on the first line. The plan is to check in this code wholesale (it runs and passes all tests) and then review the code file-by-file via subsequent CLs and remove the "// UNREVIEWED" comments as we review the files. Since most tests are unchanged from the original go/types, the next CL will commit those tests as they don't need to be reviewed again. (Eventually we may want to factor them out and share them from a single place, e.g. the test directory.) The existing file fmtmap_test.go was updated. Change-Id: I9bd0ad1a7e7188b501423483a44d18e623c0fe71 Reviewed-on: https://go-review.googlesource.com/c/go/+/263624 Trust: Robert Griesemer <gri@golang.org> Trust: Keith Randall <khr@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>