2022-10-26 18:01:24 -06:00
|
|
|
// compile -d=interfacecycles
|
2012-01-23 07:19:02 -07:00
|
|
|
|
2016-04-10 15:32:26 -06:00
|
|
|
// Copyright 2012 The Go Authors. All rights reserved.
|
2012-01-23 07:19:02 -07:00
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
// Used to crash compiler in interface type equality check.
|
2017-05-18 15:11:17 -06:00
|
|
|
// (This test used to have problems - see #15596.)
|
2012-01-23 07:19:02 -07:00
|
|
|
|
|
|
|
package p
|
|
|
|
|
2017-05-18 15:11:17 -06:00
|
|
|
// exported interfaces
|
|
|
|
|
|
|
|
type I1 interface {
|
|
|
|
F() interface{I1}
|
|
|
|
}
|
|
|
|
|
|
|
|
type I2 interface {
|
|
|
|
F() interface{I2}
|
|
|
|
}
|
|
|
|
|
|
|
|
var V1 I1
|
|
|
|
var V2 I2
|
|
|
|
|
|
|
|
func F() bool {
|
|
|
|
return V1 == V2
|
|
|
|
}
|
|
|
|
|
|
|
|
// non-exported interfaces
|
|
|
|
|
2016-05-05 19:03:59 -06:00
|
|
|
type i1 interface {
|
|
|
|
F() interface{i1}
|
2012-01-23 07:19:02 -07:00
|
|
|
}
|
|
|
|
|
2016-05-05 19:03:59 -06:00
|
|
|
type i2 interface {
|
|
|
|
F() interface{i2}
|
2017-05-18 15:11:17 -06:00
|
|
|
}
|
2012-01-23 07:19:02 -07:00
|
|
|
|
2016-05-05 19:03:59 -06:00
|
|
|
var v1 i1
|
|
|
|
var v2 i2
|
2012-01-23 07:19:02 -07:00
|
|
|
|
|
|
|
func f() bool {
|
|
|
|
return v1 == v2
|
|
|
|
}
|