| 1 |
// errorcheck |
| 2 |
|
| 3 |
// Copyright 2018 The Go Authors. All rights reserved. |
| 4 |
// Use of this source code is governed by a BSD-style |
| 5 |
// license that can be found in the LICENSE file. |
| 6 |
|
| 7 |
// Verify that follow-on errors due to conflicting |
| 8 |
// struct field and method names are suppressed. |
| 9 |
|
| 10 |
package p |
| 11 |
|
| 12 |
type T struct { |
| 13 |
a, b, c int |
| 14 |
E |
| 15 |
} |
| 16 |
|
| 17 |
type E struct{} |
| 18 |
|
| 19 |
func (T) b() {} // ERROR "field and method named b|redeclares struct field name" |
| 20 |
func (*T) E() {} // ERROR "field and method named E|redeclares struct field name" |
| 21 |
|
| 22 |
func _() { |
| 23 |
var x T |
| 24 |
_ = x.a |
| 25 |
_ = x.b // no follow-on error here |
| 26 |
x.b() // no follow-on error here |
| 27 |
_ = x.c |
| 28 |
_ = x.E // no follow-on error here |
| 29 |
x.E() // no follow-on error here |
| 30 |
} |