summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorR?my Oudompheng <oudomphe@phare.normalesup.org>2013-05-16 09:01:43 +0200
committerR?my Oudompheng <oudomphe@phare.normalesup.org>2013-05-16 09:01:43 +0200
commitb53021c0386de763a7b3fa4ea11a25a154cb0d33 (patch)
tree6bad3fb46580d6f447b7bebc87e05505b48abb99 /test
parentf33c3ceb8af7d5d427c6d016565ef00e44ac8040 (diff)
downloadgo-b53021c0386de763a7b3fa4ea11a25a154cb0d33.tar.gz
cmd/gc: repair make(T) in export data for inlining.
When T was an unexported type it could be forgotten. Fixes issue 5470. R=golang-dev, bradfitz CC=golang-dev https://codereview.appspot.com/9303050
Diffstat (limited to 'test')
-rw-r--r--test/fixedbugs/issue5470.dir/a.go27
-rw-r--r--test/fixedbugs/issue5470.dir/b.go13
-rw-r--r--test/fixedbugs/issue5470.go10
3 files changed, 50 insertions, 0 deletions
diff --git a/test/fixedbugs/issue5470.dir/a.go b/test/fixedbugs/issue5470.dir/a.go
new file mode 100644
index 000000000..302822d23
--- /dev/null
+++ b/test/fixedbugs/issue5470.dir/a.go
@@ -0,0 +1,27 @@
+// Copyright 2013 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.
+
+package a
+
+type Foo interface {
+ Hi() string
+}
+
+func Test1() Foo { return make(tst1) }
+
+type tst1 map[string]bool
+
+func (r tst1) Hi() string { return "Hi!" }
+
+func Test2() Foo { return make(tst2, 0) }
+
+type tst2 []string
+
+func (r tst2) Hi() string { return "Hi!" }
+
+func Test3() Foo { return make(tst3) }
+
+type tst3 chan string
+
+func (r tst3) Hi() string { return "Hi!" }
diff --git a/test/fixedbugs/issue5470.dir/b.go b/test/fixedbugs/issue5470.dir/b.go
new file mode 100644
index 000000000..0801c149c
--- /dev/null
+++ b/test/fixedbugs/issue5470.dir/b.go
@@ -0,0 +1,13 @@
+// Copyright 2013 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.
+
+package b
+
+import "./a"
+
+func main() {
+ a.Test1()
+ a.Test2()
+ a.Test3()
+}
diff --git a/test/fixedbugs/issue5470.go b/test/fixedbugs/issue5470.go
new file mode 100644
index 000000000..6123c0983
--- /dev/null
+++ b/test/fixedbugs/issue5470.go
@@ -0,0 +1,10 @@
+// compiledir
+
+// Copyright 2013 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.
+
+// Issue 5470: exported data for inlining may miss
+// the type argument of make.
+
+package ignored