Source file
test/fixedbugs/issue18595.go
1
2
3
4
5
6
7
8
9
10
11
12 package main
13
14 type I interface {
15 M()
16 }
17 type J interface {
18 M()
19 }
20
21 type T struct{}
22
23 func (*T) M() {}
24
25 func main() {
26 test1()
27 test2()
28 }
29
30 func test1() {
31 t := new(T)
32 var i1, i2 I
33 var j interface {
34 M()
35 }
36 i1 = t
37 j = t
38 i2 = j
39 if i1 != i2 {
40 panic("interfaces not equal")
41 }
42 }
43
44 func test2() {
45 t := new(T)
46 i1 := (I)(t)
47 i2 := (I)((interface {
48 M()
49 })((J)(t)))
50 if i1 != i2 {
51 panic("interfaces not equal")
52 }
53 }
54
View as plain text