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, types2: need better mechanism to control lang version for tests #49074

griesemer opened this issue Oct 19, 2021 · 1 comment


Copy link

@griesemer griesemer commented Oct 19, 2021

Currently, the type checker uses two mechanisms to control the syntax and language version in tests: A test file may use the file extension .go2 which (at least for types2) enables type parameters in the syntax. A test package may also use an artificial package name (such as go1_12) to indicate to the type checker what -lang version to use for type-checking the package.

We may want to have a better mechanism to control this. We should probably use the ending .go (or .src) and always parse generic syntax. And perhaps we can use a comment mechanism (comment on first line) to control the -lang and other settings in a more systematic way.

Not urgent, but would be nice to address, possibly even during the freeze as it will affect tests only.

@griesemer griesemer added this to the Go1.18 milestone Oct 19, 2021
@griesemer griesemer self-assigned this Oct 19, 2021
Copy link

@gopherbot gopherbot commented Oct 19, 2021

Change mentions this issue: go/types, types2: always accept type parameters when running Manual test


gopherbot pushed a commit that referenced this issue Oct 19, 2021
This makes it easier to run tests on existing generic code that is
not using the `.go2` ending currently used by type checker tests.

For #49074.

Change-Id: I1501463c55dbe1d709918786e1a43b6d1bf1629a
Trust: Robert Griesemer <>
Run-TryBot: Robert Griesemer <>
Reviewed-by: Robert Findley <>
TryBot-Result: Go Bot <>
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