From 157aae6eed1c092fd9e8ead3527185378eb828e1 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Wed, 31 Aug 2022 17:29:28 -0700 Subject: [PATCH] go/types, types2: establish type-checker specific local tests Establish testdata/local directory for tests that are not (yet) shared between the go/types and types2. Move issue47996.go into that directory. For #54511. Change-Id: I274b119990a93cc3657bdddc5246948699226c21 Reviewed-on: https://go-review.googlesource.com/c/go/+/426660 Reviewed-by: Robert Findley Auto-Submit: Robert Griesemer Run-TryBot: Robert Griesemer TryBot-Result: Gopher Robot Reviewed-by: Robert Griesemer --- src/cmd/compile/internal/types2/check_test.go | 3 ++- .../internal/types2/testdata/{ => local}/issue47996.go | 0 src/go/types/check_test.go | 1 + src/go/types/testdata/local/issue47996.go | 9 +++++++++ 4 files changed, 12 insertions(+), 1 deletion(-) rename src/cmd/compile/internal/types2/testdata/{ => local}/issue47996.go (100%) create mode 100644 src/go/types/testdata/local/issue47996.go diff --git a/src/cmd/compile/internal/types2/check_test.go b/src/cmd/compile/internal/types2/check_test.go index 8099b8b8d32..cce686ce669 100644 --- a/src/cmd/compile/internal/types2/check_test.go +++ b/src/cmd/compile/internal/types2/check_test.go @@ -305,7 +305,8 @@ func TestSpec(t *testing.T) { testDirFiles(t, "../../../../go/types/testdata func TestExamples(t *testing.T) { testDirFiles(t, "../../../../go/types/testdata/examples", 45, false) } // TODO(gri) narrow column tolerance func TestFixedbugs(t *testing.T) { testDirFiles(t, "../../../../go/types/testdata/fixedbugs", 100, false) -} // TODO(gri) narrow column tolerance +} // TODO(gri) narrow column tolerance +func TestLocal(t *testing.T) { testDirFiles(t, "testdata/local", 0, false) } func testDirFiles(t *testing.T, dir string, colDelta uint, manual bool) { testenv.MustHaveGoBuild(t) diff --git a/src/cmd/compile/internal/types2/testdata/issue47996.go b/src/cmd/compile/internal/types2/testdata/local/issue47996.go similarity index 100% rename from src/cmd/compile/internal/types2/testdata/issue47996.go rename to src/cmd/compile/internal/types2/testdata/local/issue47996.go diff --git a/src/go/types/check_test.go b/src/go/types/check_test.go index 8f7bbe4d0e2..3f68385ade7 100644 --- a/src/go/types/check_test.go +++ b/src/go/types/check_test.go @@ -362,6 +362,7 @@ func TestCheck(t *testing.T) { DefPredeclaredTestFuncs(); testDirFiles(t, "t func TestSpec(t *testing.T) { testDirFiles(t, "testdata/spec", false) } func TestExamples(t *testing.T) { testDirFiles(t, "testdata/examples", false) } func TestFixedbugs(t *testing.T) { testDirFiles(t, "testdata/fixedbugs", false) } +func TestLocal(t *testing.T) { testDirFiles(t, "testdata/local", false) } func testDirFiles(t *testing.T, dir string, manual bool) { testenv.MustHaveGoBuild(t) diff --git a/src/go/types/testdata/local/issue47996.go b/src/go/types/testdata/local/issue47996.go new file mode 100644 index 00000000000..4d289208238 --- /dev/null +++ b/src/go/types/testdata/local/issue47996.go @@ -0,0 +1,9 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package p + +// don't crash +// TODO(gri) make this test work for go/types +// func T[P] m() {}