1
0
mirror of https://github.com/golang/go synced 2024-11-14 21:30:21 -07:00
go/test/fixedbugs/issue8507.go
Robert Griesemer c32566c336 [dev.typeparams] cmd/compile/internal/types2: avoid endless recursion in Comparable predicate
Use a map to detect recursive types.
With this we can now typecheck fixedbugs/issue8501.go.

Updates #43088.

Change-Id: I7fad6ccf6c94268473ff72b09a3158e13a7f4cc3
Reviewed-on: https://go-review.googlesource.com/c/go/+/276374
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2020-12-09 16:56:16 +00:00

17 lines
379 B
Go

// errorcheck
// Copyright 2014 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.
// issue 8507
// used to call algtype on invalid recursive type and get into infinite recursion
package p
type T struct{ T } // ERROR "invalid recursive type T|cycle"
func f() {
println(T{} == T{})
}