mirror of
https://github.com/golang/go
synced 2024-11-21 18:54:43 -07:00
gc: bug306
Fixes #1040. R=ken2 CC=golang-dev https://golang.org/cl/2132047
This commit is contained in:
parent
dfb895ad97
commit
c3900387db
@ -192,7 +192,7 @@ exprfmt(Fmt *f, Node *n, int prec)
|
||||
exprfmt(f, n->left, 0);
|
||||
} else {
|
||||
fmtprint(f, " ");
|
||||
if(n->left->op == OTCHAN && n->left->etype == Crecv) {
|
||||
if(n->left->op == OTCHAN && n->left->sym == S && n->left->etype == Crecv) {
|
||||
fmtprint(f, "(");
|
||||
exprfmt(f, n->left, 0);
|
||||
fmtprint(f, ")");
|
||||
|
@ -1161,7 +1161,7 @@ Tpretty(Fmt *fp, Type *t)
|
||||
case Csend:
|
||||
return fmtprint(fp, "chan<- %T", t->type);
|
||||
}
|
||||
if(t->type != T && t->type->etype == TCHAN && t->type->chan == Crecv)
|
||||
if(t->type != T && t->type->etype == TCHAN && t->type->sym == S && t->type->chan == Crecv)
|
||||
return fmtprint(fp, "chan (%T)", t->type);
|
||||
return fmtprint(fp, "chan %T", t->type);
|
||||
|
||||
|
9
test/fixedbugs/bug306.dir/p1.go
Normal file
9
test/fixedbugs/bug306.dir/p1.go
Normal file
@ -0,0 +1,9 @@
|
||||
// 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.
|
||||
|
||||
package p1
|
||||
|
||||
type T <-chan int
|
||||
var x = make(chan T)
|
||||
|
8
test/fixedbugs/bug306.dir/p2.go
Normal file
8
test/fixedbugs/bug306.dir/p2.go
Normal file
@ -0,0 +1,8 @@
|
||||
// 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.
|
||||
|
||||
package p2
|
||||
|
||||
import _ "./p1"
|
||||
|
7
test/fixedbugs/bug306.go
Normal file
7
test/fixedbugs/bug306.go
Normal file
@ -0,0 +1,7 @@
|
||||
// $G $D/$F.dir/p1.go && $G $D/$F.dir/p2.go
|
||||
|
||||
// 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.
|
||||
|
||||
ignored
|
Loading…
Reference in New Issue
Block a user