Source file src/internal/types/testdata/fixedbugs/issue53358.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 type A struct{} 8 9 func (*A) m() int { return 0 } 10 11 var _ = A.m /* ERROR "invalid method expression A.m (needs pointer receiver (*A).m)" */ () 12 var _ = (*A).m(nil) 13 14 type B struct{ A } 15 16 var _ = B.m // ERROR "invalid method expression B.m (needs pointer receiver (*B).m)" 17 var _ = (*B).m 18 19 var _ = struct{ A }.m // ERROR "invalid method expression struct{A}.m (needs pointer receiver (*struct{A}).m)" 20