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/internal/syntax: spurious 2nd syntax error in incorrect 'if' header #23406

Closed
griesemer opened this issue Jan 11, 2018 · 3 comments
Closed
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@griesemer
Copy link
Contributor

Parsing (go test -run Parse -src=x.go)

//+build ignore

package p

func bad() {
	if f()) {
		return
	}
}

results in:

parser_test.go:26: x.go:6:11: syntax error: unexpected ), expecting semicolon or newline
parser_test.go:26: x.go:6:11: syntax error: unexpected f, expecting { after if clause

The problem is due to an incorrectly set up variable when parsing statement headers.

The 2nd error is suppressed when using cmd/compile because it's on the same line.

@griesemer griesemer added the NeedsFix The path to resolution is known, but the work has not been done. label Jan 11, 2018
@griesemer griesemer added this to the Go1.11 milestone Jan 11, 2018
@griesemer griesemer self-assigned this Jan 11, 2018
@griesemer
Copy link
Contributor Author

See also #11377.

@gopherbot
Copy link

Change https://golang.org/cl/87317 mentions this issue: cmd/compile/internal/syntax: don't record semi position if there's none

@griesemer griesemer modified the milestones: Go1.11, Go1.10 Jan 11, 2018
@griesemer
Copy link
Contributor Author

Safe for 1.10.

@golang golang locked and limited conversation to collaborators Jan 11, 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

2 participants