Fixes regression from Go 1.22.
For #67547.
Change-Id: Idd319b9d2a73c824caa2c821df0e2fcd4f58cb08
Reviewed-on: https://go-review.googlesource.com/c/go/+/587176
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
// identical element types), the single underlying type is the restricted
// channel type if the restrictions are always the same, or nil otherwise.
func coreType(t Type) Type {
+ t = Unalias(t)
tpar, _ := t.(*TypeParam)
if tpar == nil {
return under(t)
// and strings as identical. In this case, if successful and we saw
// a string, the result is of type (possibly untyped) string.
func coreString(t Type) Type {
+ t = Unalias(t)
tpar, _ := t.(*TypeParam)
if tpar == nil {
return under(t) // string or untyped string
// identical element types), the single underlying type is the restricted
// channel type if the restrictions are always the same, or nil otherwise.
func coreType(t Type) Type {
+ t = Unalias(t)
tpar, _ := t.(*TypeParam)
if tpar == nil {
return under(t)
// and strings as identical. In this case, if successful and we saw
// a string, the result is of type (possibly untyped) string.
func coreString(t Type) Type {
+ t = Unalias(t)
tpar, _ := t.(*TypeParam)
if tpar == nil {
return under(t) // string or untyped string
type A = P
_ = A(0) // don't crash with this conversion
}
+
+func _[P []int]() {
+ type A = P
+ _ = make(A, 10) // don't report an error for A
+}
+
+func _[P string]() {
+ var t []byte
+ type A = P
+ var s A
+ copy(t, s) // don't report an error for s
+}