]> Cypherpunks repositories - gostls13.git/commitdiff
test: relax closure name matching in closure3.go
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Fri, 30 Sep 2022 17:23:48 +0000 (00:23 +0700)
committerGopher Robot <gobot@golang.org>
Sat, 1 Oct 2022 01:52:16 +0000 (01:52 +0000)
The mismatch between Unified IR and the old frontend is not about how
they number the closures, but how they name them. For nested closure,
the old frontend use the immediate function which contains the closure
as the outer function, while Unified IR uses the outer most function as
the outer for all closures.

That said, what important is matching the number of closures, not their
name prefix. So this CL relax the test to match both "main.func1.func2"
and "main.func1.2" to satisfy both Unified IR and the old frontend.

Updates #53058

Change-Id: I66ed816d1968aa68dd3089a4ea5850ba30afd75b
Reviewed-on: https://go-review.googlesource.com/c/go/+/437216
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

test/closure3.dir/main.go
test/run.go

index 7ef0a47595ea1f266656d27c800fda46c71865f0..4d02a4d10ede896e89c392e543242ded2756c823 100644 (file)
@@ -252,10 +252,10 @@ func main() {
                        b := 3
                        return func(y int) int { // ERROR "can inline main.func27.1"
                                c := 5
-                               return func(z int) int { // ERROR "can inline main.func27.1.1" "can inline main.func27.2"
+                               return func(z int) int { // ERROR "can inline main.func27.1.1" "can inline main.func27.(func)?2"
                                        return a*x + b*y + c*z
                                }(10) // ERROR "inlining call to main.func27.1.1"
-                       }(100) // ERROR "inlining call to main.func27.1" "inlining call to main.func27.2"
+                       }(100) // ERROR "inlining call to main.func27.1" "inlining call to main.func27.(func)?2"
                }(1000); r != 2350 {
                        ppanic("r != 2350")
                }
@@ -267,13 +267,13 @@ func main() {
                        b := 3
                        return func(y int) int { // ERROR "can inline main.func28.1"
                                c := 5
-                               func(z int) { // ERROR "can inline main.func28.1.1" "can inline main.func28.2"
+                               func(z int) { // ERROR "can inline main.func28.1.1" "can inline main.func28.(func)?2"
                                        a = a * x
                                        b = b * y
                                        c = c * z
                                }(10) // ERROR "inlining call to main.func28.1.1"
                                return a + c
-                       }(100) + b // ERROR "inlining call to main.func28.1" "inlining call to main.func28.2"
+                       }(100) + b // ERROR "inlining call to main.func28.1" "inlining call to main.func28.(func)?2"
                }(1000); r != 2350 {
                        ppanic("r != 2350")
                }
index 34b9675d2eaac216665598a0f1eae10f10370d06..e33ab4cff337c9b58f5627b0b548899cc73cd69c 100644 (file)
@@ -2020,8 +2020,7 @@ var _ = setOf(
 )
 
 var unifiedFailures = setOf(
-       "closure3.go", // unified IR numbers closures differently than -d=inlfuncswithclosures
-       "escape4.go",  // unified IR can inline f5 and f6; test doesn't expect this
+       "escape4.go", // unified IR can inline f5 and f6; test doesn't expect this
 )
 
 func setOf(keys ...string) map[string]bool {