mirror of
https://github.com/golang/go
synced 2024-09-05 16:04:50 +00:00
![Robert Griesemer](/assets/img/avatar_default.png)
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>
16 lines
412 B
Go
16 lines
412 B
Go
// errorcheck
|
|
|
|
// 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.
|
|
|
|
package main
|
|
|
|
type T int
|
|
|
|
func (T) m() {} // GCCGO_ERROR "previous"
|
|
func (T) m() {} // ERROR "T\.m already declared|redefinition"
|
|
|
|
func (*T) p() {} // GCCGO_ERROR "previous"
|
|
func (*T) p() {} // ERROR "T\.p already declared|redefinition"
|