diff --git a/src/reflect/export_test.go b/src/reflect/export_test.go index 0b9d0fde9e2..26a648e193f 100644 --- a/src/reflect/export_test.go +++ b/src/reflect/export_test.go @@ -8,13 +8,13 @@ import "unsafe" // MakeRO returns a copy of v with the read-only flag set. func MakeRO(v Value) Value { - v.flag |= flagRO + v.flag |= flagStickyRO return v } // IsRO reports whether v's read-only flag is set. func IsRO(v Value) bool { - return v.flag&flagRO != 0 + return v.flag&flagStickyRO != 0 } var CallGC = &callGC diff --git a/src/reflect/type.go b/src/reflect/type.go index e98c960a03b..aa56fcbe955 100644 --- a/src/reflect/type.go +++ b/src/reflect/type.go @@ -496,7 +496,7 @@ func (t *uncommonType) Method(i int) (m Method) { fl := flag(Func) if p.pkgPath != nil { m.PkgPath = *p.pkgPath - fl |= flagRO + fl |= flagStickyRO } mt := p.typ m.Type = mt diff --git a/src/reflect/value.go b/src/reflect/value.go index 001d0274ecc..2317a7bec3c 100644 --- a/src/reflect/value.go +++ b/src/reflect/value.go @@ -44,7 +44,8 @@ type Value struct { // flag holds metadata about the value. // The lowest bits are flag bits: - // - flagRO: obtained via unexported field, so read-only + // - flagStickyRO: obtained via unexported not embedded field, so read-only + // - flagEmbedRO: obtained via unexported embedded field, so read-only // - flagIndir: val holds a pointer to the data // - flagAddr: v.CanAddr is true (implies flagIndir) // - flagMethod: v is a method value. @@ -67,11 +68,13 @@ type flag uintptr const ( flagKindWidth = 5 // there are 27 kinds flagKindMask flag = 1<