Source file src/internal/types/testdata/fixedbugs/issue50372.go

     1  // Copyright 2021 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package p
     6  
     7  func _(s []int) {
     8          var i, j, k, l int
     9          _, _, _, _ = i, j, k, l
    10  
    11          for range s {}
    12          for i = range s {}
    13          for i, j = range s {}
    14          for i, j, k /* ERRORx "range clause permits at most two iteration variables|at most 2 expressions" */ = range s {}
    15          for i, j, k, l /* ERRORx "range clause permits at most two iteration variables|at most 2 expressions" */ = range s {}
    16  }
    17  
    18  func _(s chan int) {
    19          var i, j, k, l int
    20          _, _, _, _ = i, j, k, l
    21  
    22          for range s {}
    23          for i = range s {}
    24          for i, j /* ERRORx `range over .* permits only one iteration variable` */ = range s {}
    25          for i, j, k /* ERRORx `range over .* permits only one iteration variable|at most 2 expressions` */ = range s {}
    26          for i, j, k, l /* ERRORx `range over .* permits only one iteration variable|at most 2 expressions` */ = range s {}
    27  }
    28  

View as plain text