mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00:00
Explicitly compute the common underlying type and while doing so report better slice-expression relevant error messages. Streamline message format for index and slice errors. This removes the last uses of the coreString and match functions. Delete them. Change-Id: I4b50dda1ef7e2ab5e296021458f7f0b6f6e229cd Reviewed-on: https://go-review.googlesource.com/c/go/+/655935 Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com> Auto-Submit: Robert Griesemer <gri@google.com>
27 lines
534 B
Go
27 lines
534 B
Go
// errorcheck
|
|
|
|
// Copyright 2009 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.
|
|
|
|
package main
|
|
|
|
func putint(digits *string) {
|
|
var i byte;
|
|
i = (*digits)[7]; // compiles
|
|
i = digits[7]; // ERROR "illegal|is not|cannot index"
|
|
_ = i;
|
|
}
|
|
|
|
func main() {
|
|
s := "asdfasdfasdfasdf";
|
|
putint(&s);
|
|
}
|
|
|
|
/*
|
|
bug022.go:8: illegal types for operand
|
|
(*<string>*STRING) INDEXPTR (<int32>INT32)
|
|
bug022.go:8: illegal types for operand
|
|
(<uint8>UINT8) AS
|
|
*/
|