-
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/ast: End() for *BlockStmt incorrect when there is no closing brace #33649
Comments
Thanks for the nice test case. I looked at this a bit and it's not obviously clear (to me) what the correct solution is here. I suppose we don't want an One way of handling this in the parser is to assume that the position of a missing token is the current position minus the length of the missing token - then, any correction made by the @myitcv What is the specific use case where this poses a problem? Perhaps this can help identifying a good solution. |
Actually, the correct fix would probably be to not record a position for the closing The same problem affects a few other nodes as well. |
The use case is providing AST-oriented motions within an editor, in this case Vim using
Given the use case I've described, I agree this sounds correct. |
Change https://golang.org/cl/202581 mentions this issue: |
Change https://golang.org/cl/204041 mentions this issue: |
This is a follow-up on https://golang.org/cl/202581. Updates #33649. Change-Id: Ib078fed983792c5493bdbed6d33e21b86856894a Reviewed-on: https://go-review.googlesource.com/c/go/+/204041 Run-TryBot: Robert Griesemer <gri@golang.org> Run-TryBot: Rebecca Stambler <rstambler@golang.org> Reviewed-by: Rebecca Stambler <rstambler@golang.org>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
https://play.golang.org/p/A56nT3ypuyJ
What did you expect to see?
What did you see instead?
cc @griesemer
FYI @rogpeppe @mvdan
The text was updated successfully, but these errors were encountered: