1
0
mirror of https://github.com/golang/go synced 2024-11-26 05:48:05 -07:00

cmd/dist: add tests using the typeparams build tag

Now that go/ast changes have been guarded behind the typeparams build
tag, we no longer have coverage for tests involving generic code.

Add a new testing step to cmd/dist to run go/... and cmd/gofmt tests
using -tags=typeparams.

Comment out parser object resolution assertions that currently fail, and
which will be fixed by CL 304456.

Fixes #44933

Change-Id: I481dd4246a016f410307865b6c6c2bb3c8e6e3bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/310071
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
Rob Findley 2021-04-14 10:52:30 -04:00 committed by Robert Findley
parent bcbde83c20
commit 283f9fdbd3
2 changed files with 18 additions and 4 deletions

13
src/cmd/dist/test.go vendored
View File

@ -475,6 +475,19 @@ func (t *tester) registerTests() {
})
}
// Test go/... cmd/gofmt with type parameters enabled.
if !t.compileOnly {
t.tests = append(t.tests, distTest{
name: "tyepparams",
heading: "go/... and cmd/gofmt tests with tag typeparams",
fn: func(dt *distTest) error {
t.addCmd(dt, "src", t.goTest(), t.timeout(300), "-tags=typeparams", "go/...")
t.addCmd(dt, "src", t.goTest(), t.timeout(300), "-tags=typeparams", "cmd/gofmt")
return nil
},
})
}
if t.iOS() && !t.compileOnly {
t.tests = append(t.tests, distTest{
name: "x509omitbundledroots",

View File

@ -18,7 +18,8 @@ type Addable /* =@Addable */ interface {
}
// TODO (#45221): resolve references to T in the signature below.
func Add /* =@AddDecl */[T /* =@T */ Addable /* @Addable */](l /* =@l */, r /* =@r */ T) T {
var t /* =@t */ T /* @T */
return l /* @l */ + r /* @r */ + t /* @t */
}
// TODO(rFindley): re-enable these once type parameter resolution is fixed.
// func Add /* =@AddDecl */[T /* =@T */ Addable /* @Addable */](l /* =@l */, r /* =@r */ T) T {
// var t /* =@t */ T /* @T */
// return l /* @l */ + r /* @r */ + t /* @t */
// }