...
1//gofmt -s
2
3// Test cases for slice expression simplification.
4package p
5
6var (
7 a [10]byte
8 b [20]float32
9 s []int
10 t struct {
11 s []byte
12 }
13
14 _ = a[0:]
15 _ = a[1:10]
16 _ = a[2:]
17 _ = a[3:(len(a))]
18 _ = a[len(a) : len(a)-1]
19 _ = a[0:len(b)]
20 _ = a[2:len(a):len(a)]
21
22 _ = a[:]
23 _ = a[:10]
24 _ = a[:]
25 _ = a[:(len(a))]
26 _ = a[:len(a)-1]
27 _ = a[:len(b)]
28 _ = a[:len(a):len(a)]
29
30 _ = s[0:]
31 _ = s[1:10]
32 _ = s[2:]
33 _ = s[3:(len(s))]
34 _ = s[len(a) : len(s)-1]
35 _ = s[0:len(b)]
36 _ = s[2:len(s):len(s)]
37
38 _ = s[:]
39 _ = s[:10]
40 _ = s[:]
41 _ = s[:(len(s))]
42 _ = s[:len(s)-1]
43 _ = s[:len(b)]
44 _ = s[:len(s):len(s)]
45
46 _ = t.s[0:]
47 _ = t.s[1:10]
48 _ = t.s[2:len(t.s)]
49 _ = t.s[3:(len(t.s))]
50 _ = t.s[len(a) : len(t.s)-1]
51 _ = t.s[0:len(b)]
52 _ = t.s[2:len(t.s):len(t.s)]
53
54 _ = t.s[:]
55 _ = t.s[:10]
56 _ = t.s[:len(t.s)]
57 _ = t.s[:(len(t.s))]
58 _ = t.s[:len(t.s)-1]
59 _ = t.s[:len(b)]
60 _ = t.s[:len(t.s):len(t.s)]
61)
62
63func _() {
64 s := s[0:]
65 _ = s
66}
View as plain text