mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
reflect: change rtype so that it (not *rtype) implements Type
The abi.Type field was changed to *abi.Type, thus the
bitwise representation is the same, many casts are now
avoided and replace by either rtype{afoo} or rfoo.Type.
Change-Id: Ie7643edc714a0e56027c2875498a4dfe989cf7dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/487558
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
6cf7602b71
commit
1d92e0e3fa
6 changed files with 145 additions and 137 deletions
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue