| 1 |
// Copyright 2023 The Go Authors. All rights reserved. |
| 2 |
// Use of this source code is governed by a BSD-style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
package p |
| 6 |
|
| 7 |
// A simplified version of the code in the original report. |
| 8 |
type S[T any] struct{} |
| 9 |
var V = S[any]{} |
| 10 |
func (fs *S[T]) M(V.M /* ERROR "V.M is not a type" */) {} |
| 11 |
|
| 12 |
// Other minimal reproducers. |
| 13 |
type S1[T any] V1.M /* ERROR "V1.M is not a type" */ |
| 14 |
type V1 = S1[any] |
| 15 |
|
| 16 |
type S2[T any] struct{} |
| 17 |
type V2 = S2[any] |
| 18 |
func (fs *S2[T]) M(x V2.M /* ERROR "V2.M is not a type" */ ) {} |
| 19 |
|
| 20 |
// The following still panics, as the selector is reached from check.expr |
| 21 |
// rather than check.typexpr. TODO(rfindley): fix this. |
| 22 |
// type X[T any] int |
| 23 |
// func (X[T]) M(x [X[int].M]int) {} |
| 24 |
|