blob: a1583bd7746cbd977f33b3790c52df53d486ae62 [file] [log] [blame]
Russ Coxd2cc9882012-02-16 23:50:37 -05001// compile
Russ Cox427b5bd2012-01-23 09:19:02 -05002
Emmanuel Odeke53fd5222016-04-10 14:32:26 -07003// Copyright 2012 The Go Authors. All rights reserved.
Russ Cox427b5bd2012-01-23 09:19:02 -05004// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file.
6
7// Used to crash compiler in interface type equality check.
griesemer9044cb02017-05-18 14:11:17 -07008// (This test used to have problems - see #15596.)
Russ Cox427b5bd2012-01-23 09:19:02 -05009
10package p
11
griesemer9044cb02017-05-18 14:11:17 -070012// exported interfaces
13
14type I1 interface {
15 F() interface{I1}
16}
17
18type I2 interface {
19 F() interface{I2}
20}
21
22var V1 I1
23var V2 I2
24
25func F() bool {
26 return V1 == V2
27}
28
29// non-exported interfaces
30
Robert Griesemer394ac812016-05-05 18:03:59 -070031type i1 interface {
32 F() interface{i1}
Russ Cox427b5bd2012-01-23 09:19:02 -050033}
34
Robert Griesemer394ac812016-05-05 18:03:59 -070035type i2 interface {
36 F() interface{i2}
griesemer9044cb02017-05-18 14:11:17 -070037}
Russ Cox427b5bd2012-01-23 09:19:02 -050038
Robert Griesemer394ac812016-05-05 18:03:59 -070039var v1 i1
40var v2 i2
Russ Cox427b5bd2012-01-23 09:19:02 -050041
42func f() bool {
43 return v1 == v2
44}