mirror of
https://github.com/golang/go
synced 2024-11-14 21:20:27 -07:00
91803a2df3
The following files had merge conflicts and were merged manually: src/cmd/compile/fmtmap_test.go src/cmd/compile/internal/gc/noder.go src/go/parser/error_test.go test/assign.go test/chan/perm.go test/fixedbugs/issue22822.go test/fixedbugs/issue4458.go test/init.go test/interface/explicit.go test/map1.go test/method2.go The following files had manual changes to make tests pass: test/run.go test/used.go src/cmd/compile/internal/types2/stdlib_test.go Change-Id: Ia495aaaa80ce321ee4ec2a9105780fbe913dbd4c
20 lines
603 B
Go
20 lines
603 B
Go
// errorcheck
|
|
|
|
// Copyright 2018 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// Check that calling a function shadowing a built-in provides a good
|
|
// error message.
|
|
|
|
package main
|
|
|
|
func F() {
|
|
slice := []int{1, 2, 3}
|
|
_ = slice
|
|
len := int(2)
|
|
println(len(slice)) // ERROR "cannot call non-function len .type int., declared at LINE-1|cannot call non-function len"
|
|
const iota = 1
|
|
println(iota(slice)) // ERROR "cannot call non-function iota .type int., declared at LINE-1|cannot call non-function iota"
|
|
}
|