Skip to content

cmd/compile: add and use yyerrorn #15913

@josharian

Description

@josharian

Lots of places in cmd/compile, we do:

setlineno(n)
Yyerror(...)

Sometimes we forget setlineno, and the error ends up on the wrong line, or it ends up on the right line but only because the global line number happens to be correct. Sometimes we do yyerrorl(n.Lineno instead, but that ignores the special handling found in setlineno; yyerrorl is really meant for use in the lexer, before we have a well-formed AST to work from. And the global line number will have to go away as part of #15756.

This issue is a reminder to myself to add yyerrorn that just wraps setlineno; Yyerror early in Go 1.8 and attempt to use it throughout the tree.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions