summaryrefslogtreecommitdiff
path: root/test/inline.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2020-09-22 02:19:14 -0700
committerMatthew Dempsky <mdempsky@google.com>2020-10-15 18:35:44 +0000
commit1bcf6beec53ae811490fcd0ac29328b12b53702c (patch)
tree627a3c36a135a31b17cfeec18a6061a1322784f3 /test/inline.go
parent64fb6ae95f1c322486cbfb758552bb8439a8e6e8 (diff)
downloadgo-git-1bcf6beec53ae811490fcd0ac29328b12b53702c.tar.gz
cmd/compile: use staticValue for inlining logic
This CL replaces the ad hoc and duplicated logic for detecting inlinable calls with a single "inlCallee" function, which uses the "staticValue" helper function introduced in an earlier commit. Updates #41474. Change-Id: I103d4091b10366fce1344ef2501222b7df68f21d Reviewed-on: https://go-review.googlesource.com/c/go/+/256460 Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Trust: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'test/inline.go')
-rw-r--r--test/inline.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/inline.go b/test/inline.go
index 2f6fc0fe88..0e41873de4 100644
--- a/test/inline.go
+++ b/test/inline.go
@@ -49,6 +49,12 @@ func j(x int) int { // ERROR "can inline j"
}
}
+func _() int { // ERROR "can inline _"
+ tmp1 := h
+ tmp2 := tmp1
+ return tmp2(0) // ERROR "inlining call to h"
+}
+
var somethingWrong error
// local closures can be inlined
@@ -58,6 +64,9 @@ func l(x, y int) (int, int, error) {
}
if x == y {
e(somethingWrong) // ERROR "inlining call to l.func1"
+ } else {
+ f := e
+ f(nil) // ERROR "inlining call to l.func1"
}
return y, x, nil
}