blob: 1a6725e09ddfdd6280c96afd05ba7738281967b3 [file] [log] [blame]
// Test for range construction.
// Package foo ...
package foo
func f() {
var m map[string]int
// with :=
for x, _ := range m { // MATCH /should omit 2nd value.*range.*equivalent.*for x := range/ -> ` for x := range m {`
_ = x
}
// with =
var y string
_ = y
for y, _ = range m { // MATCH /should omit 2nd value.*range.*equivalent.*for y = range/
}
for _ = range m { // MATCH /should omit values.*range.*equivalent.*for range/
}
for _, _ = range m { // MATCH /should omit values.*range.*equivalent.*for range/
}
// all OK:
for x := range m {
_ = x
}
for x, y := range m {
_, _ = x, y
}
for _, y := range m {
_ = y
}
var x int
_ = x
for y = range m {
}
for y, x = range m {
}
for _, x = range m {
}
}