forked from golang/go
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcycles2.src
More file actions
99 lines (71 loc) · 1.21 KB
/
cycles2.src
File metadata and controls
99 lines (71 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// Copyright 2013 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 p
import "unsafe"
// Test case for issue 5090
type t interface {
f(u)
}
type u interface {
t
}
func _() {
var t t
var u u
t.f(t)
t.f(u)
u.f(t)
u.f(u)
}
// Test case for issues #6589, #33656.
type A interface {
a() interface {
AB
}
}
type B interface {
a() interface {
AB
}
}
type AB interface {
a() interface {
A
B
}
b() interface {
A
B
}
}
var x AB
var y interface {
A
B
}
// TODO(gri) This should be a valid compare. See #33656.
var _ = x /* ERROR cannot compare */ == y
// Test case for issue 6638.
type T interface {
m() [T(nil).m /* ERROR undefined */ ()[0]]int
}
// Variations of this test case.
type T1 /* ERROR cycle */ interface {
m() [x1.m()[0]]int
}
var x1 T1
type T2 /* ERROR cycle */ interface {
m() [len(x2.m())]int
}
var x2 T2
type T3 /* ERROR cycle */ interface {
m() [unsafe.Sizeof(x3.m)]int
}
var x3 T3
type T4 /* ERROR cycle */ interface {
m() [unsafe.Sizeof(cast4(x4.m))]int // cast is invalid but we have a cycle, so all bets are off
}
var x4 T4
var _ = cast4(x4.m)
type cast4 func()