aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuuk van Dijk <lvd@golang.org>2011-12-14 08:21:37 +0100
committerLuuk van Dijk <lvd@golang.org>2011-12-14 08:21:37 +0100
commit6a401339c113769be5339483bf134284292f03bc (patch)
treea0c1c99c3006a91cf80900dad34054c4433a265f
parentc8a5f8841c816b105251919e244ddbd4ca5c38f1 (diff)
downloadgo-6a401339c113769be5339483bf134284292f03bc.tar.gz
go-6a401339c113769be5339483bf134284292f03bc.zip
gc: suppress non-root cause message for bad receivers.
Fixed issue 2500 R=rsc CC=golang-dev https://golang.org/cl/5485053
-rw-r--r--src/cmd/gc/dcl.c2
-rw-r--r--test/fixedbugs/bug384.go12
2 files changed, 14 insertions, 0 deletions
diff --git a/src/cmd/gc/dcl.c b/src/cmd/gc/dcl.c
index 235e2ceff4..f9f638ceb1 100644
--- a/src/cmd/gc/dcl.c
+++ b/src/cmd/gc/dcl.c
@@ -1273,6 +1273,8 @@ addmethod(Sym *sf, Type *t, int local)
t = t->type;
}
}
+ if(t->broke) // rely on typecheck having complained before
+ return;
if(t != T) {
if(t->sym == S) {
yyerror("invalid receiver type %T (%T is an unnamed type)", pa, t);
diff --git a/test/fixedbugs/bug384.go b/test/fixedbugs/bug384.go
new file mode 100644
index 0000000000..b3d6466882
--- /dev/null
+++ b/test/fixedbugs/bug384.go
@@ -0,0 +1,12 @@
+// errchk $G $D/$F.go
+
+// Copyright 2011 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 2500
+
+package foo
+
+// Check that we only get root cause message, no further complaints about r undefined
+func (r *indexWriter) foo() {} // ERROR "undefined.*indexWriter"