aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types2/check_test.go
AgeCommit message (Collapse)Author
2021-08-26cmd/compile/internal/types2: address some TODOs (cleanup)Robert Griesemer
- Address some easy TODOs. - Remove some TODOs that are not correct anymore or are unimportent. - Simplify some code on the way. Change-Id: I4d20de3725b3a735022afe022cbc002b2798936d Reviewed-on: https://go-review.googlesource.com/c/go/+/345176 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-05-05cmd/compile/internal/types2: make TestManual work for directoriesRobert Griesemer
If no source argument is provided, test testdata/manual.go2 instead. Remove testdata/check/tmp/go2 in favor of testdata/manual.go2. These changes affect testing only. Change-Id: I49aba4d8fc4cc5964911e38c55b4c5d013710aeb Reviewed-on: https://go-review.googlesource.com/c/go/+/315769 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-04-30cmd/compile/internal/types2: list errors by default in TestManualRobert Griesemer
TestManual is used for debugging; in this case we usually want to see error messages reported rather than checked against ERROR comments in the provided files. Make this the default. Use the new -verify flag to verify reported errors against ERROR comments. With this change we cannot get an error list for the non-manual tests, but that is usually not useful anyway because there are usually many errors in those test files. Run those tests manually instead. Also, corrected -lang flag synopsys: it applies to all tests, not just TestManual. Change-Id: I56e0ea0583840fc3ea150d9ccfc330370b66191c Reviewed-on: https://go-review.googlesource.com/c/go/+/315729 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-04-30cmd/compile/internal/types2: simplify use of TestManualRobert Griesemer
Running the TestManual test (for manual debugging) requires user-provided files as input. Rather than using another flag (-files) to provide these files, just use the (remaining) command line arguments. Change-Id: I9b20d9f1a6a7ce839bbd690c311ce3f0d0a10496 Reviewed-on: https://go-review.googlesource.com/c/go/+/315689 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-04-29cmd/compile/internal/types2: nest all test data under the testdata directoryRobert Griesemer
This matches https://golang.org/cl/314829 for go/types. Change-Id: If3d127af0557bb13d504581920ea03e39db0eb07 Reviewed-on: https://go-review.googlesource.com/c/go/+/314772 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-04-23cmd/compile/internal/types2: add unsafe.Add and unsafe.SliceMatthew Dempsky
This is a port of CL 312212, CL 312591 (except check_test.go), and CL 312790 to types2. Updates #19367. Updates #40481. Change-Id: I58ba0b0dad157baba3f82c909d5eb1268b931be4 Reviewed-on: https://go-review.googlesource.com/c/go/+/312511 Trust: Matthew Dempsky <mdempsky@google.com> Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
2021-04-07cmd/compile/internal/types2: process errors in src order during testingRobert Griesemer
Follow-up on https://golang.org/cl/305573. As a consequence, re-enable test case that caused problems with that CL. Change-Id: Ibffee3f016f4885a55b8e527a5680dd437322209 Reviewed-on: https://go-review.googlesource.com/c/go/+/307216 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-04-07cmd/compile/internal/types2: remove Config.AcceptMethodTypeParams flagRobert Griesemer
Type parameters for methods are not part of the accepted language, but maintaining the code for type-checking them ensures regularity of the type checker implementation. For now, keep the flag internally, disabled by default. The flag is set when running tests. Change-Id: Ic99934bd00bd2608dc1178e4131f46dd1507f0f5 Reviewed-on: https://go-review.googlesource.com/c/go/+/307214 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-04-07cmd/compile/internal/types2: remove Config.InferFromConstraints flagRobert Griesemer
Constraint type inference is part of the proposed language. Use an internal flag to control the feayure for debugging. Change-Id: I7a9eaee92b5ffc23c25d9e68a729acc0d705e879 Reviewed-on: https://go-review.googlesource.com/c/go/+/306770 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-04-03cmd/compile/internal/types2: review of check_test.goRobert Griesemer
The changes between (equivalent, and reviewed) go/types/check_test.go and check_test.go can be seen by comparing patchset 1 and 2. The actual changes are removing the "// UNREVIEWED" marker, and minor adjustments to get the code slightly closer to go/types/check_test.go. The primary differences compared to go/types are: - use of syntax rather than go/ast package - re-implemented mechanism for error matching and elimination based on the syntax.ErrorMap mechanism (there's no exported access to the syntax scanner) - error matching permits for column tolerances because types2 column information doesn't match go/types column information Change-Id: I8ae6bc93dfa2b517673b642064a1f09166755286 Reviewed-on: https://go-review.googlesource.com/c/go/+/305573 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@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-02-04[dev.typeparams] cmd/compile/internal/types2: add support for language ↵Robert Griesemer
version checking Add the Config.Lang field which may be set to a Go version string, such as "go1.12". This is a string rather than explicit semantic version numbers (such as {1, 12}) for API robustness; a string is more flexible should we need more or different information. Add -lang flag to types2 package for use with (manual) testing when running "go test -run Check$ -lang=... -files=...". While changing flags, look for comma-separated (rather than space- separated) files when providing the -file flag. Check that numeric constant literals, signed shift counts are accepted according to the selected language version. Type alias declarations and overlapping embedded interfaces are not yet checked. Updates #31793. Change-Id: I9ff238ed38a88f377eb2267dc3e8816b89a40635 Reviewed-on: https://go-review.googlesource.com/c/go/+/289509 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-01-19[dev.typeparams] cmd/compile/internal/types: minor fixes/cleanups around testingRobert Griesemer
Also, implemented isConstType predicate in terms of "is" predicate. Change-Id: Ib3b311f52196dba974802348bc6d63307530d915 Reviewed-on: https://go-review.googlesource.com/c/go/+/284217 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2020-12-27[dev.typeparams] cmd/compile: re-enable internal/types2 testRuss Cox
CL 279531 disabled these because they were causing trouble with the automation for the big move. The big move is over. Reenable them. Change-Id: I2b06f619a114ebcc9b9af73ce0d5b68ebaeaac03 Reviewed-on: https://go-review.googlesource.com/c/go/+/279993 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-12-23[dev.typeparams] cmd/compile/internal/types2: disable external test temporarilyRuss Cox
This is making rf unhappy for extremely subtle reasons, so for now just disable the external test here. Will reenable once the big rewrite is done. Change-Id: Ifd1ba95e2843792427629d1660850fe531cdd0b9 Reviewed-on: https://go-review.googlesource.com/c/go/+/279531 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org>
2020-10-21[dev.typeparams] cmd/compile/internal/types2: adjust tests, enable Testdata ↵Robert Griesemer
tests Types2 uses a different test runner and has fewer/better errors in some cases (error messages match the compiler). Adjust the tests and enable them. Change-Id: I74877f54a81a3918a80774452cef5bcaad8a98e6 Reviewed-on: https://go-review.googlesource.com/c/go/+/263631 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>