1package checker_test
2
3func warnings1() {
4	var xs []int
5
6	/*! can combine chain of 2 appends into one */
7	xs = append(xs, 1)
8	xs = append(xs, 2)
9
10	_ = 0
11
12	/*! can combine chain of 2 appends into one */
13	xs = append(xs, 1, 2)
14	xs = append(xs, 3, 4)
15
16	_ = 0
17
18	/*! can combine chain of 3 appends into one */
19	xs = append(xs, 1)
20	xs = append(xs, 2)
21	xs = append(xs, 3)
22
23	switch len(xs) == 0 {
24	case true:
25		/*! can combine chain of 2 appends into one */
26		xs = append(xs, 1)
27		xs = append(xs, 2)
28	case false:
29		/*! can combine chain of 4 appends into one */
30		xs = append(xs, 1)
31		xs = append(xs, 2)
32		xs = append(xs, 3)
33		xs = append(xs, 4, 5, 6)
34	default:
35		// Intermixing chains and breaks.
36
37		var ys []int
38		xs = append(xs, ys...)
39		/*! can combine chain of 2 appends into one */
40		xs = append(xs, 1, 2)
41		xs = append(xs, 3)
42		xs = append(xs, ys...)
43		xs = append(xs, 4)
44		xs = append(xs, ys...)
45		/*! can combine chain of 3 appends into one */
46		xs = append(xs, 5, 6)
47		xs = append(xs, 7, 8)
48		xs = append(xs, 9)
49	}
50
51	ch := make(chan bool)
52	select {
53	case <-ch:
54		/*! can combine chain of 2 appends into one */
55		xs = append(xs, 1)
56		xs = append(xs, 2)
57		if ch != nil {
58			/*! can combine chain of 2 appends into one */
59			xs = append(xs, 5)
60			xs = append(xs, 6)
61		} else {
62			/*! can combine chain of 2 appends into one */
63			xs = append(xs, 7)
64			xs = append(xs, 8)
65		}
66	default:
67		/*! can combine chain of 2 appends into one */
68		xs = append(xs, 3)
69		xs = append(xs, 4)
70	}
71
72	/*! can combine chain of 3 appends into one */
73	xs = append(xs, 1)
74	// Comments can't break the chain.
75	xs = append(xs, 2)
76	// Even if there are multiple.
77	xs = append(xs, 3)
78}
79
80func warnings2() {
81	xs := map[string][]int{}
82
83	/*! can combine chain of 2 appends into one */
84	xs["k"] = append(xs["k"], 1)
85	xs["k"] = append(xs["k"], 2)
86
87	xs["k1"] = append(xs["k1"], 1)
88	/*! can combine chain of 2 appends into one */
89	xs["k2"] = append(xs["k2"], 2)
90	xs["k2"] = append(xs["k2"], 3)
91	xs["k3"] = append(xs["k3"], 4)
92	xs["k2"] = append(xs["k2"], 5)
93}
94