Source file test/fixedbugs/issue50372.go
1 // errorcheck 2 3 // Copyright 2022 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 package p 8 9 func _(s []int) { 10 var i, j, k, l int 11 _, _, _, _ = i, j, k, l 12 13 for range s {} 14 for i = range s {} 15 for i, j = range s {} 16 for i, j, k = range s {} // ERROR "range clause permits at most two iteration variables" 17 for i, j, k, l = range s {} // ERROR "range clause permits at most two iteration variables" 18 } 19 20 func _(s chan int) { 21 var i, j, k, l int 22 _, _, _, _ = i, j, k, l 23 24 for range s {} 25 for i = range s {} 26 for i, j = range s {} // ERROR "range over .* permits only one iteration variable" 27 for i, j, k = range s {} // ERROR "range over .* permits only one iteration variable" 28 for i, j, k, l = range s {} // ERROR "range over .* permits only one iteration variable" 29 } 30