| 1 |
// errorcheck |
| 2 |
|
| 3 |
// Copyright 2009 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 |
package main |
| 8 |
|
| 9 |
type I interface{ m() } |
| 10 |
type T struct{ m func() } |
| 11 |
type M struct{} |
| 12 |
|
| 13 |
func (M) m() {} |
| 14 |
|
| 15 |
func main() { |
| 16 |
var t T |
| 17 |
var m M |
| 18 |
var i I |
| 19 |
|
| 20 |
i = m |
| 21 |
// types2 does not give extra error "T.m is a field, not a method" |
| 22 |
i = t // ERROR "not a method|has no methods|does not implement I" |
| 23 |
_ = i |
| 24 |
} |