[dev.typeparams] cmd/compile: use r.hasTypeParams in typIdx

CL 329571 fold the checking has type params logic, but did not realize
that the instance in typIdx can be folded, too.

Change-Id: I4682af3779535af6a6e843972cada12ba1bae6ae
Reviewed-on: https://go-review.googlesource.com/c/go/+/330389
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Cuong Manh Le 2021-06-23 23:56:01 +07:00
parent 9bdbf73c98
commit b55cc6687d

View file

@ -345,7 +345,7 @@ func (pr *pkgReader) typIdx(idx int, implicits, explicits []*types.Type) *types.
// TODO(mdempsky): If we're clever, we should be able to still cache
// types by tracking which type parameters are used. However, in my
// attempts so far, I haven't yet succeeded in being clever enough.
if len(implicits)+len(explicits) == 0 {
if !r.hasTypeParams() {
pr.typs[idx] = typ
}