summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2010-04-29 16:07:14 -0700
committerRuss Cox <rsc@golang.org>2010-04-29 16:07:14 -0700
commit3d74bc2af068136c564bba5a2b1a5c93d9f25190 (patch)
tree2a624a386348bf1eea17c55e73264fd3cd44e937
parent77722362c5a7ac05c5e5010a75630cbb9aae2585 (diff)
downloadgolang-3d74bc2af068136c564bba5a2b1a5c93d9f25190.tar.gz
gc: never include ( ) on singleton func return type
Fixes issue 749. R=ken2 CC=golang-dev http://codereview.appspot.com/963043
-rw-r--r--src/cmd/gc/subr.c12
-rw-r--r--test/fixedbugs/bug269.go18
2 files changed, 22 insertions, 8 deletions
diff --git a/src/cmd/gc/subr.c b/src/cmd/gc/subr.c
index 34b549842..b0192adf3 100644
--- a/src/cmd/gc/subr.c
+++ b/src/cmd/gc/subr.c
@@ -1227,14 +1227,10 @@ Tpretty(Fmt *fp, Type *t)
fmtprint(fp, " ?unknown-type?");
break;
}
- if(t1->etype != TFIELD) {
- fmtprint(fp, " %T", t1);
- break;
- }
- if(t1->sym == S) {
- fmtprint(fp, " %T", t1->type);
- break;
- }
+ if(t1->etype == TFIELD)
+ t1 = t1->type;
+ fmtprint(fp, " %T", t1);
+ break;
default:
t1 = getoutargx(t)->type;
fmtprint(fp, " (");
diff --git a/test/fixedbugs/bug269.go b/test/fixedbugs/bug269.go
new file mode 100644
index 000000000..4cc0408c3
--- /dev/null
+++ b/test/fixedbugs/bug269.go
@@ -0,0 +1,18 @@
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2010 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.
+
+// http://code.google.com/p/go/issues/detail?id=749
+
+package main
+
+func f() (ok bool) { return false }
+
+func main() {
+ var i interface{}
+ i = f
+ _ = i.(func()bool)
+ _ = i.(func()(bool))
+}