]> Cypherpunks.ru repositories - gostls13.git/commit
go/types: merge Named type loading and expansion
authorRobert Findley <rfindley@google.com>
Fri, 10 Sep 2021 14:23:23 +0000 (10:23 -0400)
committerRobert Findley <rfindley@google.com>
Tue, 14 Sep 2021 23:20:18 +0000 (23:20 +0000)
commit2933c451a06ee0f97a698d1383cfbda988374137
tree7a8eedf01653c056789fd1ebc2729efc37d6d083
parent137543bb93e15286b54d58d17d51e609ed49339a
go/types: merge Named type loading and expansion

Named type expansion and loading were conceptually similar: a mechanism
for lazily resolving type information in a concurrency-safe manner.
Unify them into a 'resolve' method, that delegates to a resolver func to
produce type parameters, underlying, and methods.

By leveraging the sync.Once field on Named for instance expansion, we
get closer to making instance expansion concurrency-safe, and remove the
requirement that instPos guard instantiation. This will be cleaned up
in a follow-up CL.

This also fixes #47887 by causing substituted type instances to be
expanded (in the old code, this could be fixed by setting instPos when
substituting).

For #47910
Fixes #47887

Change-Id: Ifc52a420dde76e3a46ce494fea9bd289bc8aca4c
Reviewed-on: https://go-review.googlesource.com/c/go/+/349410
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/types/decl.go
src/go/types/instantiate.go
src/go/types/lookup.go
src/go/types/named.go
src/go/types/object.go
src/go/types/signature.go
src/go/types/subst.go
src/go/types/testdata/fixedbugs/issue47887.go2 [new file with mode: 0644]
src/go/types/type.go