diff --git a/src/go/types/testdata/check/cycles0.go b/src/go/types/testdata/check/cycles0.go index 27b6111822..998f9f7da9 100644 --- a/src/go/types/testdata/check/cycles0.go +++ b/src/go/types/testdata/check/cycles0.go @@ -66,7 +66,7 @@ type ( I6 interface{ I5 } // maps - M0 map[M0 /* ERROR incomparable map key */ ]M0 + M0 map[M0 /* ERROR invalid map key */ ]M0 // channels C0 chan C0 @@ -115,7 +115,7 @@ func _() { i0 /* ERROR cycle */ interface{ i0 } // maps - m0 map[m0 /* ERROR incomparable map key */ ]m0 + m0 map[m0 /* ERROR invalid map key */ ]m0 // channels c0 chan c0 @@ -124,10 +124,10 @@ func _() { // test cases for issue 6667 -type A [10]map[A /* ERROR incomparable map key */ ]bool +type A [10]map[A /* ERROR invalid map key */ ]bool type S struct { - m map[S /* ERROR incomparable map key */ ]bool + m map[S /* ERROR invalid map key */ ]bool } // test cases for issue 7236 diff --git a/src/go/types/testdata/check/typeparams.go b/src/go/types/testdata/check/typeparams.go index 199828f55f..95bd3e46b9 100644 --- a/src/go/types/testdata/check/typeparams.go +++ b/src/go/types/testdata/check/typeparams.go @@ -75,7 +75,7 @@ func new[T any]() *T { var _ = new /* ERROR cannot use generic function new */ var _ *int = new[int]() -func _[T any](map[T /* ERROR incomparable map key type T \(missing comparable constraint\) */]int) {} // w/o constraint we don't know if T is comparable +func _[T any](map[T /* ERROR invalid map key type T \(missing comparable constraint\) */]int) {} // w/o constraint we don't know if T is comparable func f1[T1 any](struct{T1 /* ERROR cannot be a .* type parameter */ }) int { panic(0) } var _ = f1[int](struct{T1}{}) diff --git a/src/go/types/typexpr.go b/src/go/types/typexpr.go index b02929df22..397bd75db3 100644 --- a/src/go/types/typexpr.go +++ b/src/go/types/typexpr.go @@ -348,7 +348,7 @@ func (check *Checker) typInternal(e0 ast.Expr, def *Named) (T Type) { if isTypeParam(typ.key) { why = " (missing comparable constraint)" } - check.errorf(e.Key, _IncomparableMapKey, "incomparable map key type %s%s", typ.key, why) + check.errorf(e.Key, _IncomparableMapKey, "invalid map key type %s%s", typ.key, why) } }).describef(e.Key, "check map key %s", typ.key)