Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / gcc / testsuite / go.test / test / interface / embed1.go
1 // $G $D/embed0.go && $G $D/$F.go && $L $F.$A && ./$A.out
2
3 // NOTE: This test is not run by 'run.go' and so not run by all.bash.
4 // To run this test you must use the ./run shell script.
5
6 // Copyright 2009 The Go Authors. All rights reserved.
7 // Use of this source code is governed by a BSD-style
8 // license that can be found in the LICENSE file.
9
10 // Test that embedded interface types can have local methods.
11
12 package main
13
14 import "./embed0"
15
16 type T int
17 func (t T) m() {}
18
19 type I interface { m() }
20 type J interface { I }
21
22 type PI interface { p.I }
23 type PJ interface { p.J }
24
25 func main() {
26         var i I
27         var j J
28         var t T
29         i = t
30         j = t
31         _ = i
32         _ = j
33         i = j
34         _ = i
35         j = i
36         _ = j
37         var pi PI
38         var pj PJ
39         var pt p.T
40         pi = pt
41         pj = pt
42         _ = pi
43         _ = pj
44         pi = pj
45         _ = pi
46         pj = pi
47         _ = pj
48 }