modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/interface/embed1.dir/embed1.go (about)

     1  // Copyright 2009 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Test that embedded interface types can have local methods.
     6  
     7  package main
     8  
     9  import "./embed0"
    10  
    11  type T int
    12  func (t T) m() {}
    13  
    14  type I interface { m() }
    15  type J interface { I }
    16  
    17  type PI interface { p.I }
    18  type PJ interface { p.J }
    19  
    20  func main() {
    21  	var i I
    22  	var j J
    23  	var t T
    24  	i = t
    25  	j = t
    26  	_ = i
    27  	_ = j
    28  	i = j
    29  	_ = i
    30  	j = i
    31  	_ = j
    32  	var pi PI
    33  	var pj PJ
    34  	var pt p.T
    35  	pi = pt
    36  	pj = pt
    37  	_ = pi
    38  	_ = pj
    39  	pi = pj
    40  	_ = pi
    41  	pj = pi
    42  	_ = pj
    43  }