mirror of
https://github.com/golang/go
synced 2024-11-24 00:30:15 -07:00
cc14fcac2b
If we reach a generic type that is part of a cycle and we are in a type parameter list, we have a cycle through a type parameter list, which is invalid. Fixes #49439. Change-Id: Ia6cf97e1748ca0c0e61c02841202050091365b0b Reviewed-on: https://go-review.googlesource.com/c/go/+/361922 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
14 lines
307 B
Go
14 lines
307 B
Go
// errorcheck -G=3
|
|
|
|
// 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"
|
|
|
|
type X int
|
|
|
|
func (X) M() T[X] { return 0 }
|