diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 13:14:23 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 13:14:23 +0000 |
commit | 73df946d56c74384511a194dd01dbe099584fd1a (patch) | |
tree | fd0bcea490dd81327ddfbb31e215439672c9a068 /test/fixedbugs/issue14164.dir | |
parent | Initial commit. (diff) | |
download | golang-1.16-73df946d56c74384511a194dd01dbe099584fd1a.tar.xz golang-1.16-73df946d56c74384511a194dd01dbe099584fd1a.zip |
Adding upstream version 1.16.10.upstream/1.16.10upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/fixedbugs/issue14164.dir')
-rw-r--r-- | test/fixedbugs/issue14164.dir/a.go | 47 | ||||
-rw-r--r-- | test/fixedbugs/issue14164.dir/main.go | 12 |
2 files changed, 59 insertions, 0 deletions
diff --git a/test/fixedbugs/issue14164.dir/a.go b/test/fixedbugs/issue14164.dir/a.go new file mode 100644 index 0000000..bf03051 --- /dev/null +++ b/test/fixedbugs/issue14164.dir/a.go @@ -0,0 +1,47 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package a + +// F is an exported function, small enough to be inlined. +// It defines a local interface with an unexported method +// f, which will appear with a package-qualified method +// name in the export data. +func F(x interface{}) bool { + _, ok := x.(interface { + f() + }) + return ok +} + +// Like F but with the unexported interface method f +// defined via an embedded interface t. The compiler +// always flattens embedded interfaces so there should +// be no difference between F and G. Alas, currently +// G is not inlineable (at least via export data), so +// the issue is moot, here. +func G(x interface{}) bool { + type t0 interface { + f() + } + _, ok := x.(interface { + t0 + }) + return ok +} + +// Like G but now the embedded interface is declared +// at package level. This function is inlineable via +// export data. The export data representation is like +// for F. +func H(x interface{}) bool { + _, ok := x.(interface { + t1 + }) + return ok +} + +type t1 interface { + f() +} diff --git a/test/fixedbugs/issue14164.dir/main.go b/test/fixedbugs/issue14164.dir/main.go new file mode 100644 index 0000000..bcc6a63 --- /dev/null +++ b/test/fixedbugs/issue14164.dir/main.go @@ -0,0 +1,12 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +// Verify that we can import package "a" containing an inlineable +// function F that declares a local interface with a non-exported +// method f. +import _ "./a" + +func main() {} |