From fc1d9c55052172ecb0557341eda4f17a80a94d6e Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Tue, 11 Feb 2014 13:40:59 -0800 Subject: [PATCH] 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 --- go/types/exprstring_test.go | 6 ------ go/types/testdata/expr3.src | 8 ++++---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/go/types/exprstring_test.go b/go/types/exprstring_test.go index 41a86e2c..86067154 100644 --- a/go/types/exprstring_test.go +++ b/go/types/exprstring_test.go @@ -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]"), diff --git a/go/types/testdata/expr3.src b/go/types/testdata/expr3.src index 039a5fb8..abafdc82 100644 --- a/go/types/testdata/expr3.src +++ b/go/types/testdata/expr3.src @@ -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" */