You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
go/parser: redundant error message with unexpected comma #24327
I’m confused. Your expected output isn’t sufficient (nothing after “found”).
Are you saying that it should not say a.go:11:37: missing ',' in argument list at all but the first message (a.go:6:4: expected operand, found ',') is OK?
Marking as unplanned. go/parser is likely falling behind the compiler due to the compiler's parser (package syntax) being actively improved whenever we run into unsatisfying error messages. It's fairly time-consuming to back-port those fixes because the parsers don't have the same structure, and small local changes sometimes have unexpected consequences with respect to error handling (hence those changes, even if small, are time-consuming to get right).
Ideally, in the long run we should migrate to package syntax. Failing that, one option might be to replace go/parser with the syntax package parser while keeping the same API. That might be not too hard since the syntax trees are reasonably close.
changed the title [-]go/printer: redundant error message with unexpected comma[/-][+]go/parser: redundant error message with unexpected comma[/+]on Apr 9, 2018
Activity
andybons commentedon Mar 9, 2018
I’m confused. Your expected output isn’t sufficient (nothing after “found”).
Are you saying that it should not say
a.go:11:37: missing ',' in argument listat all but the first message (a.go:6:4: expected operand, found ',') is OK?dotaheor commentedon Mar 10, 2018
yes.
I modified the expected output.
Looks the comment block doesn't matter for the redundant error message.
[-]cmd/fmt: imperfect error message[/-][+]cmd/fmt: redundant error message[/+]mvdan commentedon Mar 10, 2018
This is another case of go/parser being behind cmd/compile/internal/syntax in terms of reporting errors to humans.
I'll let @griesemer decide what to do.
[-]cmd/fmt: redundant error message[/-][+]go/printer: redundant error message with unexpected comma[/+]griesemer commentedon Apr 3, 2018
Marking as unplanned. go/parser is likely falling behind the compiler due to the compiler's parser (package syntax) being actively improved whenever we run into unsatisfying error messages. It's fairly time-consuming to back-port those fixes because the parsers don't have the same structure, and small local changes sometimes have unexpected consequences with respect to error handling (hence those changes, even if small, are time-consuming to get right).
Ideally, in the long run we should migrate to package syntax. Failing that, one option might be to replace go/parser with the syntax package parser while keeping the same API. That might be not too hard since the syntax trees are reasonably close.
[-]go/printer: redundant error message with unexpected comma[/-][+]go/parser: redundant error message with unexpected comma[/+]gopherbot commentedon Apr 8, 2021
Change https://golang.org/cl/308612 mentions this issue:
go/parser: improve error recovery in parseOperand