mirror of
https://github.com/golang/go
synced 2024-09-05 16:04:50 +00:00
![griesemer](/assets/img/avatar_default.png)
Cannot reproduce original problem. Compiler internals have changed enough such that this appears to work now. Restore original test (exported interfaces), but also keep version of the test using non-exported interfaces. Fixes #15596. Change-Id: Idb32da80239963242bd5d1609343c80f19773b0c Reviewed-on: https://go-review.googlesource.com/43622 Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
45 lines
660 B
Go
45 lines
660 B
Go
// compile
|
|
|
|
// Copyright 2012 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.
|
|
|
|
// Used to crash compiler in interface type equality check.
|
|
// (This test used to have problems - see #15596.)
|
|
|
|
package p
|
|
|
|
// 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
|
|
|
|
type i1 interface {
|
|
F() interface{i1}
|
|
}
|
|
|
|
type i2 interface {
|
|
F() interface{i2}
|
|
}
|
|
|
|
var v1 i1
|
|
var v2 i2
|
|
|
|
func f() bool {
|
|
return v1 == v2
|
|
}
|