diff --git a/src/reflect/all_test.go b/src/reflect/all_test.go index 1ec4f7954cc437..b3b82f8b2ae28b 100644 --- a/src/reflect/all_test.go +++ b/src/reflect/all_test.go @@ -5861,7 +5861,7 @@ func TestTypeOfTypeOf(t *testing.T) { check("SliceOf", SliceOf(TypeOf(T{}))) } -type XM struct{} +type XM struct{ _ bool } func (*XM) String() string { return "" } @@ -6015,6 +6015,7 @@ func TestTypeStrings(t *testing.T) { {TypeOf(new(XM)).Method(0).Type, "func(*reflect_test.XM) string"}, {ChanOf(3, TypeOf(XM{})), "chan reflect_test.XM"}, {MapOf(TypeOf(int(0)), TypeOf(XM{})), "map[int]reflect_test.XM"}, + {ArrayOf(3, TypeOf(XM{})), "[3]reflect_test.XM"}, } for i, test := range stringTests { diff --git a/src/reflect/type.go b/src/reflect/type.go index 368b27ba518595..637392f4e7688e 100644 --- a/src/reflect/type.go +++ b/src/reflect/type.go @@ -2805,6 +2805,7 @@ func ArrayOf(count int, elem Type) Type { var iarray interface{} = [1]unsafe.Pointer{} prototype := *(**arrayType)(unsafe.Pointer(&iarray)) array := *prototype + array.tflag = 0 array.str = resolveReflectName(newName(s, "", "", false)) array.hash = fnv1(typ.hash, '[') for n := uint32(count); n > 0; n >>= 8 {