Debian Codegraph @

test/typeparam/issue54535.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 node[T any] struct {
10 items items[T]
11 children items[*node[T]]
12 }
13
14 func (n *node[T]) f(i int, j int) bool {
15 if len(n.children[i].items) < j {
16 return false
17 }
18 return true
19 }
20
21 type items[T any] []T
22
23 func main() {
24 _ = node[int]{}
25 _ = f[int]
26 }
27
28 type s[T, U any] struct {
29 a T
30 c U
31 }
32
33 func f[T any]() {
34 var x s[*struct{ b T }, *struct{ d int }]
35 _ = x.a.b
36 _ = x.c.d
37 }