mirror of
https://github.com/golang/go
synced 2024-11-05 17:16:10 -07:00
e22af33b48
If a cycle has length 1, don't enumerate the single cycle entry; instead just mention "refers to itself". For instance, for an invalid recursive type T we now report: invalid recursive type: T refers to itself instead of: invalid recursive type T T refers to T Adjust tests to check for the different error messages. Change-Id: I5bd46f62fac0cf167f0d0c9a55f952981d294ff4 Reviewed-on: https://go-review.googlesource.com/c/go/+/436295 Run-TryBot: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Robert Griesemer <gri@google.com>
14 lines
320 B
Go
14 lines
320 B
Go
// errorcheck
|
|
|
|
// Copyright 2021 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[U interface{ M() T[U] }] int // ERROR "invalid recursive type: T refers to itself"
|
|
|
|
type X int
|
|
|
|
func (X) M() T[X] { return 0 }
|