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

     1  // Copyright 2012 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  // Functions that the inliner exported incorrectly.
     6  
     7  package one
     8  
     9  type T int
    10  
    11  // Issue 2678
    12  func F1(T *T) bool { return T == nil }
    13  
    14  // Issue 2682.
    15  func F2(c chan int) bool { return c == (<-chan int)(nil) }
    16  
    17  // Use of single named return value.
    18  func F3() (ret []int) { return append(ret, 1) }
    19  
    20  // Call of inlined method with blank receiver.
    21  func (_ *T) M() int { return 1 }
    22  func (t *T) MM() int { return t.M() }
    23  
    24  
    25  // One more like issue 2678
    26  type S struct { x, y int }
    27  type U []S
    28  
    29  func F4(S int) U { return U{{S,S}} }
    30  
    31  func F5() []*S {
    32  	return []*S{ {1,2}, { 3, 4} }
    33  }
    34  
    35  func F6(S int) *U {
    36  	return &U{{S,S}}
    37  }
    38  
    39  // Bug in the fix.
    40  
    41  type PB struct { x int }
    42  
    43  func (t *PB) Reset() { *t = PB{} }