Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/types: add tests that exercise concurrent use #47729

findleyr opened this issue Aug 16, 2021 · 1 comment

go/types: add tests that exercise concurrent use #47729

findleyr opened this issue Aug 16, 2021 · 1 comment


Copy link

@findleyr findleyr commented Aug 16, 2021

x/tools has tests that exercise concurrent use of go/types, but go/types itself does not. With the various lazy operations in go/types, it is easy to introduce race conditions. This has bitten us several times in the past (#47726, #47345, #44434, from recent memory).

We should add tests that exercise valid concurrent use of go/types.

CC @griesemer

Copy link

@gopherbot gopherbot commented Sep 12, 2021

Change mentions this issue: go/types: eliminate Named.instPos

gopherbot pushed a commit that referenced this issue Sep 14, 2021
We no longer need to use the nilness of Named.instPos to signal whether
instance expansion has occurred, so remove it from the Named struct by
instead closing over the instantiation position in the resolver.

This means we cannot print instance markers for unexpanded instances:
instances may escape the type checking pass without being fully
expanded, and we can not check whether they have been expanded in a
concurrency-safe way without introducing a more heavy-weight
syncronization mechanism.

With this change, instantiation should be concurrency safe, modulo bugs
of course as we have little test coverage of concurrency (see #47729).

Fixes #47910

Change-Id: Ifeef6df296f00105579554b333a44d08aae113c9
Trust: Robert Findley <>
Run-TryBot: Robert Findley <>
TryBot-Result: Go Bot <>
Reviewed-by: Robert Griesemer <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants