test/typeparam/issue50833.go
raw| 1 | // run |
| 2 | |
| 3 | // Copyright 2022 The Go Authors. All rights reserved. |
| 4 | // Use of this source code is governed by a BSD-style |
| 5 | // license that can be found in the LICENSE file. |
| 6 | |
| 7 | package main |
| 8 | |
| 9 | type ( |
| 10 | S struct{ f int } |
| 11 | PS *S |
| 12 | ) |
| 13 | |
| 14 | func a() []*S { return []*S{{f: 1}} } |
| 15 | func b() []PS { return []PS{{f: 1}} } |
| 16 | |
| 17 | func c[P *S]() []P { return []P{{f: 1}} } |
| 18 | func d[P PS]() []P { return []P{{f: 1}} } |
| 19 | |
| 20 | func main() { |
| 21 | c[*S]() |
| 22 | d[PS]() |
| 23 | } |