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/parser: improve recovery when parsing make(map[K]) #23434

Closed
alandonovan opened this issue Jan 12, 2018 · 4 comments
Closed

go/parser: improve recovery when parsing make(map[K]) #23434

alandonovan opened this issue Jan 12, 2018 · 4 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@alandonovan
Copy link
Contributor

The parser's error recovery is poor when it encounters a map type with a missing value type. (I observed that guru lacks information for all declarations downstream of such a mistake.) Here's an example:

https://play.golang.org/p/3XoDcWYw8vK

Notice how the introduction of any token at all before the close paren, even a nonsensical one such as !, causes the parser to reduce a CallExpr correctly and continue happily.

@titanous titanous added this to the Go1.11 milestone Jan 16, 2018
@titanous titanous added the NeedsFix The path to resolution is known, but the work has not been done. label Jan 16, 2018
@gopherbot
Copy link

Change https://golang.org/cl/87898 mentions this issue: go/parser: improved error recovery after missing type

@gopherbot
Copy link

Change https://golang.org/cl/87899 mentions this issue: go/parser: remove newly introduced TODO (cleanup)

@gopherbot
Copy link

Change https://golang.org/cl/87901 mentions this issue: cmd/compile/internal/syntax: better error recovery after missing type

@gopherbot
Copy link

Change https://golang.org/cl/88336 mentions this issue: cmd/compile/internal/syntax: added test cases for recent fixes

gopherbot pushed a commit that referenced this issue Feb 12, 2018
R=go1.11

No semantic change.

For #23434.

Change-Id: Iafdb062b0ebe6cd6e51f9a98b62b1d10f1bacc5c
Reviewed-on: https://go-review.googlesource.com/87899
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
gopherbot pushed a commit that referenced this issue Feb 12, 2018
R=go1.11.

This is just a copy of the fix for #23434:
https://go-review.googlesource.com/c/go/+/87898.

Test pending test harness for the syntax package.

Change-Id: I52409aebe13ec784ddd7e41190a81c7e126bdd0c
Reviewed-on: https://go-review.googlesource.com/87901
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
gopherbot pushed a commit that referenced this issue Feb 12, 2018
R=go1.11.

Now that we have a syntax error test harness, we can add the
proper tests for the recent parser fixes.

For #20800.
For #20789.
For #23385.
For #23434.

A test for #20789 already exists in test/fixedbugs, but this
is the better location for that test. But leaving the existing
one where it is as well.

Change-Id: I5937b9b63bafd1efab467a00344302e717976171
Reviewed-on: https://go-review.googlesource.com/88336
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
@golang golang locked and limited conversation to collaborators Feb 12, 2019
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