mirror of
https://github.com/golang/go
synced 2024-11-27 00:31:23 -07:00
7398c3c0c6
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>
23 lines
701 B
Go
23 lines
701 B
Go
// errorcheck
|
|
|
|
// Copyright 2017 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.
|
|
|
|
package p
|
|
|
|
type T struct{}
|
|
type A = T
|
|
type B = T
|
|
|
|
func (T) m() {}
|
|
func (T) m() {} // ERROR "already declared|redefinition"
|
|
func (A) m() {} // ERROR "already declared|redefinition"
|
|
func (A) m() {} // ERROR "already declared|redefinition"
|
|
func (B) m() {} // ERROR "already declared|redefinition"
|
|
func (B) m() {} // ERROR "already declared|redefinition"
|
|
|
|
func (*T) m() {} // ERROR "already declared|redefinition"
|
|
func (*A) m() {} // ERROR "already declared|redefinition"
|
|
func (*B) m() {} // ERROR "already declared|redefinition"
|