1
0
mirror of https://github.com/golang/go synced 2024-11-24 12:10:03 -07:00

gc: suppress non-root cause message for bad receivers.

Fixed issue 2500

R=rsc
CC=golang-dev
https://golang.org/cl/5485053
This commit is contained in:
Luuk van Dijk 2011-12-14 08:21:37 +01:00
parent c8a5f8841c
commit 6a401339c1
2 changed files with 14 additions and 0 deletions

View 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);

12
test/fixedbugs/bug384.go Normal file
View File

@ -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"