Source file test/fixedbugs/issue7675.go

     1  // errorcheck
     2  
     3  // Copyright 2014 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 7675: fewer errors for wrong argument count
     8  
     9  package p
    10  
    11  func f(string, int, float64, string)
    12  
    13  func g(string, int, float64, ...string)
    14  
    15  func main() {
    16  	f(1, 0.5, "hello") // ERROR "not enough arguments|incompatible type"
    17  	f("1", 2, 3.1, "4")
    18  	f(1, 0.5, "hello", 4, 5) // ERROR "too many arguments|incompatible type"
    19  	g(1, 0.5)                // ERROR "not enough arguments|incompatible type"
    20  	g("1", 2, 3.1)
    21  	g(1, 0.5, []int{3, 4}...) // ERROR "not enough arguments|incompatible type"
    22  	g("1", 2, 3.1, "4", "5")
    23  	g(1, 0.5, "hello", 4, []int{5, 6}...) // ERROR "too many arguments|truncated to integer"
    24  }
    25  

View as plain text