Source file test/interface/embed1.dir/embed1.go

     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  }
    44  

View as plain text