]> Cypherpunks.ru repositories - gostls13.git/commit
go/types: don't set a Config.Context if none is provided
authorRobert Findley <rfindley@google.com>
Wed, 10 Nov 2021 21:52:17 +0000 (16:52 -0500)
committerRobert Findley <rfindley@google.com>
Sat, 13 Nov 2021 00:49:51 +0000 (00:49 +0000)
commit530e320b2a9ed08f2bba39507b877fd66352d7ca
treecfcdfd0600129586fdf740d4672aad15a4154e11
parent958f405371d942d988aef325b2103fa64028af45
go/types: don't set a Config.Context if none is provided

Users can re-use a type checking context by passing it via types.Config.
There is no need for us to expose the internal type checking context
when the config context is unset, and in fact doing so could lead to a
memory leak for users that re-use types.Config, expecting it to be small
and immutable.

Keep track of the Context on Checker instead, and zero it out at the end
of type checking.

Change-Id: Iff5b328a09cd0af76fcd4869f5f15352131b5986
Reviewed-on: https://go-review.googlesource.com/c/go/+/363175
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/call.go
src/go/types/check.go
src/go/types/decl.go
src/go/types/named.go
src/go/types/signature.go
src/go/types/typexpr.go