mirror of
https://github.com/golang/go
synced 2024-11-27 05:21:22 -07:00
97bc039c9c
The original report in #5172 was that cmd/compile was generating bogus follow-on error messages when typechecking a struct failed. Instead of fixing those follow-on error messages, golang.org/cl/9614044 suppress all follow-on error messages after struct typecheck fails. We should continue emitting error messages instead. While at it, also add the test case for original report. Fixes #33947 Change-Id: I4a5c6878977128abccd704350a12df743631c7bf Reviewed-on: https://go-review.googlesource.com/c/go/+/191944 Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
27 lines
513 B
Go
27 lines
513 B
Go
// errorcheck
|
|
|
|
// Copyright 2013 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 5172: spurious warn about type conversion on broken type inside go and defer
|
|
|
|
package main
|
|
|
|
type foo struct {
|
|
x bar // ERROR "undefined"
|
|
}
|
|
|
|
type T struct{}
|
|
|
|
func (t T) Bar() {}
|
|
|
|
func main() {
|
|
var f foo
|
|
go f.bar() // ERROR "undefined"
|
|
defer f.bar() // ERROR "undefined"
|
|
|
|
t := T{1} // ERROR "too many values"
|
|
go t.Bar()
|
|
}
|