]> Cypherpunks.ru repositories - gostls13.git/commitdiff
go/types: delete unnecessary slice construction
authorRobert Findley <rfindley@google.com>
Fri, 18 Feb 2022 14:19:47 +0000 (09:19 -0500)
committerRobert Findley <rfindley@google.com>
Wed, 23 Feb 2022 19:46:34 +0000 (19:46 +0000)
CL 374294 made our check for incorrect type parameters constraints
eager, but failed to remove the construction of the bounds slice, which
was no longer used.

Change-Id: Ib8778fba947ef8a8414803e95d72c49b8f75c204
Reviewed-on: https://go-review.googlesource.com/c/go/+/386717
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/cmd/compile/internal/types2/decl.go
src/go/types/decl.go

index 0e8f5085ba130c15aede6912b6830a2c69816e46..579fa55e5911888b06090503f0ef95f5e1f37664 100644 (file)
@@ -569,7 +569,6 @@ func (check *Checker) collectTypeParams(dst **TypeParamList, list []*syntax.Fiel
 
        // Keep track of bounds for later validation.
        var bound Type
-       var bounds []Type
        for i, f := range list {
                // Optimization: Re-use the previous type bound if it hasn't changed.
                // This also preserves the grouped output of type parameter lists
@@ -584,7 +583,6 @@ func (check *Checker) collectTypeParams(dst **TypeParamList, list []*syntax.Fiel
                                check.error(f.Type, "cannot use a type parameter as constraint")
                                bound = Typ[Invalid]
                        }
-                       bounds = append(bounds, bound)
                }
                tparams[i].bound = bound
        }
index cd6f709a56a7f8089ea60d12e8c117f8665b72ce..93a37d76ce0d78021708de8ae7806e41f205d85a 100644 (file)
@@ -624,7 +624,6 @@ func (check *Checker) collectTypeParams(dst **TypeParamList, list *ast.FieldList
        }()
 
        index := 0
-       var bounds []Type
        for _, f := range list.List {
                var bound Type
                // NOTE: we may be able to assert that f.Type != nil here, but this is not
@@ -642,7 +641,6 @@ func (check *Checker) collectTypeParams(dst **TypeParamList, list *ast.FieldList
                } else {
                        bound = Typ[Invalid]
                }
-               bounds = append(bounds, bound)
                for i := range f.Names {
                        tparams[index+i].bound = bound
                }