aboutsummaryrefslogtreecommitdiff
path: root/test/inline.go
diff options
context:
space:
mode:
authorTodd Neal <todd@tneal.org>2016-03-16 18:44:17 -0500
committerRobert Griesemer <gri@golang.org>2016-03-18 23:26:36 +0000
commitfc6bcdee7926925efc1305ad17d8b784e0e071fa (patch)
tree113fb8bd15d7068c9252ee8e374fe679baea3da6 /test/inline.go
parent3dd4f74e060b02031497ae839e698f3ddce5d73d (diff)
downloadgo-fc6bcdee7926925efc1305ad17d8b784e0e071fa.tar.xz
cmd/compile: allow inlining of functions that declare a const
Consider functions with an ODCLCONST for inlining and modify exprfmt to ignore those nodes when exporting. Don't add symbols to the export list if there is no definition. This occurs when OLITERAL symbols are looked up via Pkglookup for non-exported symbols. Fixes #7655 Change-Id: I1de827850f4c69e58107447314fe7433e378e069 Reviewed-on: https://go-review.googlesource.com/20773 Run-TryBot: Todd Neal <todd@tneal.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
Diffstat (limited to 'test/inline.go')
-rw-r--r--test/inline.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/inline.go b/test/inline.go
index fb20fab329..8984d059d8 100644
--- a/test/inline.go
+++ b/test/inline.go
@@ -31,3 +31,8 @@ func g(x int) int {
func h(x int) int { // ERROR "can inline h"
return x + 2
}
+
+func i(x int) int { // ERROR "can inline i"
+ const y = 2
+ return x + y
+}