aboutsummaryrefslogtreecommitdiff
path: root/test/inline.go
diff options
context:
space:
mode:
authorwdvxdr <wdvxdr1123@gmail.com>2021-10-13 19:44:38 +0800
committerDan Scales <danscales@google.com>2021-10-18 15:38:40 +0000
commit74acbaf94ab3c7aaa7e22fda4f90920e90f11ead (patch)
tree9356befed5d1bf4cda3df65168c04ca2dccab611 /test/inline.go
parentcf51fb5d680a9a1ca98af3361e65722d07bff111 (diff)
downloadgo-74acbaf94ab3c7aaa7e22fda4f90920e90f11ead.tar.xz
cmd/compile: allow inlining labeled for-statement and switch-statement
After CL 349012 and CL 350911, we can fully handle these labeled statements, so we can allow them when inlining. Updates #14768 Change-Id: I0ab3fd3f8d7436b49b1aedd946516b33c63f5747 Reviewed-on: https://go-review.googlesource.com/c/go/+/355497 Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Dan Scales <danscales@google.com> Reviewed-by: David Chase <drchase@google.com> Trust: Dan Scales <danscales@google.com>
Diffstat (limited to 'test/inline.go')
-rw-r--r--test/inline.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/test/inline.go b/test/inline.go
index a73c0ba7b1..599d5233e0 100644
--- a/test/inline.go
+++ b/test/inline.go
@@ -135,8 +135,7 @@ func s1(x int) int { // ERROR "can inline s1"
return foo() // ERROR "inlining call to s1.func1"
}
-// can't currently inline functions with a break statement
-func switchBreak(x, y int) int {
+func switchBreak(x, y int) int { // ERROR "can inline switchBreak"
var n int
switch x {
case 0:
@@ -218,8 +217,7 @@ func for1(fn func() bool) { // ERROR "can inline for1" "fn does not escape"
}
}
-// BAD: for2 should be inlineable too.
-func for2(fn func() bool) { // ERROR "fn does not escape"
+func for2(fn func() bool) { // ERROR "can inline for2" "fn does not escape"
Loop:
for {
if fn() {