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

     1  // errorcheck
     2  
     3  // Copyright 2017 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 19012: if we have any unknown type at a call site,
     8  // we must ensure that we return to the user a suppressed
     9  // error message saying instead of including <T> in
    10  // the message.
    11  
    12  package main
    13  
    14  func f(x int, y uint) {
    15  	if true {
    16  		return "a" > 10 // ERROR "^too many arguments to return$" "."
    17  	}
    18  	return "gopher" == true, 10 // ERROR "^too many arguments to return$" "."
    19  }
    20  
    21  func main() {
    22  	f(2, 3 < "x", 10) // ERROR "^too many arguments in call to f$" "."
    23  
    24  	f(10, 10, "a") // ERROR "too many arguments in call to f\n\thave \(number, number, string\)\n\twant \(int, uint\)"
    25  }