]> Cypherpunks repositories - gostls13.git/commit
go/types: add a NewSignatureType constructor accepting type parameters
authorRobert Findley <rfindley@google.com>
Mon, 27 Sep 2021 23:23:17 +0000 (19:23 -0400)
committerRobert Findley <rfindley@google.com>
Tue, 28 Sep 2021 15:20:51 +0000 (15:20 +0000)
commit5511f14a735736e88c5fc832975f9b27244c56e1
tree6bb7d6bf86f9b3ace47607ab60cebd3fd6d04029
parent534dfb2aeb0721eeedb847e0d60785da8ac13315
go/types: add a NewSignatureType constructor accepting type parameters

In #47916, consensus has emerged that adding a new constructor is
preferable to using setters for type parameters. This is more consistent
with the rest of the type API, which is immutable except in cases where
mutation is necessary to break cycles (such as Named.SetUnderlying).

This CL adds a new constructor NewSignatureType that accepts type
parameters and receiver type parameters, deprecating the existing
NewSignature constructor. SetTypeParams and SetRecvTypeParams are not
yet removed: this will be done in a follow-up CL once x/tools no longer
has a dependency on the old APIs.

Updates #47916

Change-Id: I9d04dcfd304344d2aa08e527b371c3faa9d738e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/352615
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>
src/go/internal/gcimporter/iimport.go
src/go/types/signature.go