Source file test/fixedbugs/issue54912.dir/a.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  // Test that inlining a function literal that captures both a type
     6  // switch case variable and another local variable works correctly.
     7  
     8  package a
     9  
    10  func F(p *int, x any) func() {
    11  	switch x := x.(type) {
    12  	case int:
    13  		return func() {
    14  			*p += x
    15  		}
    16  	}
    17  	return nil
    18  }
    19  

View as plain text