Source file test/fixedbugs/issue22822.go

     1  // errorcheck
     2  
     3  // Copyright 2018 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  // Check that calling a function shadowing a built-in provides a good
     8  // error message.
     9  
    10  package main
    11  
    12  func F() {
    13  	slice := []int{1, 2, 3}
    14  	_ = slice
    15  	len := int(2)
    16  	println(len(slice)) // ERROR "cannot call non-function len .type int., declared at LINE-1|expected function|cannot call non-function len"
    17  	const iota = 1
    18  	println(iota(slice)) // ERROR "cannot call non-function iota .type int., declared at LINE-1|expected function|cannot call non-function iota"
    19  }
    20  

View as plain text