aboutsummaryrefslogtreecommitdiff
path: root/test/sliceopt.go
diff options
context:
space:
mode:
authorDavid Chase <drchase@google.com>2016-10-06 11:08:11 -0700
committerBrad Fitzpatrick <bradfitz@golang.org>2016-10-06 18:19:28 +0000
commitc79ba22ece2cbb86b00325df7712ff0803cfd6e9 (patch)
treecd5dd23b88740ffa7be6ab681ec72d8f1a95e6e0 /test/sliceopt.go
parentfc47ee23322d668b3b023cd8c1d3541b1ad9703e (diff)
downloadgo-c79ba22ece2cbb86b00325df7712ff0803cfd6e9.tar.gz
go-c79ba22ece2cbb86b00325df7712ff0803cfd6e9.zip
test: delete sliceopt.go
It tests the behavior of the old deleted compiler. Fixes #17362. Change-Id: Ia2fdec734c5cbe724a9de562ed71598f67244ab3 Reviewed-on: https://go-review.googlesource.com/30593 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'test/sliceopt.go')
-rw-r--r--test/sliceopt.go60
1 files changed, 0 insertions, 60 deletions
diff --git a/test/sliceopt.go b/test/sliceopt.go
deleted file mode 100644
index 2fb1b3118c..0000000000
--- a/test/sliceopt.go
+++ /dev/null
@@ -1,60 +0,0 @@
-// +build !amd64,!arm,!amd64p32,!386,!arm64,!ppc64le,!mips64,!mips64le,!s390x
-// errorcheck -0 -d=append,slice
-
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Check optimization results for append and slicing.
-
-package main
-
-func a1(x []int, y int) []int {
- x = append(x, y) // ERROR "append: len-only update"
- return x
-}
-
-func a2(x []int, y int) []int {
- return append(x, y) // ERROR "append: full update"
-}
-
-func a3(x *[]int, y int) {
- *x = append(*x, y) // ERROR "append: len-only update"
-}
-
-func s1(x **[]int, xs **string, i, j int) {
- var z []int
- z = (**x)[2:] // ERROR "slice: omit check for 2nd index"
- z = (**x)[2:len(**x)] // not yet: "slice: reuse len" "slice: omit check for 2nd index"
- z = (**x)[2:cap(**x)] // not yet: "slice: reuse cap" "slice: omit check for 2nd index"
- z = (**x)[i:i] // ERROR "slice: reuse 1st index" "slice: omit check for 1st index" "slice: result len == 0"
- z = (**x)[1:i:i] // ERROR "slice: reuse 2nd index" "slice: omit check for 2nd index" "slice: result cap == result len"
- z = (**x)[i:j:0] // ERROR "slice: omit check for 3rd index"
- z = (**x)[i:0:j] // ERROR "slice: omit check for 2nd index"
- z = (**x)[0:i:j] // ERROR "slice: omit check for 1st index" "slice: skip base adjustment for 1st index 0"
- z = (**x)[0:] // ERROR "slice: omit slice operation"
- z = (**x)[2:8] // ERROR "slice: omit check for 1st index" "slice: result len == 6"
- z = (**x)[2:2] // ERROR "slice: omit check for 1st index" "slice: result len == 0"
- z = (**x)[0:i] // ERROR "slice: omit check for 1st index" "slice: skip base adjustment for 1st index 0"
- z = (**x)[2:i:8] // ERROR "slice: result cap == 6"
- z = (**x)[i:2:i] // ERROR "slice: reuse 1st index" "slice: result cap == 0" "slice: skip base adjustment for cap == 0"
-
- z = z[0:i] // ERROR "slice: omit check for 1st index" "slice: result cap not computed" "slice: skip base adjustment for 1st index 0" "slice: len-only update"
- z = z[0:i : i+1] // ERROR "slice: omit check for 1st index" "slice: skip base adjustment for 1st index 0" "slice: len/cap-only update"
- z = z[i : i+1]
-
- println(z)
-
- var zs string
- zs = (**xs)[2:] // ERROR "slice: omit check for 2nd index"
- zs = (**xs)[2:len(**xs)] // not yet: "slice: reuse len" "slice: omit check for 2nd index"
- zs = (**xs)[i:i] // ERROR "slice: reuse 1st index" "slice: omit check for 1st index" "slice: result len == 0" "slice: skip base adjustment for string len == 0"
- zs = (**xs)[0:] // ERROR "slice: omit slice operation"
- zs = (**xs)[2:8] // ERROR "slice: omit check for 1st index" "slice: result len == 6"
- zs = (**xs)[2:2] // ERROR "slice: omit check for 1st index" "slice: result len == 0" "slice: skip base adjustment for string len == 0"
- zs = (**xs)[0:i] // ERROR "slice: omit check for 1st index" "slice: skip base adjustment for 1st index 0"
-
- zs = zs[0:i] // ERROR "slice: omit check for 1st index" "slice: skip base adjustment for 1st index 0" "slice: len-only update"
- zs = zs[i : i+1]
- println(zs)
-}