[dev.typeparams] go/types: fix panic with nil package name

This is a straightforward port of CL 320490 to go/types.

Change-Id: I763c806c777f926a563d8f9384764e5b3f7f083c
Reviewed-on: https://go-review.googlesource.com/c/go/+/324732
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-06-03 09:52:05 -04:00 committed by Robert Findley
parent cd6e9df446
commit e32fab145b

View file

@ -276,7 +276,7 @@ func (check *Checker) collectObjects() {
}
if name == "init" {
check.errorf(d.spec.Name, _InvalidInitDecl, "cannot import package as init - init must be a func")
check.errorf(d.spec, _InvalidInitDecl, "cannot import package as init - init must be a func")
return
}