1
0
mirror of https://github.com/mgechev/revive.git synced 2024-11-24 08:32:22 +02:00
revive/testdata/redefines-builtin-id.go
chavacava a65fb8d1b5
adds tests for specific go versions (#1043)
Co-authored-by: chavacava <salvador.cavadini@gmail.com>
2024-09-20 16:09:24 +02:00

55 lines
1.4 KiB
Go

package fixtures
func (this data) vmethod() {
nil := true // MATCH /assignment creates a shadow of built-in identifier nil/
iota = 1 // MATCH /assignment modifies built-in identifier iota/
}
func append(i, j int) { // MATCH /redefinition of the built-in function append/
}
type string int16 // MATCH /redefinition of the built-in type string/
func delete(set []int64, i int) (y []int64) { // MATCH /redefinition of the built-in function delete/
for j, v := range set {
if j != i {
y = append(y, v)
}
}
return
}
type any int // MATCH /redefinition of the built-in type any/
func any() {} // MATCH /redefinition of the built-in type any/
var any int // MATCH /redefinition of the built-in type any/
const any = 1 // MATCH /redefinition of the built-in type any/
var i, copy int // MATCH /redefinition of the built-in function copy/
// issue #792
type ()
func foo() {
clear := 0 // Shall not match /redefinition of the built-in function clear/
max := 0 // Shall not match /redefinition of the built-in function max/
min := 0 // Shall not match /redefinition of the built-in function min/
_ = clear
_ = max
_ = min
}
func foo1(new int) { // MATCH /redefinition of the built-in function new/
_ = new
}
func foo2() (new int) { // MATCH /redefinition of the built-in function new/
return
}
func foo3[new any]() { // MATCH /redefinition of the built-in function new/
}