...
Run Format

Source file test/fixedbugs/bug398.go

Documentation: test/fixedbugs

     1  // compile
     2  
     3  // Copyright 2012 The Go Authors. All rights reserved.
     4  // 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.
     8  // (This test used to have problems - see #15596.)
     9  
    10  package p
    11  
    12  // exported interfaces
    13  
    14  type I1 interface {
    15        F() interface{I1}
    16  }
    17  
    18  type I2 interface {
    19        F() interface{I2}
    20  }
    21  
    22  var V1 I1
    23  var V2 I2
    24  
    25  func F() bool {
    26         return V1 == V2
    27  }
    28  
    29  // non-exported interfaces
    30  
    31  type i1 interface {
    32        F() interface{i1}
    33  }
    34  
    35  type i2 interface {
    36        F() interface{i2}
    37  }
    38  
    39  var v1 i1
    40  var v2 i2
    41  
    42  func f() bool {
    43         return v1 == v2
    44  }
    45  

View as plain text