mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-26 21:27:19 +00:00
386b69f473
* fix incorrect exported name in comments * add comments to exported methods
77 lines
2.2 KiB
Go
77 lines
2.2 KiB
Go
package testdata
|
|
|
|
type len struct { // want "Type 'len' shadows a predeclared identifier with the same name. Choose another name."
|
|
|
|
}
|
|
|
|
type int interface { // want "Type 'int' shadows a predeclared identifier with the same name. Choose another name."
|
|
|
|
}
|
|
|
|
// Struct --
|
|
func Struct() {
|
|
type error struct { // want "Type 'error' shadows a predeclared identifier with the same name. Choose another name."
|
|
int int // No diagnostic because the name is always referenced indirectly through a struct variable.
|
|
}
|
|
}
|
|
|
|
// TypeAlias --
|
|
func TypeAlias() {
|
|
type error string // want "Type 'error' shadows a predeclared identifier with the same name. Choose another name."
|
|
}
|
|
|
|
// UninitializedVarAndAssignments --
|
|
func UninitializedVarAndAssignments() {
|
|
var error int // want "Identifier 'error' shadows a predeclared identifier with the same name. Choose another name."
|
|
error = 1 // No diagnostic because the original declaration already triggered one.
|
|
if error == 0 {
|
|
}
|
|
}
|
|
|
|
// InitializedVar --
|
|
func InitializedVar() {
|
|
error := 0 // want "Identifier 'error' shadows a predeclared identifier with the same name. Choose another name."
|
|
if error == 0 {
|
|
}
|
|
}
|
|
|
|
// FirstInVarList --
|
|
func FirstInVarList() {
|
|
error, x := 0, 1 // want "Identifier 'error' shadows a predeclared identifier with the same name. Choose another name."
|
|
if error == x {
|
|
}
|
|
}
|
|
|
|
// SecondInVarList --
|
|
func SecondInVarList() {
|
|
x, error := 0, 1 // want "Identifier 'error' shadows a predeclared identifier with the same name. Choose another name."
|
|
if error == x {
|
|
}
|
|
}
|
|
|
|
// Const --
|
|
func Const() {
|
|
const error = 0 // want "Identifier 'error' shadows a predeclared identifier with the same name. Choose another name."
|
|
}
|
|
|
|
// Test function and parameter names.
|
|
func error(len int) { // want "Function 'error' shadows a predeclared identifier with the same name. Choose another name." "Identifier 'len' shadows a predeclared identifier with the same name. Choose another name."
|
|
if len == 0 {
|
|
}
|
|
|
|
// Test parameter in a new line.
|
|
f := func(
|
|
int string) { // want "Identifier 'int' shadows a predeclared identifier with the same name. Choose another name."
|
|
}
|
|
|
|
f("")
|
|
}
|
|
|
|
type receiver struct {
|
|
}
|
|
|
|
// Receiver is a test receiver function.
|
|
func (s *receiver) Receiver(len int) {
|
|
|
|
}
|