]> Cypherpunks.ru repositories - gostls13.git/commit
[dev.typeparams] cmd/compile/internal/types2: add support for language version checking
authorRobert Griesemer <gri@golang.org>
Wed, 3 Feb 2021 22:56:13 +0000 (14:56 -0800)
committerRobert Griesemer <gri@golang.org>
Thu, 4 Feb 2021 22:20:33 +0000 (22:20 +0000)
commit1ff2fdaaf189e0d7ec73bdbff72558363239f48b
tree42512eabd1fa092e171cc296c2d1cfad86ec6220
parent370e9f58432c51bf3d95308cdc7109e25cc141f6
[dev.typeparams] cmd/compile/internal/types2: add support for language version checking

Add the Config.Lang field which may be set to a Go version string,
such as "go1.12". This is a string rather than explicit semantic
version numbers (such as {1, 12}) for API robustness; a string
is more flexible should we need more or different information.

Add -lang flag to types2 package for use with (manual) testing
when running "go test -run Check$ -lang=... -files=...".

While changing flags, look for comma-separated (rather than space-
separated) files when providing the -file flag.

Check that numeric constant literals, signed shift counts are
accepted according to the selected language version.

Type alias declarations and overlapping embedded interfaces are
not yet checked.

Updates #31793.

Change-Id: I9ff238ed38a88f377eb2267dc3e8816b89a40635
Reviewed-on: https://go-review.googlesource.com/c/go/+/289509
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
src/cmd/compile/internal/types2/api.go
src/cmd/compile/internal/types2/check.go
src/cmd/compile/internal/types2/check_test.go
src/cmd/compile/internal/types2/expr.go
src/cmd/compile/internal/types2/stdlib_test.go
src/cmd/compile/internal/types2/testdata/go1_12.src [new file with mode: 0644]
src/cmd/compile/internal/types2/version.go [new file with mode: 0644]