go/test/fixedbugs/bug022.go
Robert Griesemer ae4c13afc5 go/types, types2: report better error messages for slice expressions
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>
2025-03-11 05:44:15 -07:00

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
*/