}
if _, isBad := x.(*ast.BadExpr); !isBad {
// only report error if it's a new one
- p.error(p.safePos(x.End()), fmt.Sprintf("function must be invoked in %s statement", callType))
+ p.error(p.safePos(x.End()), fmt.Sprintf("expression in %s must be function call", callType))
}
return nil
}
`package p; func f() { for x /* ERROR "boolean or range expression" */ := []string {} }`,
`package p; func f() { for i /* ERROR "boolean or range expression" */ , x = []string {} }`,
`package p; func f() { for i /* ERROR "boolean or range expression" */ , x := []string {} }`,
- `package p; func f() { go f /* ERROR HERE "function must be invoked" */ }`,
- `package p; func f() { defer func() {} /* ERROR HERE "function must be invoked" */ }`,
+ `package p; func f() { go f /* ERROR HERE "must be function call" */ }`,
+ `package p; func f() { defer func() {} /* ERROR HERE "must be function call" */ }`,
`package p; func f() { go func() { func() { f(x func /* ERROR "missing ','" */ (){}) } } }`,
`package p; func _() (type /* ERROR "found 'type'" */ T)(T)`,
`package p; func (type /* ERROR "found 'type'" */ T)(T) _()`,
}
func gos() {
- go 1 /* ERROR HERE "function must be invoked" */
+ go 1 /* ERROR HERE "must be function call" */
go int /* ERROR "go requires function call, not conversion" */ (0)
go gos()
var c chan int
}
func defers() {
- defer 1 /* ERROR HERE "function must be invoked" */
+ defer 1 /* ERROR HERE "must be function call" */
defer int /* ERROR "defer requires function call, not conversion" */ (0)
defer defers()
var c chan int