modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/fixedbugs/issue6140.go (about)

     1  // compile
     2  
     3  // Copyright 2013 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  // Issue 6140: compiler incorrectly rejects method values
     8  // whose receiver has an unnamed interface type.
     9  
    10  package p
    11  
    12  type T *interface {
    13  	m() int
    14  }
    15  
    16  var x T
    17  
    18  var _ = (*x).m
    19  
    20  var y interface {
    21  	m() int
    22  }
    23  
    24  var _ = y.m
    25  
    26  type I interface {
    27  	String() string
    28  }
    29  
    30  var z *struct{ I }
    31  var _ = z.String