]> Cypherpunks repositories - gostls13.git/commitdiff
gc: suppress non-root cause message for bad receivers.
authorLuuk van Dijk <lvd@golang.org>
Wed, 14 Dec 2011 07:21:37 +0000 (08:21 +0100)
committerLuuk van Dijk <lvd@golang.org>
Wed, 14 Dec 2011 07:21:37 +0000 (08:21 +0100)
Fixed issue 2500

R=rsc
CC=golang-dev
https://golang.org/cl/5485053

src/cmd/gc/dcl.c
test/fixedbugs/bug384.go [new file with mode: 0644]

index 235e2ceff4fb43e453a7728d1f17083fdf5ca9f9..f9f638ceb146f2dd7329fe173a9baf9056eda9cb 100644 (file)
@@ -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 (file)
index 0000000..b3d6466
--- /dev/null
@@ -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"