summaryrefslogtreecommitdiff
path: root/test/method1.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2022-09-26 21:27:20 -0700
committerRobert Griesemer <gri@google.com>2022-09-27 21:59:19 +0000
commit7398c3c0c6d66a95d0c29c8fa59322e675ce7c86 (patch)
tree550cd4a633b96c4b5ac9f00db0aa6e7e561a6fa8 /test/method1.go
parentb16501c08b37235a67e2fc5b506f169152db57ae (diff)
downloadgo-git-7398c3c0c6d66a95d0c29c8fa59322e675ce7c86.tar.gz
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>
Diffstat (limited to 'test/method1.go')
-rw-r--r--test/method1.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/method1.go b/test/method1.go
index bb8c81d746..badfa55a7e 100644
--- a/test/method1.go
+++ b/test/method1.go
@@ -12,10 +12,10 @@ package main
type T struct{}
func (t *T) M(int, string) // GCCGO_ERROR "previous"
-func (t *T) M(int, float64) {} // ERROR "redeclared|redefinition"
+func (t *T) M(int, float64) {} // ERROR "already declared|redefinition"
func (t T) H() // GCCGO_ERROR "previous"
-func (t *T) H() {} // ERROR "redeclared|redefinition"
+func (t *T) H() {} // ERROR "already declared|redefinition"
func f(int, string) // GCCGO_ERROR "previous"
func f(int, float64) {} // ERROR "redeclared|redefinition"