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: provide configuration support for different language versions #31793

Closed
griesemer opened this issue May 2, 2019 · 9 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@griesemer
Copy link
Contributor

go/types accepts the latest language spec. The compiler (cmd/compile) has a -lang flag to control the accepted language. Specifically, with -lang=go1.12, the new language features introduced with Go 1.13 are not supported. See #31747 .

Do we need an equivalent "flag" (Config field) to control the accepted language by go/types?

cc: @rsc

@griesemer griesemer added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label May 2, 2019
@griesemer griesemer added this to the Go1.13 milestone May 2, 2019
@griesemer
Copy link
Contributor Author

If we remove such a configuration flag, we can enable the test "issue31747.go" (in go/types/stdlib_test.go) again. See CL https://golang.org/cl/174897.

@andybons andybons added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. labels May 14, 2019
@andybons andybons assigned andybons and griesemer and unassigned andybons May 14, 2019
@griesemer griesemer modified the milestones: Go1.13, Go1.14 May 14, 2019
@rsc rsc modified the milestones: Go1.14, Backlog Oct 9, 2019
@griesemer
Copy link
Contributor Author

Relevant compiler tests:

$GOROOT/test/fixedbugs/issue31747.go 
$GOROOT/test/fixedbugs/issue34329.go

@griesemer griesemer modified the milestones: Backlog, Go1.17 Feb 3, 2021
@griesemer griesemer changed the title go/types: do we need the equivalent of a cmd/compile -lang flag? go/types, types2: provide configuration support for different language versions Feb 3, 2021
@gopherbot
Copy link

Change https://golang.org/cl/289509 mentions this issue: [dev.typeparams] cmd/compile/internal/types2: add support for language version checking

gopherbot pushed a commit that referenced this issue Feb 4, 2021
…e 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>
@gopherbot
Copy link

Change https://golang.org/cl/289570 mentions this issue: [dev.typeparams] cmd/compile/internal/types2: type alias decl requires go1.9

gopherbot pushed a commit that referenced this issue Feb 4, 2021
…s go1.9

Add respective check to type checker.
Remove respective check from the compiler's new type2-based noder.

Updates #31793.

Change-Id: I907e3acab4c136027a8c3db1e9bac301d209c2e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/289570
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
@gopherbot
Copy link

Change https://golang.org/cl/290911 mentions this issue: [dev.typeparams] cmd/compile/internal/types2: overlapping embedded interfaces requires go1.4

gopherbot pushed a commit that referenced this issue Feb 10, 2021
…terfaces requires go1.14

Add respective check to type checker.
Enables another excluded test in test/run.go.

This CL completes the currently required checks for
language compatibility in types2.

Updates #31793.

Change-Id: Icececff9e6023d38f600c93bcb54cdcafcf501b9
Reviewed-on: https://go-review.googlesource.com/c/go/+/290911
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
@gopherbot
Copy link

Change https://golang.org/cl/291317 mentions this issue: [dev.regabi] go/types: add support for language version checking

@gopherbot
Copy link

Change https://golang.org/cl/291319 mentions this issue: [dev.regabi] go/types: overlapping embedded interfaces requires go1.14

@gopherbot
Copy link

Change https://golang.org/cl/291318 mentions this issue: [dev.regabi] go/types: type alias decl requires go1.9

gopherbot pushed a commit that referenced this issue Feb 13, 2021
This is a port of CL 289509 to go/types. It differs from that CL in
codes added to errors, to fit the new factoring of check_test.go, and to
allow go/types to import regexp in deps_test.go

For #31793

Change-Id: Ia9e4c7f5aac1493001189184227c2ebc79a76e77
Reviewed-on: https://go-review.googlesource.com/c/go/+/291317
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>
gopherbot pushed a commit that referenced this issue Feb 16, 2021
This is a port of CL 289570 to go/types. It has some notable differences
with that CL:
 + A new _BadDecl error code is added, to indicate declarations with bad
   syntax.
 + declInfo is updated hold not an 'alias' bool, but an aliasPos
   token.Pos to identify the location of the type aliasing '=' token.
   This allows for error messages to be accurately placed on the '='

For #31793

Change-Id: Ib15969f9cd5be30228b7a4c6406f978d6fc58018
Reviewed-on: https://go-review.googlesource.com/c/go/+/291318
Trust: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
gopherbot pushed a commit that referenced this issue Feb 16, 2021
This is an exact port of CL 290911 to go/types.

For #31793

Change-Id: I28c42727735f467a5984594b455ca58ab3375591
Reviewed-on: https://go-review.googlesource.com/c/go/+/291319
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>
@griesemer
Copy link
Contributor Author

With the reverse merge of dev.typeparams into master, this is now fixed.

@golang golang locked and limited conversation to collaborators Feb 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants