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

Open
griesemer opened this issue Oct 19, 2021 · 1 comment
Open
Assignees
Milestone

Comments

@griesemer
Copy link
Contributor

@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
@gopherbot
Copy link

@gopherbot gopherbot commented Oct 19, 2021

Change https://golang.org/cl/357050 mentions this issue: go/types, types2: always accept type parameters when running Manual test

Loading

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
Reviewed-on: https://go-review.googlesource.com/c/go/+/357050
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants