]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: use "method T.m already declared" for method redeclaration errors
authorRobert Griesemer <gri@golang.org>
Tue, 27 Sep 2022 04:27:20 +0000 (21:27 -0700)
committerRobert Griesemer <gri@google.com>
Tue, 27 Sep 2022 21:59:19 +0000 (21:59 +0000)
commit7398c3c0c6d66a95d0c29c8fa59322e675ce7c86
tree550cd4a633b96c4b5ac9f00db0aa6e7e561a6fa8
parentb16501c08b37235a67e2fc5b506f169152db57ae
cmd/compile: use "method T.m already declared" for method redeclaration errors

Compromise between old compiler error "T.m redeclared in this block"
(where the "in this block" is not particularly helpful) and the old
type-checker error "method m already declared for type T ...".
In the case where we have position information for the original
declaration, the error message is "method T.m already declared at
<position>". The new message is both shorter and more precise.

For #55326.

Change-Id: Id4a7f326fe631b11db9e8030eccb417c72d6c7db
Reviewed-on: https://go-review.googlesource.com/c/go/+/435016
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
src/cmd/compile/internal/types2/decl.go
src/go/types/decl.go
test/alias2.go
test/fixedbugs/bug350.go
test/fixedbugs/issue18655.go
test/method1.go