]> Cypherpunks.ru repositories - gostls13.git/commit
go/types, types2: generalize cleanup phase after type checking
authorRobert Griesemer <gri@golang.org>
Tue, 22 Feb 2022 21:06:52 +0000 (13:06 -0800)
committerRobert Griesemer <gri@golang.org>
Wed, 23 Feb 2022 20:51:28 +0000 (20:51 +0000)
commite94f7df957b6cfbdfbed7092fd05628452c5e018
tree81afdd2d2568944533718742f998f1e59002c898
parent163da6feb525a98dab5c1f01d81b2c705ead51ea
go/types, types2: generalize cleanup phase after type checking

Use a cleanup method and simple registration mechanism
for types that need some final processing before the end
of type checking.

Use cleanup mechanism instead of expandDefTypes mechanism
for *Named types. There is no change in functionality here.

Use cleanup mechanism also for TypeParam and Interface types
to ensure that their check fields are nilled out at the end.

Introduce a simple constructor method for Interface types
to ensure that the cleanup method is always registered.

In go/types, add tracing code to Checker.checkFiles to match
types2.

Minor comment adjustments.

Fixes #51316.
Fixes #51326.

Change-Id: I7b2bd79cc419717982f3c918645af623c0e80d5e
Reviewed-on: https://go-review.googlesource.com/c/go/+/387417
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
12 files changed:
src/cmd/compile/internal/types2/check.go
src/cmd/compile/internal/types2/interface.go
src/cmd/compile/internal/types2/named.go
src/cmd/compile/internal/types2/subst.go
src/cmd/compile/internal/types2/typeparam.go
src/cmd/compile/internal/types2/typexpr.go
src/go/types/check.go
src/go/types/interface.go
src/go/types/named.go
src/go/types/subst.go
src/go/types/typeparam.go
src/go/types/typexpr.go