Skip to content

Commit 7622e41

Browse files
committed
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 <[email protected]> Run-TryBot: Robert Findley <[email protected]> Reviewed-by: Robert Griesemer <[email protected]> TryBot-Result: Go Bot <[email protected]>
1 parent 3342aa5 commit 7622e41

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Copyright 2021 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
package issue48082
6+
7+
import "init" /* ERROR init must be a func */ /* ERROR could not import init */
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Copyright 2021 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
package issue48082
6+
7+
import "init" /* ERROR init must be a func */ /* ERROR could not import init */

0 commit comments

Comments
 (0)