mirror of
https://github.com/golang/go
synced 2024-11-19 03:54:42 -07:00
10ffb27528
The unified frontend ICEs when inlining a function that contains a function literal, which captures both a type switch case variable and another variable. Updates #54912. Change-Id: I0e16d371ed5df48a70823beb0bf12110a5a17266 Reviewed-on: https://go-review.googlesource.com/c/go/+/428917 Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
19 lines
423 B
Go
19 lines
423 B
Go
// Copyright 2022 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// Test that inlining a function literal that captures both a type
|
|
// switch case variable and another local variable works correctly.
|
|
|
|
package a
|
|
|
|
func F(p *int, x any) func() {
|
|
switch x := x.(type) {
|
|
case int:
|
|
return func() {
|
|
*p += x
|
|
}
|
|
}
|
|
return nil
|
|
}
|