Use the 1.17 compiler error message, sans "array" prefix.
Change-Id: I0e70781c5ff02dca30a2004ab4d0ea82b0849eae
Reviewed-on: https://go-review.googlesource.com/c/go/+/396296
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
v, ok := constant.Int64Val(x.val)
assert(ok)
if max >= 0 && v >= max {
- if check.conf.CompilerErrorMessages {
- check.errorf(&x, invalidArg+"array index %s out of bounds [0:%d]", x.val.String(), max)
- } else {
- check.errorf(&x, invalidArg+"index %s is out of bounds", &x)
- }
+ check.errorf(&x, invalidArg+"index %s out of bounds [0:%d]", x.val.String(), max)
return
}
v, ok := constant.Int64Val(x.val)
assert(ok)
if max >= 0 && v >= max {
- check.invalidArg(&x, _InvalidIndex, "index %s is out of bounds", &x)
+ check.invalidArg(&x, _InvalidIndex, "index %s out of bounds [0:%d]", x.val.String(), max)
return
}
_ = [...]int{-1: 0} // ERROR "index must be non\-negative integer constant|index expression is negative|must not be negative"
_ = []int{100: 0}
- _ = [10]int{100: 0} // ERROR "array index 100 out of bounds|out of range"
+ _ = [10]int{100: 0} // ERROR "index 100 out of bounds|out of range"
_ = [...]int{100: 0}
_ = []int{t} // ERROR "cannot use .* as (type )?int( in slice literal)?|incompatible type"