OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgo/] [go/] [go/] [doc/] [testdata/] [e.go] - Blame information for rev 747

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 747 jeremybenn
// Copyright 2011 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
// The package e is a go/doc test for embedded methods.
6
package e
7
 
8
// ----------------------------------------------------------------------------
9
// Conflicting methods M must not show up.
10
 
11
type t1 struct{}
12
 
13
// t1.M should not appear as method in a Tx type.
14
func (t1) M() {}
15
 
16
type t2 struct{}
17
 
18
// t2.M should not appear as method in a Tx type.
19
func (t2) M() {}
20
 
21
// T1 has no embedded (level 1) M method due to conflict.
22
type T1 struct {
23
        t1
24
        t2
25
}
26
 
27
// ----------------------------------------------------------------------------
28
// Higher-level method M wins over lower-level method M.
29
 
30
// T2 has only M as top-level method.
31
type T2 struct {
32
        t1
33
}
34
 
35
// T2.M should appear as method of T2.
36
func (T2) M() {}
37
 
38
// ----------------------------------------------------------------------------
39
// Higher-level method M wins over lower-level conflicting methods M.
40
 
41
type t1e struct {
42
        t1
43
}
44
 
45
type t2e struct {
46
        t2
47
}
48
 
49
// T3 has only M as top-level method.
50
type T3 struct {
51
        t1e
52
        t2e
53
}
54
 
55
// T3.M should appear as method of T3.
56
func (T3) M() {}
57
 
58
// ----------------------------------------------------------------------------
59
// Don't show conflicting methods M embedded via an exported and non-exported
60
// type.
61
 
62
// T1 has no embedded (level 1) M method due to conflict.
63
type T4 struct {
64
        t2
65
        T2
66
}
67
 
68
// ----------------------------------------------------------------------------
69
// Don't show embedded methods of exported anonymous fields unless AllMethods
70
// is set.
71
 
72
type T4 struct{}
73
 
74
// T4.M should appear as method of T5 only if AllMethods is set.
75
func (*T4) M() {}
76
 
77
type T5 struct {
78
        T4
79
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.