From: Robert Findley Date: Mon, 30 Aug 2021 21:40:45 +0000 (-0400) Subject: go/types, types2: add a test for invalid import of "init" X-Git-Tag: go1.18beta1~1567 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=7622e41c84fd9bb003a2d905b9f0545344842c3a;p=gostls13.git go/types, types2: add a test for invalid import of "init" This error reporting code path did not have test coverage, and panics in 1.17 (filed as #48082). Add a test that would have reproduced the panic, for both go/types and cmd/compile/internal/types2. Change-Id: Icd5f54f8407e4ab57d432f44a129ecf6b2755feb Reviewed-on: https://go-review.googlesource.com/c/go/+/346309 Trust: Robert Findley Run-TryBot: Robert Findley Reviewed-by: Robert Griesemer TryBot-Result: Go Bot --- diff --git a/src/cmd/compile/internal/types2/testdata/fixedbugs/issue48082.src b/src/cmd/compile/internal/types2/testdata/fixedbugs/issue48082.src new file mode 100644 index 0000000000..5395154978 --- /dev/null +++ b/src/cmd/compile/internal/types2/testdata/fixedbugs/issue48082.src @@ -0,0 +1,7 @@ +// 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 issue48082 + +import "init" /* ERROR init must be a func */ /* ERROR could not import init */ diff --git a/src/go/types/testdata/fixedbugs/issue48082.src b/src/go/types/testdata/fixedbugs/issue48082.src new file mode 100644 index 0000000000..5395154978 --- /dev/null +++ b/src/go/types/testdata/fixedbugs/issue48082.src @@ -0,0 +1,7 @@ +// 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 issue48082 + +import "init" /* ERROR init must be a func */ /* ERROR could not import init */