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

cmd/compile: regression in recovery from malformed statement #13319

Closed
rsc opened this issue Nov 19, 2015 · 2 comments
Closed

cmd/compile: regression in recovery from malformed statement #13319

rsc opened this issue Nov 19, 2015 · 2 comments
Milestone

Comments

@rsc
Copy link
Contributor

rsc commented Nov 19, 2015

/tmp/xx.go:

package main

func f() {
    switch x {
    case 1:
        f(1, g()
    case 2:
        f()
    case 3:
        f(1, g()
    }
}

go tool compile -oldparser /tmp/xx.go: (yacc parser)

/tmp/xx.go:6: syntax error: unexpected semicolon or newline, expecting )
/tmp/xx.go:10: syntax error: unexpected semicolon or newline, expecting )

Note that it successfully got back on track and processed case 2 with no problems. It then found the next syntax error, namely the one in case 3.

go tool compile /tmp/xx.go: (new parser)

/tmp/xx.go:6: syntax error: need trailing comma before newline in argument list
/tmp/xx.go:7: syntax error: unexpected case, expecting expression
/tmp/xx.go:8: syntax error: unexpected f

It never recovers. The one syntax error produces three errors (only one of them real) and misses the later error.

@rsc rsc added this to the Go1.6 milestone Nov 19, 2015
@griesemer
Copy link
Contributor

In progress.

@gopherbot
Copy link

CL https://golang.org/cl/17080 mentions this issue.

@golang golang locked and limited conversation to collaborators Nov 27, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants