Skip to content

Commit

Permalink
cmd/compile/internal/gc: add dropped line correction again
Browse files Browse the repository at this point in the history
The line correction when reporting a missing package clause
was removed before since it wasn't clear that it was needed.
Added it again because of issue 13267.

No explicit test case has been added to test/fixedbugs because
it would require a file that contains a single byte and such a
file doesn't fit the existing test harness. Instead documented
the problematic line in the parser for future reference.

Fixes #13267.

Change-Id: I590fe8f358042aab73acf16c2ed9567872b174f4
Reviewed-on: https://go-review.googlesource.com/16975
Reviewed-by: Chris Manghane <[email protected]>
  • Loading branch information
griesemer committed Nov 17, 2015
1 parent 48a1466 commit 662ab8b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/cmd/compile/internal/gc/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ func (p *parser) package_() {
mkpackage(p.sym().Name)
p.want(';')
} else {
prevlineno = lineno // see issue #13267
p.syntax_error("package statement must be first")
errorexit()
}
Expand Down

0 comments on commit 662ab8b

Please sign in to comment.