summaryrefslogtreecommitdiff
path: root/libgo/go/cmd/gofmt/testdata/slices1.golden
blob: 61e074f68a808a81d9be1e82583d3c2ce8bbd104 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Test cases for slice expression simplification.
package p

var (
	a [10]byte
	b [20]float32
	s []int
	t struct {
		s []byte
	}

	_ = a[0:]
	_ = a[1:10]
	_ = a[2:]
	_ = a[3:(len(a))]
	_ = a[len(a) : len(a)-1]
	_ = a[0:len(b)]

	_ = a[:]
	_ = a[:10]
	_ = a[:]
	_ = a[:(len(a))]
	_ = a[:len(a)-1]
	_ = a[:len(b)]

	_ = s[0:]
	_ = s[1:10]
	_ = s[2:]
	_ = s[3:(len(s))]
	_ = s[len(a) : len(s)-1]
	_ = s[0:len(b)]

	_ = s[:]
	_ = s[:10]
	_ = s[:]
	_ = s[:(len(s))]
	_ = s[:len(s)-1]
	_ = s[:len(b)]

	_ = t.s[0:]
	_ = t.s[1:10]
	_ = t.s[2:len(t.s)]
	_ = t.s[3:(len(t.s))]
	_ = t.s[len(a) : len(t.s)-1]
	_ = t.s[0:len(b)]

	_ = t.s[:]
	_ = t.s[:10]
	_ = t.s[:len(t.s)]
	_ = t.s[:(len(t.s))]
	_ = t.s[:len(t.s)-1]
	_ = t.s[:len(b)]
)

func _() {
	s := s[0:]
	_ = s
}