gcc/testsuite/go.test/test/fixedbugs/issue22822.go
raw| 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 | len := int(2) |
| 15 | println(len(slice)) // ERROR "cannot call non-function len .type int., declared at|expected function" |
| 16 | } |