]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.typeparams] cmd/compile: use r.hasTypeParams in typIdx
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Wed, 23 Jun 2021 16:56:01 +0000 (23:56 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Thu, 24 Jun 2021 11:47:47 +0000 (11:47 +0000)
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>
src/cmd/compile/internal/noder/reader.go

index df9dccc1569c5ce12f7218b50a431999fb712ee6..d2fe575ffd4d49493abc71abc454c3be6f50d12e 100644 (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
        }