modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/fixedbugs/issue14164.dir/a.go (about) 1 // Copyright 2016 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 a 6 7 // F is an exported function, small enough to be inlined. 8 // It defines a local interface with an unexported method 9 // f, which will appear with a package-qualified method 10 // name in the export data. 11 func F(x interface{}) bool { 12 _, ok := x.(interface { 13 f() 14 }) 15 return ok 16 } 17 18 // Like F but with the unexported interface method f 19 // defined via an embedded interface t. The compiler 20 // always flattens embedded interfaces so there should 21 // be no difference between F and G. Alas, currently 22 // G is not inlineable (at least via export data), so 23 // the issue is moot, here. 24 func G(x interface{}) bool { 25 type t0 interface { 26 f() 27 } 28 _, ok := x.(interface { 29 t0 30 }) 31 return ok 32 } 33 34 // Like G but now the embedded interface is declared 35 // at package level. This function is inlineable via 36 // export data. The export data representation is like 37 // for F. 38 func H(x interface{}) bool { 39 _, ok := x.(interface { 40 t1 41 }) 42 return ok 43 } 44 45 type t1 interface { 46 f() 47 }