go.tools/go/types: adjust 3-index slice tests

The parser is now checking the presence of the 2nd and 3rd
index of 3-index slice expressions. See also:

https://golang.org/cl/58950045/
http://golang.org/issue/7305

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/58500045
This commit is contained in:
Robert Griesemer 2014-02-11 13:40:59 -08:00
parent ee92efc193
commit fc1d9c5505
2 changed files with 4 additions and 10 deletions

View File

@ -36,12 +36,6 @@ var testExprs = []testEntry{
dup("s[i:]"),
dup("s[:j]"),
dup("s[i:j]"),
dup("s[::]"),
dup("s[i::]"),
dup("s[:j:]"),
dup("s[::k]"),
dup("s[i:j:]"),
dup("s[i::k]"),
dup("s[:j:k]"),
dup("s[i:j:k]"),

View File

@ -17,9 +17,9 @@ func indexes() {
_ = a[- /* ERROR "negative" */ 1]
_ = a[- /* ERROR "negative" */ 1 :]
_ = a[: - /* ERROR "negative" */ 1]
_ = a[::] /* ERROR "3-index slice" */
_ = a[0::] /* ERROR "3-index slice" */
_ = a[0::10] /* ERROR "3-index slice" */
_ = a[: /* ERROR "2nd index required" */ : /* ERROR "3rd index required" */ ]
_ = a[0: /* ERROR "2nd index required" */ : /* ERROR "3rd index required" */ ]
_ = a[0: /* ERROR "2nd index required" */ :10]
_ = a[:10:10]
var a0 int
@ -82,7 +82,7 @@ func indexes() {
_ = s[: 1 /* ERROR "overflows" */ <<100]
_ = s[1 /* ERROR "overflows" */ <<100 :]
_ = s[1 /* ERROR "overflows" */ <<100 : 1 /* ERROR "overflows" */ <<100]
_ = s[::] /* ERROR "3-index slice" */
_ = s[: /* ERROR "2nd index required" */ : /* ERROR "3rd index required" */ ]
_ = s[:10:10]
_ = s[10:0:10] /* ERROR "invalid slice indices" */
_ = s[0:10:0] /* ERROR "invalid slice indices" */