Debian Codegraph @

test/typeparam/issue23536.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 // Test case where a slice of a user-defined byte type (not uint8 or byte) is
8 // converted to a string. Same for slice of runes.
9
10 package main
11
12 type MyByte byte
13
14 type MyRune rune
15
16 func f[T []MyByte](x T) string {
17 return string(x)
18 }
19
20 func g[T []MyRune](x T) string {
21 return string(x)
22 }
23
24 func main() {
25 var y []MyByte
26 _ = f(y)
27 _ = string(y)
28
29 var z []MyRune
30 _ = g(z)
31 _ = string(z)
32 }