go/types, types2: copy test from issue48703 into its own file

Monomorphization checks do not run in the presence of errors, which was
suppressing the error from this test and making it appear to pass. This
is a bit misleading.

For #48703
For #80172

Change-Id: I87f672275df189366b88cf3ffac8b3d21b7a1a83
Reviewed-on: https://go-review.googlesource.com/c/go/+/798500
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
Mark Freeman 2026-07-08 15:21:03 -04:00
parent 0af88e584c
commit 999c71883b
2 changed files with 9 additions and 5 deletions

View File

@ -6,11 +6,6 @@ package p
import "unsafe"
// The actual example from the issue.
type List[P any] struct{}
func (_ List[P]) m() (_ List[List[P]]) { return }
// Other types of recursion through methods.
type R[P any] int

View File

@ -0,0 +1,9 @@
// Copyright 2026 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 List[P /* ERROR "instantiation cycle" */ any] struct{}
func (_ List[P]) m() (_ List[List[P]]) { return }