3 // Copyright 2013 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.
14 _ = a[-1] // ERROR "invalid array index -1|index out of bounds|must not be negative"
15 _ = a[-1:] // ERROR "invalid slice index -1|index out of bounds|must not be negative"
16 _ = a[:-1] // ERROR "invalid slice index -1|index out of bounds|must not be negative"
17 _ = a[10] // ERROR "invalid array index 10|index .*out of bounds"
20 _ = a[9:12] // ERROR "invalid slice index 12|index .*out of bounds"
21 _ = a[11:12] // ERROR "invalid slice index 11|index .*out of bounds"
22 _ = a[1<<100 : 1<<110] // ERROR "overflows int|integer constant overflow|invalid slice index 1 << 100|index out of bounds"
25 _ = s[-1] // ERROR "invalid slice index -1|index .*out of bounds|must not be negative"
26 _ = s[-1:] // ERROR "invalid slice index -1|index .*out of bounds|must not be negative"
27 _ = s[:-1] // ERROR "invalid slice index -1|index .*out of bounds|must not be negative"
33 _ = s[1<<100 : 1<<110] // ERROR "overflows int|integer constant overflow|invalid slice index 1 << 100|index out of bounds"
35 const c = "foofoofoof"
36 _ = c[-1] // ERROR "invalid string index -1|index out of bounds|must not be negative"
37 _ = c[-1:] // ERROR "invalid slice index -1|index out of bounds|must not be negative"
38 _ = c[:-1] // ERROR "invalid slice index -1|index out of bounds|must not be negative"
39 _ = c[10] // ERROR "invalid string index 10|index .*out of bounds"
42 _ = c[9:12] // ERROR "invalid slice index 12|index .*out of bounds"
43 _ = c[11:12] // ERROR "invalid slice index 11|index .*out of bounds"
44 _ = c[1<<100 : 1<<110] // ERROR "overflows int|integer constant overflow|invalid slice index 1 << 100|index out of bounds"
47 _ = t[-1] // ERROR "invalid string index -1|index out of bounds|must not be negative"
48 _ = t[-1:] // ERROR "invalid slice index -1|index out of bounds|must not be negative"
49 _ = t[:-1] // ERROR "invalid slice index -1|index out of bounds|must not be negative"
55 _ = t[1<<100 : 1<<110] // ERROR "overflows int|integer constant overflow|invalid slice index 1 << 100|index out of bounds"