1
2
3
4
5
6
7
8
9 package p
10
11 type T int
12
13 func (t T) NotVariadic(s []int) int {
14 return int(t) + s[0]
15 }
16
17 func (t T) Variadic(s ...int) int {
18 return int(t) + s[0]
19 }
20
21 type I interface {
22 NotVariadic(s []int) int
23 Variadic(s ...int) int
24 }
25
26 func F() {
27 var t T
28 var p *T = &t
29 var i I = p
30
31 nv := t.NotVariadic
32 nv = p.NotVariadic
33 nv = i.NotVariadic
34 var s int = nv([]int{1, 2, 3})
35
36 v := t.Variadic
37 v = p.Variadic
38 v = i.Variadic
39 s = v(1, 2, 3)
40
41 var f1 func([]int) int = nv
42 var f2 func(...int) int = v
43
44 _, _, _ = f1, f2, s
45 }
46
View as plain text