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

     1  // Copyright 2022 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  type T struct{}
     8  
     9  func (T) m() []int { return nil }
    10  
    11  func f(x T) {
    12  	for _, x := range func() []int {
    13  		return x.m() // x declared in parameter list of f
    14  	}() {
    15  		_ = x // x declared by range clause
    16  	}
    17  }
    18  

View as plain text