2015-02-13 19:31:30 -07:00
|
|
|
// errorcheck
|
|
|
|
|
2016-04-10 15:32:26 -06:00
|
|
|
// Copyright 2015 The Go Authors. All rights reserved.
|
2015-02-13 19:31:30 -07:00
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
// Test that fields hide promoted methods.
|
2015-07-10 17:17:11 -06:00
|
|
|
// https://golang.org/issue/4365
|
2015-02-13 19:31:30 -07:00
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
type T interface {
|
|
|
|
M()
|
|
|
|
}
|
|
|
|
|
|
|
|
type M struct{}
|
|
|
|
|
|
|
|
func (M) M() {}
|
|
|
|
|
|
|
|
type Foo struct {
|
|
|
|
M
|
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
var v T = Foo{} // ERROR "has no methods|not a method|cannot use"
|
|
|
|
_ = v
|
|
|
|
}
|