Source file test/fixedbugs/bug441.go

     1  // run
     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  // Was discarding function calls made for arguments named _
     8  // in inlined functions.  Issue 3593.
     9  
    10  package main
    11  
    12  var did int
    13  
    14  func main() {
    15  	foo(side())
    16  	foo2(side(), side())
    17  	foo3(side(), side())
    18  	T.m1(T(side()))
    19  	T(1).m2(side())
    20  	const want = 7
    21  	if did != want {
    22  		println("BUG: missing", want-did, "calls")
    23  	}
    24  }
    25  
    26  func foo(_ int) {}
    27  func foo2(_, _ int) {}
    28  func foo3(int, int) {}
    29  type T int
    30  func (_ T) m1() {}
    31  func (t T) m2(_ int) {}
    32  
    33  func side() int {
    34  	did++
    35  	return 1
    36  }
    37  

View as plain text