From 524fb81c41ea559306a5ee3dbaf60fa6cda2479f Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 11 Jan 2012 20:32:02 -0500 Subject: [PATCH] gc: inlining bug R=lvd CC=golang-dev https://golang.org/cl/5533078 --- src/cmd/gc/fmt.c | 6 ++++-- test/fixedbugs/bug392.dir/one.go | 3 +++ test/fixedbugs/bug392.dir/two.go | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/cmd/gc/fmt.c b/src/cmd/gc/fmt.c index f49c703f36..4afd6c42bf 100644 --- a/src/cmd/gc/fmt.c +++ b/src/cmd/gc/fmt.c @@ -669,8 +669,10 @@ typefmt(Fmt *fp, Type *t) case 0: break; case 1: - fmtprint(fp, " %T", getoutargx(t)->type->type); // struct->field->field's type - break; + if(fmtmode != FExp) { + fmtprint(fp, " %T", getoutargx(t)->type->type); // struct->field->field's type + break; + } default: fmtprint(fp, " %T", getoutargx(t)); break; diff --git a/test/fixedbugs/bug392.dir/one.go b/test/fixedbugs/bug392.dir/one.go index f086ebe4e2..a7017255e5 100644 --- a/test/fixedbugs/bug392.dir/one.go +++ b/test/fixedbugs/bug392.dir/one.go @@ -14,6 +14,9 @@ func F1(T *T) bool { return T == nil } // Issue 2682. func F2(c chan int) bool { return c == (<-chan int)(nil) } +// Use of single named return value. +func F3() (ret []int) { return append(ret, 1) } + // Call of inlined method with blank receiver. func (_ *T) M() int { return 1 } func (t *T) MM() int { return t.M() } diff --git a/test/fixedbugs/bug392.dir/two.go b/test/fixedbugs/bug392.dir/two.go index 3704e65c5e..b0ce26d39a 100644 --- a/test/fixedbugs/bug392.dir/two.go +++ b/test/fixedbugs/bug392.dir/two.go @@ -12,9 +12,9 @@ import "./one" func use() { one.F1(nil) one.F2(nil) + one.F3() var t *one.T t.M() t.MM() } -