Debian Codegraph @

test/typeparam/issue54225.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 func main() {
10 One[TextValue]()
11 }
12
13 func One[V Value]() { Two[Node[V]]() }
14
15 func Two[V interface{ contentLen() int }]() {
16 var v V
17 v.contentLen()
18 }
19
20 type Value interface {
21 Len() int
22 }
23
24 type Node[V Value] struct{}
25
26 func (Node[V]) contentLen() int {
27 var value V
28 return value.Len()
29 }
30
31 type TextValue struct{}
32
33 func (TextValue) Len() int { return 0 }