-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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/parser: goto;
is incorrectly valid
#70957
Comments
Related Issues
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.) |
Actually, this looks like a bug in Lines 2051 to 2056 in 500675a
Will send a CL. |
go/src/cmd/compile/internal/syntax/parser.go Lines 2660 to 2667 in 500675a
|
Change https://go.dev/cl/638395 mentions this issue: |
@griesemer did you want this fix to land for 1.24? If so, shall we milestone accordingly? This also seems like it could wait for the tree to open. |
Change https://go.dev/cl/651155 mentions this issue: |
This test case is about to become a parse error. To allow us to submit the change to the parser, we must relax this test. Updates golang/go#71659 Updates golang/go#70957 Change-Id: Ic4fbfedb69d152d691dec41a94bb402149463f84 Reviewed-on: https://go-review.googlesource.com/c/tools/+/651155 Auto-Submit: Alan Donovan <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Robert Findley <[email protected]>
Change https://go.dev/cl/652977 mentions this issue: |
…relax test for CL 638395 This test case is about to become a parse error. To allow us to submit the change to the parser, we must relax this test. Updates golang/go#71659 Updates golang/go#70957 Change-Id: Ic4fbfedb69d152d691dec41a94bb402149463f84 Reviewed-on: https://go-review.googlesource.com/c/tools/+/651155 Auto-Submit: Alan Donovan <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Robert Findley <[email protected]> (cherry picked from commit d2fcd36) Reviewed-on: https://go-review.googlesource.com/c/tools/+/652977 Auto-Submit: Robert Findley <[email protected]> Reviewed-by: Hongxiang Jiang <[email protected]>
While poking around the
go/types
internals, i noticed that nothing really "type-checks"goto
s without labels.First pass:
go/src/go/types/stmt.go
Lines 578 to 608 in 500675a
Second pass:
go/src/go/types/labels.go
Lines 173 to 176 in 500675a
Also it also turns out that:
Is accepted by the
go/parser
. The spec disallowsgoto
s without labels, so we should either return an appropriate error ingo/types
orgo/parser
. Currentlygo/types
returns anInvalidSyntaxTree
error.go/src/go/types/stmt.go
Lines 605 to 607 in 500675a
CC @griesemer @adonovan
The text was updated successfully, but these errors were encountered: