-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: |
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: