Source file test/fixedbugs/issue19012.go

     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$|return with value in function with no return|no result values expected|mismatched types"
    17  	}
    18  	return "gopher" == true, 10 // ERROR "^too many arguments to return$|return with value in function with no return|no result values expected|mismatched types"
    19  }
    20  
    21  func main() {
    22  	f(2, 3 < "x", 10) // ERROR "too many arguments|invalid operation|incompatible type"
    23  
    24  	f(10, 10, "a") // ERROR "too many arguments"
    25  }
    26  

View as plain text