Source file test/reflectmethod8.go
1 // compile 2 3 // Copyright 2021 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 // Make sure that the compiler can analyze non-reflect 8 // Type.{Method,MethodByName} calls. 9 10 package p 11 12 type I interface { 13 MethodByName(string) 14 Method(int) 15 } 16 17 type M struct{} 18 19 func (M) MethodByName(string) {} 20 func (M) Method(int) {} 21 22 func f() { 23 var m M 24 I.MethodByName(m, "") 25 I.Method(m, 42) 26 } 27