1
0
mirror of https://github.com/golang/go synced 2024-11-12 10:30:23 -07:00
go/test/fixedbugs/issue4468.go
Matthew Dempsky 398bf9d5a0 cmd/internal/gc, cmd/yacc: restore custom syntax error messages
This restores go.errors from before 3af0d79 along with a fixed up
version of the bisonerrors AWK script, translated to Go.

However, this means Yyerror needs access to the yacc parser's state,
which is currently private.  To workaround that, add a "state"
accessor method like the Lookahead method added in c7fa3c6.

Update issue #9968.

Change-Id: Ib868789e92fdb7d135442120a392457923e50121
Reviewed-on: https://go-review.googlesource.com/7270
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-04-02 21:56:24 +00:00

29 lines
470 B
Go

// errorcheck
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Issue 4468: go/defer calls may not be parenthesized.
package p
type T int
func (t *T) F() T {
return *t
}
type S struct {
t T
}
func F() {
go (F()) // ERROR "must be function call"
defer (F()) // ERROR "must be function call"
var s S
(&s.t).F()
go (&s.t).F()
defer (&s.t).F()
}