Source file src/internal/types/testdata/fixedbugs/issue51025.go
1 // Copyright 2022 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package p 6 7 var _ interface{ m() } = struct /* ERROR "m is a field, not a method" */ { 8 m func() 9 }{} 10 11 var _ interface{ m() } = & /* ERROR "m is a field, not a method" */ struct { 12 m func() 13 }{} 14 15 var _ interface{ M() } = struct /* ERROR "missing method M" */ { 16 m func() 17 }{} 18 19 var _ interface{ M() } = & /* ERROR "missing method M" */ struct { 20 m func() 21 }{} 22 23 // test case from issue 24 type I interface{ m() } 25 type T struct{ m func() } 26 type M struct{} 27 28 func (M) m() {} 29 30 func _() { 31 var t T 32 var m M 33 var i I 34 35 i = m 36 i = t // ERROR "m is a field, not a method" 37 _ = i 38 } 39