Revert "reflect: change rtype so that it (not *rtype) implements Type"

This reverts CL 487558, which is causing test failures in Google. See
b/282133554.

Change-Id: Icafa4ffc6aaa24a363abb90b8ae0b0183aca2b89
Reviewed-on: https://go-review.googlesource.com/c/go/+/494410
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Austin Clements <austin@google.com>
This commit is contained in:
Austin Clements 2023-05-12 08:59:19 -04:00 committed by Gopher Robot
parent c308e9b54c
commit 6d2309b576
6 changed files with 139 additions and 146 deletions

View file

@ -7215,11 +7215,11 @@ func join(b ...[]byte) []byte { return bytes.Join(b, nil) }
func lit(x ...byte) []byte { return x }
func TestTypeOfTypeOf(t *testing.T) {
// Check that all the type constructors return concrete rtype implementations.
// Check that all the type constructors return concrete *rtype implementations.
// It's difficult to test directly because the reflect package is only at arm's length.
// The easiest thing to do is just call a function that crashes if it doesn't get an rtype.
// The easiest thing to do is just call a function that crashes if it doesn't get an *rtype.
check := func(name string, typ Type) {
if underlying := TypeOf(typ).String(); underlying != "reflect.rtype" {
if underlying := TypeOf(typ).String(); underlying != "*reflect.rtype" {
t.Errorf("%v returned %v, not *reflect.rtype", name, underlying)
}
}