2012-12-05 16:46:45 -07:00
|
|
|
// errorcheck
|
|
|
|
|
|
|
|
// Copyright 2012 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.
|
|
|
|
|
|
|
|
// Issue 4251: slice with inverted range is an error.
|
|
|
|
|
|
|
|
package p
|
|
|
|
|
|
|
|
func F1(s []byte) []byte {
|
2013-07-01 18:32:36 -06:00
|
|
|
return s[2:1] // ERROR "invalid slice index"
|
2012-12-05 16:46:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func F2(a [10]byte) []byte {
|
2013-07-01 18:32:36 -06:00
|
|
|
return a[2:1] // ERROR "invalid slice index"
|
2012-12-05 16:46:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func F3(s string) string {
|
2013-07-01 18:32:36 -06:00
|
|
|
return s[2:1] // ERROR "invalid slice index"
|
2012-12-05 16:46:45 -07:00
|
|
|
}
|