all: remove duplicate imports

protoreflect (as pref) and protoiface (as piface) are imported
duplicates in some files.
Respect package name, remove unnecessary aliased import statements.

Change-Id: Ie9897f17a50d19a462035964e366af72afed0e4d
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/405694
Reviewed-by: Kirill Kolyshkin <kolyshkin@gmail.com>
Reviewed-by: Lasse Folger <lassefolger@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
diff --git a/encoding/protojson/encode.go b/encoding/protojson/encode.go
index ba971f0..d09d22e 100644
--- a/encoding/protojson/encode.go
+++ b/encoding/protojson/encode.go
@@ -18,7 +18,6 @@
 	"google.golang.org/protobuf/internal/pragma"
 	"google.golang.org/protobuf/proto"
 	"google.golang.org/protobuf/reflect/protoreflect"
-	pref "google.golang.org/protobuf/reflect/protoreflect"
 	"google.golang.org/protobuf/reflect/protoregistry"
 )
 
@@ -164,8 +163,8 @@
 	typeURL string
 }
 
-func (m typeURLFieldRanger) Range(f func(pref.FieldDescriptor, pref.Value) bool) {
-	if !f(typeFieldDesc, pref.ValueOfString(m.typeURL)) {
+func (m typeURLFieldRanger) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
+	if !f(typeFieldDesc, protoreflect.ValueOfString(m.typeURL)) {
 		return
 	}
 	m.FieldRanger.Range(f)
@@ -173,9 +172,9 @@
 
 // unpopulatedFieldRanger wraps a protoreflect.Message and modifies its Range
 // method to additionally iterate over unpopulated fields.
-type unpopulatedFieldRanger struct{ pref.Message }
+type unpopulatedFieldRanger struct{ protoreflect.Message }
 
-func (m unpopulatedFieldRanger) Range(f func(pref.FieldDescriptor, pref.Value) bool) {
+func (m unpopulatedFieldRanger) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
 	fds := m.Descriptor().Fields()
 	for i := 0; i < fds.Len(); i++ {
 		fd := fds.Get(i)
@@ -184,10 +183,10 @@
 		}
 
 		v := m.Get(fd)
-		isProto2Scalar := fd.Syntax() == pref.Proto2 && fd.Default().IsValid()
-		isSingularMessage := fd.Cardinality() != pref.Repeated && fd.Message() != nil
+		isProto2Scalar := fd.Syntax() == protoreflect.Proto2 && fd.Default().IsValid()
+		isSingularMessage := fd.Cardinality() != protoreflect.Repeated && fd.Message() != nil
 		if isProto2Scalar || isSingularMessage {
-			v = pref.Value{} // use invalid value to emit null
+			v = protoreflect.Value{} // use invalid value to emit null
 		}
 		if !f(fd, v) {
 			return
@@ -199,7 +198,7 @@
 // marshalMessage marshals the fields in the given protoreflect.Message.
 // If the typeURL is non-empty, then a synthetic "@type" field is injected
 // containing the URL as the value.
-func (e encoder) marshalMessage(m pref.Message, typeURL string) error {
+func (e encoder) marshalMessage(m protoreflect.Message, typeURL string) error {
 	if !flags.ProtoLegacy && messageset.IsMessageSet(m.Descriptor()) {
 		return errors.New("no support for proto1 MessageSets")
 	}
@@ -220,7 +219,7 @@
 	}
 
 	var err error
-	order.RangeFields(fields, order.IndexNameFieldOrder, func(fd pref.FieldDescriptor, v pref.Value) bool {
+	order.RangeFields(fields, order.IndexNameFieldOrder, func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {
 		name := fd.JSONName()
 		if e.opts.UseProtoNames {
 			name = fd.TextName()
@@ -238,7 +237,7 @@
 }
 
 // marshalValue marshals the given protoreflect.Value.
-func (e encoder) marshalValue(val pref.Value, fd pref.FieldDescriptor) error {
+func (e encoder) marshalValue(val protoreflect.Value, fd protoreflect.FieldDescriptor) error {
 	switch {
 	case fd.IsList():
 		return e.marshalList(val.List(), fd)
@@ -251,44 +250,44 @@
 
 // marshalSingular marshals the given non-repeated field value. This includes
 // all scalar types, enums, messages, and groups.
-func (e encoder) marshalSingular(val pref.Value, fd pref.FieldDescriptor) error {
+func (e encoder) marshalSingular(val protoreflect.Value, fd protoreflect.FieldDescriptor) error {
 	if !val.IsValid() {
 		e.WriteNull()
 		return nil
 	}
 
 	switch kind := fd.Kind(); kind {
-	case pref.BoolKind:
+	case protoreflect.BoolKind:
 		e.WriteBool(val.Bool())
 
-	case pref.StringKind:
+	case protoreflect.StringKind:
 		if e.WriteString(val.String()) != nil {
 			return errors.InvalidUTF8(string(fd.FullName()))
 		}
 
-	case pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind:
+	case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:
 		e.WriteInt(val.Int())
 
-	case pref.Uint32Kind, pref.Fixed32Kind:
+	case protoreflect.Uint32Kind, protoreflect.Fixed32Kind:
 		e.WriteUint(val.Uint())
 
-	case pref.Int64Kind, pref.Sint64Kind, pref.Uint64Kind,
-		pref.Sfixed64Kind, pref.Fixed64Kind:
+	case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Uint64Kind,
+		protoreflect.Sfixed64Kind, protoreflect.Fixed64Kind:
 		// 64-bit integers are written out as JSON string.
 		e.WriteString(val.String())
 
-	case pref.FloatKind:
+	case protoreflect.FloatKind:
 		// Encoder.WriteFloat handles the special numbers NaN and infinites.
 		e.WriteFloat(val.Float(), 32)
 
-	case pref.DoubleKind:
+	case protoreflect.DoubleKind:
 		// Encoder.WriteFloat handles the special numbers NaN and infinites.
 		e.WriteFloat(val.Float(), 64)
 
-	case pref.BytesKind:
+	case protoreflect.BytesKind:
 		e.WriteString(base64.StdEncoding.EncodeToString(val.Bytes()))
 
-	case pref.EnumKind:
+	case protoreflect.EnumKind:
 		if fd.Enum().FullName() == genid.NullValue_enum_fullname {
 			e.WriteNull()
 		} else {
@@ -300,7 +299,7 @@
 			}
 		}
 
-	case pref.MessageKind, pref.GroupKind:
+	case protoreflect.MessageKind, protoreflect.GroupKind:
 		if err := e.marshalMessage(val.Message(), ""); err != nil {
 			return err
 		}
@@ -312,7 +311,7 @@
 }
 
 // marshalList marshals the given protoreflect.List.
-func (e encoder) marshalList(list pref.List, fd pref.FieldDescriptor) error {
+func (e encoder) marshalList(list protoreflect.List, fd protoreflect.FieldDescriptor) error {
 	e.StartArray()
 	defer e.EndArray()
 
@@ -326,12 +325,12 @@
 }
 
 // marshalMap marshals given protoreflect.Map.
-func (e encoder) marshalMap(mmap pref.Map, fd pref.FieldDescriptor) error {
+func (e encoder) marshalMap(mmap protoreflect.Map, fd protoreflect.FieldDescriptor) error {
 	e.StartObject()
 	defer e.EndObject()
 
 	var err error
-	order.RangeEntries(mmap, order.GenericKeyOrder, func(k pref.MapKey, v pref.Value) bool {
+	order.RangeEntries(mmap, order.GenericKeyOrder, func(k protoreflect.MapKey, v protoreflect.Value) bool {
 		if err = e.WriteName(k.String()); err != nil {
 			return false
 		}
diff --git a/encoding/prototext/encode.go b/encoding/prototext/encode.go
index 8d5304d..ebf6c65 100644
--- a/encoding/prototext/encode.go
+++ b/encoding/prototext/encode.go
@@ -20,7 +20,6 @@
 	"google.golang.org/protobuf/internal/strs"
 	"google.golang.org/protobuf/proto"
 	"google.golang.org/protobuf/reflect/protoreflect"
-	pref "google.golang.org/protobuf/reflect/protoreflect"
 	"google.golang.org/protobuf/reflect/protoregistry"
 )
 
@@ -150,7 +149,7 @@
 }
 
 // marshalMessage marshals the given protoreflect.Message.
-func (e encoder) marshalMessage(m pref.Message, inclDelims bool) error {
+func (e encoder) marshalMessage(m protoreflect.Message, inclDelims bool) error {
 	messageDesc := m.Descriptor()
 	if !flags.ProtoLegacy && messageset.IsMessageSet(messageDesc) {
 		return errors.New("no support for proto1 MessageSets")
@@ -190,7 +189,7 @@
 }
 
 // marshalField marshals the given field with protoreflect.Value.
-func (e encoder) marshalField(name string, val pref.Value, fd pref.FieldDescriptor) error {
+func (e encoder) marshalField(name string, val protoreflect.Value, fd protoreflect.FieldDescriptor) error {
 	switch {
 	case fd.IsList():
 		return e.marshalList(name, val.List(), fd)
@@ -204,40 +203,40 @@
 
 // marshalSingular marshals the given non-repeated field value. This includes
 // all scalar types, enums, messages, and groups.
-func (e encoder) marshalSingular(val pref.Value, fd pref.FieldDescriptor) error {
+func (e encoder) marshalSingular(val protoreflect.Value, fd protoreflect.FieldDescriptor) error {
 	kind := fd.Kind()
 	switch kind {
-	case pref.BoolKind:
+	case protoreflect.BoolKind:
 		e.WriteBool(val.Bool())
 
-	case pref.StringKind:
+	case protoreflect.StringKind:
 		s := val.String()
 		if !e.opts.allowInvalidUTF8 && strs.EnforceUTF8(fd) && !utf8.ValidString(s) {
 			return errors.InvalidUTF8(string(fd.FullName()))
 		}
 		e.WriteString(s)
 
-	case pref.Int32Kind, pref.Int64Kind,
-		pref.Sint32Kind, pref.Sint64Kind,
-		pref.Sfixed32Kind, pref.Sfixed64Kind:
+	case protoreflect.Int32Kind, protoreflect.Int64Kind,
+		protoreflect.Sint32Kind, protoreflect.Sint64Kind,
+		protoreflect.Sfixed32Kind, protoreflect.Sfixed64Kind:
 		e.WriteInt(val.Int())
 
-	case pref.Uint32Kind, pref.Uint64Kind,
-		pref.Fixed32Kind, pref.Fixed64Kind:
+	case protoreflect.Uint32Kind, protoreflect.Uint64Kind,
+		protoreflect.Fixed32Kind, protoreflect.Fixed64Kind:
 		e.WriteUint(val.Uint())
 
-	case pref.FloatKind:
+	case protoreflect.FloatKind:
 		// Encoder.WriteFloat handles the special numbers NaN and infinites.
 		e.WriteFloat(val.Float(), 32)
 
-	case pref.DoubleKind:
+	case protoreflect.DoubleKind:
 		// Encoder.WriteFloat handles the special numbers NaN and infinites.
 		e.WriteFloat(val.Float(), 64)
 
-	case pref.BytesKind:
+	case protoreflect.BytesKind:
 		e.WriteString(string(val.Bytes()))
 
-	case pref.EnumKind:
+	case protoreflect.EnumKind:
 		num := val.Enum()
 		if desc := fd.Enum().Values().ByNumber(num); desc != nil {
 			e.WriteLiteral(string(desc.Name()))
@@ -246,7 +245,7 @@
 			e.WriteInt(int64(num))
 		}
 
-	case pref.MessageKind, pref.GroupKind:
+	case protoreflect.MessageKind, protoreflect.GroupKind:
 		return e.marshalMessage(val.Message(), true)
 
 	default:
@@ -256,7 +255,7 @@
 }
 
 // marshalList marshals the given protoreflect.List as multiple name-value fields.
-func (e encoder) marshalList(name string, list pref.List, fd pref.FieldDescriptor) error {
+func (e encoder) marshalList(name string, list protoreflect.List, fd protoreflect.FieldDescriptor) error {
 	size := list.Len()
 	for i := 0; i < size; i++ {
 		e.WriteName(name)
@@ -268,9 +267,9 @@
 }
 
 // marshalMap marshals the given protoreflect.Map as multiple name-value fields.
-func (e encoder) marshalMap(name string, mmap pref.Map, fd pref.FieldDescriptor) error {
+func (e encoder) marshalMap(name string, mmap protoreflect.Map, fd protoreflect.FieldDescriptor) error {
 	var err error
-	order.RangeEntries(mmap, order.GenericKeyOrder, func(key pref.MapKey, val pref.Value) bool {
+	order.RangeEntries(mmap, order.GenericKeyOrder, func(key protoreflect.MapKey, val protoreflect.Value) bool {
 		e.WriteName(name)
 		e.StartMessage()
 		defer e.EndMessage()
@@ -334,7 +333,7 @@
 
 // marshalAny marshals the given google.protobuf.Any message in expanded form.
 // It returns true if it was able to marshal, else false.
-func (e encoder) marshalAny(any pref.Message) bool {
+func (e encoder) marshalAny(any protoreflect.Message) bool {
 	// Construct the embedded message.
 	fds := any.Descriptor().Fields()
 	fdType := fds.ByNumber(genid.Any_TypeUrl_field_number)
diff --git a/internal/filedesc/build.go b/internal/filedesc/build.go
index b293b69..7cac1c1 100644
--- a/internal/filedesc/build.go
+++ b/internal/filedesc/build.go
@@ -12,8 +12,7 @@
 	"google.golang.org/protobuf/encoding/protowire"
 	"google.golang.org/protobuf/internal/genid"
 	"google.golang.org/protobuf/reflect/protoreflect"
-	pref "google.golang.org/protobuf/reflect/protoreflect"
-	preg "google.golang.org/protobuf/reflect/protoregistry"
+	"google.golang.org/protobuf/reflect/protoregistry"
 )
 
 // Builder construct a protoreflect.FileDescriptor from the raw descriptor.
@@ -38,7 +37,7 @@
 	// TypeResolver resolves extension field types for descriptor options.
 	// If nil, it uses protoregistry.GlobalTypes.
 	TypeResolver interface {
-		preg.ExtensionTypeResolver
+		protoregistry.ExtensionTypeResolver
 	}
 
 	// FileRegistry is use to lookup file, enum, and message dependencies.
@@ -46,8 +45,8 @@
 	// If nil, it uses protoregistry.GlobalFiles.
 	FileRegistry interface {
 		FindFileByPath(string) (protoreflect.FileDescriptor, error)
-		FindDescriptorByName(pref.FullName) (pref.Descriptor, error)
-		RegisterFile(pref.FileDescriptor) error
+		FindDescriptorByName(protoreflect.FullName) (protoreflect.Descriptor, error)
+		RegisterFile(protoreflect.FileDescriptor) error
 	}
 }
 
@@ -55,8 +54,8 @@
 // If so, it permits looking up an enum or message dependency based on the
 // sub-list and element index into filetype.Builder.DependencyIndexes.
 type resolverByIndex interface {
-	FindEnumByIndex(int32, int32, []Enum, []Message) pref.EnumDescriptor
-	FindMessageByIndex(int32, int32, []Enum, []Message) pref.MessageDescriptor
+	FindEnumByIndex(int32, int32, []Enum, []Message) protoreflect.EnumDescriptor
+	FindMessageByIndex(int32, int32, []Enum, []Message) protoreflect.MessageDescriptor
 }
 
 // Indexes of each sub-list in filetype.Builder.DependencyIndexes.
@@ -70,7 +69,7 @@
 
 // Out is the output of the Builder.
 type Out struct {
-	File pref.FileDescriptor
+	File protoreflect.FileDescriptor
 
 	// Enums is all enum descriptors in "flattened ordering".
 	Enums []Enum
@@ -97,10 +96,10 @@
 
 	// Initialize resolvers and registries if unpopulated.
 	if db.TypeResolver == nil {
-		db.TypeResolver = preg.GlobalTypes
+		db.TypeResolver = protoregistry.GlobalTypes
 	}
 	if db.FileRegistry == nil {
-		db.FileRegistry = preg.GlobalFiles
+		db.FileRegistry = protoregistry.GlobalFiles
 	}
 
 	fd := newRawFile(db)
diff --git a/internal/filedesc/desc_list.go b/internal/filedesc/desc_list.go
index aa294ff..e3b6587 100644
--- a/internal/filedesc/desc_list.go
+++ b/internal/filedesc/desc_list.go
@@ -17,31 +17,30 @@
 	"google.golang.org/protobuf/internal/errors"
 	"google.golang.org/protobuf/internal/pragma"
 	"google.golang.org/protobuf/reflect/protoreflect"
-	pref "google.golang.org/protobuf/reflect/protoreflect"
 )
 
-type FileImports []pref.FileImport
+type FileImports []protoreflect.FileImport
 
 func (p *FileImports) Len() int                            { return len(*p) }
-func (p *FileImports) Get(i int) pref.FileImport           { return (*p)[i] }
+func (p *FileImports) Get(i int) protoreflect.FileImport   { return (*p)[i] }
 func (p *FileImports) Format(s fmt.State, r rune)          { descfmt.FormatList(s, r, p) }
 func (p *FileImports) ProtoInternal(pragma.DoNotImplement) {}
 
 type Names struct {
-	List []pref.Name
+	List []protoreflect.Name
 	once sync.Once
-	has  map[pref.Name]int // protected by once
+	has  map[protoreflect.Name]int // protected by once
 }
 
 func (p *Names) Len() int                            { return len(p.List) }
-func (p *Names) Get(i int) pref.Name                 { return p.List[i] }
-func (p *Names) Has(s pref.Name) bool                { return p.lazyInit().has[s] > 0 }
+func (p *Names) Get(i int) protoreflect.Name         { return p.List[i] }
+func (p *Names) Has(s protoreflect.Name) bool        { return p.lazyInit().has[s] > 0 }
 func (p *Names) Format(s fmt.State, r rune)          { descfmt.FormatList(s, r, p) }
 func (p *Names) ProtoInternal(pragma.DoNotImplement) {}
 func (p *Names) lazyInit() *Names {
 	p.once.Do(func() {
 		if len(p.List) > 0 {
-			p.has = make(map[pref.Name]int, len(p.List))
+			p.has = make(map[protoreflect.Name]int, len(p.List))
 			for _, s := range p.List {
 				p.has[s] = p.has[s] + 1
 			}
@@ -67,14 +66,14 @@
 }
 
 type EnumRanges struct {
-	List   [][2]pref.EnumNumber // start inclusive; end inclusive
+	List   [][2]protoreflect.EnumNumber // start inclusive; end inclusive
 	once   sync.Once
-	sorted [][2]pref.EnumNumber // protected by once
+	sorted [][2]protoreflect.EnumNumber // protected by once
 }
 
-func (p *EnumRanges) Len() int                     { return len(p.List) }
-func (p *EnumRanges) Get(i int) [2]pref.EnumNumber { return p.List[i] }
-func (p *EnumRanges) Has(n pref.EnumNumber) bool {
+func (p *EnumRanges) Len() int                             { return len(p.List) }
+func (p *EnumRanges) Get(i int) [2]protoreflect.EnumNumber { return p.List[i] }
+func (p *EnumRanges) Has(n protoreflect.EnumNumber) bool {
 	for ls := p.lazyInit().sorted; len(ls) > 0; {
 		i := len(ls) / 2
 		switch r := enumRange(ls[i]); {
@@ -129,14 +128,14 @@
 }
 
 type FieldRanges struct {
-	List   [][2]pref.FieldNumber // start inclusive; end exclusive
+	List   [][2]protoreflect.FieldNumber // start inclusive; end exclusive
 	once   sync.Once
-	sorted [][2]pref.FieldNumber // protected by once
+	sorted [][2]protoreflect.FieldNumber // protected by once
 }
 
-func (p *FieldRanges) Len() int                      { return len(p.List) }
-func (p *FieldRanges) Get(i int) [2]pref.FieldNumber { return p.List[i] }
-func (p *FieldRanges) Has(n pref.FieldNumber) bool {
+func (p *FieldRanges) Len() int                              { return len(p.List) }
+func (p *FieldRanges) Get(i int) [2]protoreflect.FieldNumber { return p.List[i] }
+func (p *FieldRanges) Has(n protoreflect.FieldNumber) bool {
 	for ls := p.lazyInit().sorted; len(ls) > 0; {
 		i := len(ls) / 2
 		switch r := fieldRange(ls[i]); {
@@ -221,17 +220,17 @@
 }
 
 type FieldNumbers struct {
-	List []pref.FieldNumber
+	List []protoreflect.FieldNumber
 	once sync.Once
-	has  map[pref.FieldNumber]struct{} // protected by once
+	has  map[protoreflect.FieldNumber]struct{} // protected by once
 }
 
-func (p *FieldNumbers) Len() int                   { return len(p.List) }
-func (p *FieldNumbers) Get(i int) pref.FieldNumber { return p.List[i] }
-func (p *FieldNumbers) Has(n pref.FieldNumber) bool {
+func (p *FieldNumbers) Len() int                           { return len(p.List) }
+func (p *FieldNumbers) Get(i int) protoreflect.FieldNumber { return p.List[i] }
+func (p *FieldNumbers) Has(n protoreflect.FieldNumber) bool {
 	p.once.Do(func() {
 		if len(p.List) > 0 {
-			p.has = make(map[pref.FieldNumber]struct{}, len(p.List))
+			p.has = make(map[protoreflect.FieldNumber]struct{}, len(p.List))
 			for _, n := range p.List {
 				p.has[n] = struct{}{}
 			}
@@ -244,30 +243,38 @@
 func (p *FieldNumbers) ProtoInternal(pragma.DoNotImplement) {}
 
 type OneofFields struct {
-	List   []pref.FieldDescriptor
+	List   []protoreflect.FieldDescriptor
 	once   sync.Once
-	byName map[pref.Name]pref.FieldDescriptor        // protected by once
-	byJSON map[string]pref.FieldDescriptor           // protected by once
-	byText map[string]pref.FieldDescriptor           // protected by once
-	byNum  map[pref.FieldNumber]pref.FieldDescriptor // protected by once
+	byName map[protoreflect.Name]protoreflect.FieldDescriptor        // protected by once
+	byJSON map[string]protoreflect.FieldDescriptor                   // protected by once
+	byText map[string]protoreflect.FieldDescriptor                   // protected by once
+	byNum  map[protoreflect.FieldNumber]protoreflect.FieldDescriptor // protected by once
 }
 
-func (p *OneofFields) Len() int                                         { return len(p.List) }
-func (p *OneofFields) Get(i int) pref.FieldDescriptor                   { return p.List[i] }
-func (p *OneofFields) ByName(s pref.Name) pref.FieldDescriptor          { return p.lazyInit().byName[s] }
-func (p *OneofFields) ByJSONName(s string) pref.FieldDescriptor         { return p.lazyInit().byJSON[s] }
-func (p *OneofFields) ByTextName(s string) pref.FieldDescriptor         { return p.lazyInit().byText[s] }
-func (p *OneofFields) ByNumber(n pref.FieldNumber) pref.FieldDescriptor { return p.lazyInit().byNum[n] }
-func (p *OneofFields) Format(s fmt.State, r rune)                       { descfmt.FormatList(s, r, p) }
-func (p *OneofFields) ProtoInternal(pragma.DoNotImplement)              {}
+func (p *OneofFields) Len() int                               { return len(p.List) }
+func (p *OneofFields) Get(i int) protoreflect.FieldDescriptor { return p.List[i] }
+func (p *OneofFields) ByName(s protoreflect.Name) protoreflect.FieldDescriptor {
+	return p.lazyInit().byName[s]
+}
+func (p *OneofFields) ByJSONName(s string) protoreflect.FieldDescriptor {
+	return p.lazyInit().byJSON[s]
+}
+func (p *OneofFields) ByTextName(s string) protoreflect.FieldDescriptor {
+	return p.lazyInit().byText[s]
+}
+func (p *OneofFields) ByNumber(n protoreflect.FieldNumber) protoreflect.FieldDescriptor {
+	return p.lazyInit().byNum[n]
+}
+func (p *OneofFields) Format(s fmt.State, r rune)          { descfmt.FormatList(s, r, p) }
+func (p *OneofFields) ProtoInternal(pragma.DoNotImplement) {}
 
 func (p *OneofFields) lazyInit() *OneofFields {
 	p.once.Do(func() {
 		if len(p.List) > 0 {
-			p.byName = make(map[pref.Name]pref.FieldDescriptor, len(p.List))
-			p.byJSON = make(map[string]pref.FieldDescriptor, len(p.List))
-			p.byText = make(map[string]pref.FieldDescriptor, len(p.List))
-			p.byNum = make(map[pref.FieldNumber]pref.FieldDescriptor, len(p.List))
+			p.byName = make(map[protoreflect.Name]protoreflect.FieldDescriptor, len(p.List))
+			p.byJSON = make(map[string]protoreflect.FieldDescriptor, len(p.List))
+			p.byText = make(map[string]protoreflect.FieldDescriptor, len(p.List))
+			p.byNum = make(map[protoreflect.FieldNumber]protoreflect.FieldDescriptor, len(p.List))
 			for _, f := range p.List {
 				// Field names and numbers are guaranteed to be unique.
 				p.byName[f.Name()] = f
@@ -284,123 +291,123 @@
 	// List is a list of SourceLocations.
 	// The SourceLocation.Next field does not need to be populated
 	// as it will be lazily populated upon first need.
-	List []pref.SourceLocation
+	List []protoreflect.SourceLocation
 
 	// File is the parent file descriptor that these locations are relative to.
 	// If non-nil, ByDescriptor verifies that the provided descriptor
 	// is a child of this file descriptor.
-	File pref.FileDescriptor
+	File protoreflect.FileDescriptor
 
 	once   sync.Once
 	byPath map[pathKey]int
 }
 
-func (p *SourceLocations) Len() int                      { return len(p.List) }
-func (p *SourceLocations) Get(i int) pref.SourceLocation { return p.lazyInit().List[i] }
-func (p *SourceLocations) byKey(k pathKey) pref.SourceLocation {
+func (p *SourceLocations) Len() int                              { return len(p.List) }
+func (p *SourceLocations) Get(i int) protoreflect.SourceLocation { return p.lazyInit().List[i] }
+func (p *SourceLocations) byKey(k pathKey) protoreflect.SourceLocation {
 	if i, ok := p.lazyInit().byPath[k]; ok {
 		return p.List[i]
 	}
-	return pref.SourceLocation{}
+	return protoreflect.SourceLocation{}
 }
-func (p *SourceLocations) ByPath(path pref.SourcePath) pref.SourceLocation {
+func (p *SourceLocations) ByPath(path protoreflect.SourcePath) protoreflect.SourceLocation {
 	return p.byKey(newPathKey(path))
 }
-func (p *SourceLocations) ByDescriptor(desc pref.Descriptor) pref.SourceLocation {
+func (p *SourceLocations) ByDescriptor(desc protoreflect.Descriptor) protoreflect.SourceLocation {
 	if p.File != nil && desc != nil && p.File != desc.ParentFile() {
-		return pref.SourceLocation{} // mismatching parent files
+		return protoreflect.SourceLocation{} // mismatching parent files
 	}
 	var pathArr [16]int32
 	path := pathArr[:0]
 	for {
 		switch desc.(type) {
-		case pref.FileDescriptor:
+		case protoreflect.FileDescriptor:
 			// Reverse the path since it was constructed in reverse.
 			for i, j := 0, len(path)-1; i < j; i, j = i+1, j-1 {
 				path[i], path[j] = path[j], path[i]
 			}
 			return p.byKey(newPathKey(path))
-		case pref.MessageDescriptor:
+		case protoreflect.MessageDescriptor:
 			path = append(path, int32(desc.Index()))
 			desc = desc.Parent()
 			switch desc.(type) {
-			case pref.FileDescriptor:
+			case protoreflect.FileDescriptor:
 				path = append(path, int32(genid.FileDescriptorProto_MessageType_field_number))
-			case pref.MessageDescriptor:
+			case protoreflect.MessageDescriptor:
 				path = append(path, int32(genid.DescriptorProto_NestedType_field_number))
 			default:
-				return pref.SourceLocation{}
+				return protoreflect.SourceLocation{}
 			}
-		case pref.FieldDescriptor:
-			isExtension := desc.(pref.FieldDescriptor).IsExtension()
+		case protoreflect.FieldDescriptor:
+			isExtension := desc.(protoreflect.FieldDescriptor).IsExtension()
 			path = append(path, int32(desc.Index()))
 			desc = desc.Parent()
 			if isExtension {
 				switch desc.(type) {
-				case pref.FileDescriptor:
+				case protoreflect.FileDescriptor:
 					path = append(path, int32(genid.FileDescriptorProto_Extension_field_number))
-				case pref.MessageDescriptor:
+				case protoreflect.MessageDescriptor:
 					path = append(path, int32(genid.DescriptorProto_Extension_field_number))
 				default:
-					return pref.SourceLocation{}
+					return protoreflect.SourceLocation{}
 				}
 			} else {
 				switch desc.(type) {
-				case pref.MessageDescriptor:
+				case protoreflect.MessageDescriptor:
 					path = append(path, int32(genid.DescriptorProto_Field_field_number))
 				default:
-					return pref.SourceLocation{}
+					return protoreflect.SourceLocation{}
 				}
 			}
-		case pref.OneofDescriptor:
+		case protoreflect.OneofDescriptor:
 			path = append(path, int32(desc.Index()))
 			desc = desc.Parent()
 			switch desc.(type) {
-			case pref.MessageDescriptor:
+			case protoreflect.MessageDescriptor:
 				path = append(path, int32(genid.DescriptorProto_OneofDecl_field_number))
 			default:
-				return pref.SourceLocation{}
+				return protoreflect.SourceLocation{}
 			}
-		case pref.EnumDescriptor:
+		case protoreflect.EnumDescriptor:
 			path = append(path, int32(desc.Index()))
 			desc = desc.Parent()
 			switch desc.(type) {
-			case pref.FileDescriptor:
+			case protoreflect.FileDescriptor:
 				path = append(path, int32(genid.FileDescriptorProto_EnumType_field_number))
-			case pref.MessageDescriptor:
+			case protoreflect.MessageDescriptor:
 				path = append(path, int32(genid.DescriptorProto_EnumType_field_number))
 			default:
-				return pref.SourceLocation{}
+				return protoreflect.SourceLocation{}
 			}
-		case pref.EnumValueDescriptor:
+		case protoreflect.EnumValueDescriptor:
 			path = append(path, int32(desc.Index()))
 			desc = desc.Parent()
 			switch desc.(type) {
-			case pref.EnumDescriptor:
+			case protoreflect.EnumDescriptor:
 				path = append(path, int32(genid.EnumDescriptorProto_Value_field_number))
 			default:
-				return pref.SourceLocation{}
+				return protoreflect.SourceLocation{}
 			}
-		case pref.ServiceDescriptor:
+		case protoreflect.ServiceDescriptor:
 			path = append(path, int32(desc.Index()))
 			desc = desc.Parent()
 			switch desc.(type) {
-			case pref.FileDescriptor:
+			case protoreflect.FileDescriptor:
 				path = append(path, int32(genid.FileDescriptorProto_Service_field_number))
 			default:
-				return pref.SourceLocation{}
+				return protoreflect.SourceLocation{}
 			}
-		case pref.MethodDescriptor:
+		case protoreflect.MethodDescriptor:
 			path = append(path, int32(desc.Index()))
 			desc = desc.Parent()
 			switch desc.(type) {
-			case pref.ServiceDescriptor:
+			case protoreflect.ServiceDescriptor:
 				path = append(path, int32(genid.ServiceDescriptorProto_Method_field_number))
 			default:
-				return pref.SourceLocation{}
+				return protoreflect.SourceLocation{}
 			}
 		default:
-			return pref.SourceLocation{}
+			return protoreflect.SourceLocation{}
 		}
 	}
 }
@@ -435,7 +442,7 @@
 	str string    // used if the path does not fit in arr
 }
 
-func newPathKey(p pref.SourcePath) (k pathKey) {
+func newPathKey(p protoreflect.SourcePath) (k pathKey) {
 	if len(p) < len(k.arr) {
 		for i, ps := range p {
 			if ps < 0 || math.MaxUint8 <= ps {
diff --git a/internal/impl/decode.go b/internal/impl/decode.go
index c65b032..cda0520 100644
--- a/internal/impl/decode.go
+++ b/internal/impl/decode.go
@@ -12,9 +12,8 @@
 	"google.golang.org/protobuf/internal/flags"
 	"google.golang.org/protobuf/proto"
 	"google.golang.org/protobuf/reflect/protoreflect"
-	preg "google.golang.org/protobuf/reflect/protoregistry"
+	"google.golang.org/protobuf/reflect/protoregistry"
 	"google.golang.org/protobuf/runtime/protoiface"
-	piface "google.golang.org/protobuf/runtime/protoiface"
 )
 
 var errDecode = errors.New("cannot parse invalid wire-format data")
@@ -38,14 +37,16 @@
 	}
 }
 
-func (o unmarshalOptions) DiscardUnknown() bool { return o.flags&piface.UnmarshalDiscardUnknown != 0 }
+func (o unmarshalOptions) DiscardUnknown() bool {
+	return o.flags&protoiface.UnmarshalDiscardUnknown != 0
+}
 
 func (o unmarshalOptions) IsDefault() bool {
-	return o.flags == 0 && o.resolver == preg.GlobalTypes
+	return o.flags == 0 && o.resolver == protoregistry.GlobalTypes
 }
 
 var lazyUnmarshalOptions = unmarshalOptions{
-	resolver: preg.GlobalTypes,
+	resolver: protoregistry.GlobalTypes,
 	depth:    protowire.DefaultRecursionLimit,
 }
 
@@ -55,7 +56,7 @@
 }
 
 // unmarshal is protoreflect.Methods.Unmarshal.
-func (mi *MessageInfo) unmarshal(in piface.UnmarshalInput) (piface.UnmarshalOutput, error) {
+func (mi *MessageInfo) unmarshal(in protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
 	var p pointer
 	if ms, ok := in.Message.(*messageState); ok {
 		p = ms.pointer()
@@ -67,11 +68,11 @@
 		resolver: in.Resolver,
 		depth:    in.Depth,
 	})
-	var flags piface.UnmarshalOutputFlags
+	var flags protoiface.UnmarshalOutputFlags
 	if out.initialized {
-		flags |= piface.UnmarshalInitialized
+		flags |= protoiface.UnmarshalInitialized
 	}
-	return piface.UnmarshalOutput{
+	return protoiface.UnmarshalOutput{
 		Flags: flags,
 	}, err
 }
@@ -210,7 +211,7 @@
 		var err error
 		xt, err = opts.resolver.FindExtensionByNumber(mi.Desc.FullName(), num)
 		if err != nil {
-			if err == preg.NotFound {
+			if err == protoregistry.NotFound {
 				return out, errUnknown
 			}
 			return out, errors.New("%v: unable to resolve extension %v: %v", mi.Desc.FullName(), num, err)
diff --git a/internal/impl/legacy_enum.go b/internal/impl/legacy_enum.go
index f7d7ffb..c2a803b 100644
--- a/internal/impl/legacy_enum.go
+++ b/internal/impl/legacy_enum.go
@@ -13,13 +13,12 @@
 	"google.golang.org/protobuf/internal/filedesc"
 	"google.golang.org/protobuf/internal/strs"
 	"google.golang.org/protobuf/reflect/protoreflect"
-	pref "google.golang.org/protobuf/reflect/protoreflect"
 )
 
 // legacyEnumName returns the name of enums used in legacy code.
 // It is neither the protobuf full name nor the qualified Go name,
 // but rather an odd hybrid of both.
-func legacyEnumName(ed pref.EnumDescriptor) string {
+func legacyEnumName(ed protoreflect.EnumDescriptor) string {
 	var protoPkg string
 	enumName := string(ed.FullName())
 	if fd := ed.ParentFile(); fd != nil {
@@ -34,68 +33,68 @@
 
 // legacyWrapEnum wraps v as a protoreflect.Enum,
 // where v must be a int32 kind and not implement the v2 API already.
-func legacyWrapEnum(v reflect.Value) pref.Enum {
+func legacyWrapEnum(v reflect.Value) protoreflect.Enum {
 	et := legacyLoadEnumType(v.Type())
-	return et.New(pref.EnumNumber(v.Int()))
+	return et.New(protoreflect.EnumNumber(v.Int()))
 }
 
 var legacyEnumTypeCache sync.Map // map[reflect.Type]protoreflect.EnumType
 
 // legacyLoadEnumType dynamically loads a protoreflect.EnumType for t,
 // where t must be an int32 kind and not implement the v2 API already.
-func legacyLoadEnumType(t reflect.Type) pref.EnumType {
+func legacyLoadEnumType(t reflect.Type) protoreflect.EnumType {
 	// Fast-path: check if a EnumType is cached for this concrete type.
 	if et, ok := legacyEnumTypeCache.Load(t); ok {
-		return et.(pref.EnumType)
+		return et.(protoreflect.EnumType)
 	}
 
 	// Slow-path: derive enum descriptor and initialize EnumType.
-	var et pref.EnumType
+	var et protoreflect.EnumType
 	ed := LegacyLoadEnumDesc(t)
 	et = &legacyEnumType{
 		desc:   ed,
 		goType: t,
 	}
 	if et, ok := legacyEnumTypeCache.LoadOrStore(t, et); ok {
-		return et.(pref.EnumType)
+		return et.(protoreflect.EnumType)
 	}
 	return et
 }
 
 type legacyEnumType struct {
-	desc   pref.EnumDescriptor
+	desc   protoreflect.EnumDescriptor
 	goType reflect.Type
 	m      sync.Map // map[protoreflect.EnumNumber]proto.Enum
 }
 
-func (t *legacyEnumType) New(n pref.EnumNumber) pref.Enum {
+func (t *legacyEnumType) New(n protoreflect.EnumNumber) protoreflect.Enum {
 	if e, ok := t.m.Load(n); ok {
-		return e.(pref.Enum)
+		return e.(protoreflect.Enum)
 	}
 	e := &legacyEnumWrapper{num: n, pbTyp: t, goTyp: t.goType}
 	t.m.Store(n, e)
 	return e
 }
-func (t *legacyEnumType) Descriptor() pref.EnumDescriptor {
+func (t *legacyEnumType) Descriptor() protoreflect.EnumDescriptor {
 	return t.desc
 }
 
 type legacyEnumWrapper struct {
-	num   pref.EnumNumber
-	pbTyp pref.EnumType
+	num   protoreflect.EnumNumber
+	pbTyp protoreflect.EnumType
 	goTyp reflect.Type
 }
 
-func (e *legacyEnumWrapper) Descriptor() pref.EnumDescriptor {
+func (e *legacyEnumWrapper) Descriptor() protoreflect.EnumDescriptor {
 	return e.pbTyp.Descriptor()
 }
-func (e *legacyEnumWrapper) Type() pref.EnumType {
+func (e *legacyEnumWrapper) Type() protoreflect.EnumType {
 	return e.pbTyp
 }
-func (e *legacyEnumWrapper) Number() pref.EnumNumber {
+func (e *legacyEnumWrapper) Number() protoreflect.EnumNumber {
 	return e.num
 }
-func (e *legacyEnumWrapper) ProtoReflect() pref.Enum {
+func (e *legacyEnumWrapper) ProtoReflect() protoreflect.Enum {
 	return e
 }
 func (e *legacyEnumWrapper) protoUnwrap() interface{} {
@@ -105,8 +104,8 @@
 }
 
 var (
-	_ pref.Enum = (*legacyEnumWrapper)(nil)
-	_ unwrapper = (*legacyEnumWrapper)(nil)
+	_ protoreflect.Enum = (*legacyEnumWrapper)(nil)
+	_ unwrapper         = (*legacyEnumWrapper)(nil)
 )
 
 var legacyEnumDescCache sync.Map // map[reflect.Type]protoreflect.EnumDescriptor
@@ -115,15 +114,15 @@
 // which must be an int32 kind and not implement the v2 API already.
 //
 // This is exported for testing purposes.
-func LegacyLoadEnumDesc(t reflect.Type) pref.EnumDescriptor {
+func LegacyLoadEnumDesc(t reflect.Type) protoreflect.EnumDescriptor {
 	// Fast-path: check if an EnumDescriptor is cached for this concrete type.
 	if ed, ok := legacyEnumDescCache.Load(t); ok {
-		return ed.(pref.EnumDescriptor)
+		return ed.(protoreflect.EnumDescriptor)
 	}
 
 	// Slow-path: initialize EnumDescriptor from the raw descriptor.
 	ev := reflect.Zero(t).Interface()
-	if _, ok := ev.(pref.Enum); ok {
+	if _, ok := ev.(protoreflect.Enum); ok {
 		panic(fmt.Sprintf("%v already implements proto.Enum", t))
 	}
 	edV1, ok := ev.(enumV1)
@@ -132,7 +131,7 @@
 	}
 	b, idxs := edV1.EnumDescriptor()
 
-	var ed pref.EnumDescriptor
+	var ed protoreflect.EnumDescriptor
 	if len(idxs) == 1 {
 		ed = legacyLoadFileDesc(b).Enums().Get(idxs[0])
 	} else {
@@ -158,10 +157,10 @@
 // We are unable to use the global enum registry since it is
 // unfortunately keyed by the protobuf full name, which we also do not know.
 // Thus, this produces some bogus enum descriptor based on the Go type name.
-func aberrantLoadEnumDesc(t reflect.Type) pref.EnumDescriptor {
+func aberrantLoadEnumDesc(t reflect.Type) protoreflect.EnumDescriptor {
 	// Fast-path: check if an EnumDescriptor is cached for this concrete type.
 	if ed, ok := aberrantEnumDescCache.Load(t); ok {
-		return ed.(pref.EnumDescriptor)
+		return ed.(protoreflect.EnumDescriptor)
 	}
 
 	// Slow-path: construct a bogus, but unique EnumDescriptor.
@@ -182,7 +181,7 @@
 	// An exhaustive query is clearly impractical, but can be best-effort.
 
 	if ed, ok := aberrantEnumDescCache.LoadOrStore(t, ed); ok {
-		return ed.(pref.EnumDescriptor)
+		return ed.(protoreflect.EnumDescriptor)
 	}
 	return ed
 }
@@ -192,7 +191,7 @@
 // It should be sufficiently unique within a program.
 //
 // This is exported for testing purposes.
-func AberrantDeriveFullName(t reflect.Type) pref.FullName {
+func AberrantDeriveFullName(t reflect.Type) protoreflect.FullName {
 	sanitize := func(r rune) rune {
 		switch {
 		case r == '/':
@@ -215,5 +214,5 @@
 			ss[i] = "x" + s
 		}
 	}
-	return pref.FullName(strings.Join(ss, "."))
+	return protoreflect.FullName(strings.Join(ss, "."))
 }
diff --git a/internal/impl/legacy_message.go b/internal/impl/legacy_message.go
index 029feee..61c483f 100644
--- a/internal/impl/legacy_message.go
+++ b/internal/impl/legacy_message.go
@@ -16,14 +16,12 @@
 	"google.golang.org/protobuf/internal/filedesc"
 	"google.golang.org/protobuf/internal/strs"
 	"google.golang.org/protobuf/reflect/protoreflect"
-	pref "google.golang.org/protobuf/reflect/protoreflect"
 	"google.golang.org/protobuf/runtime/protoiface"
-	piface "google.golang.org/protobuf/runtime/protoiface"
 )
 
 // legacyWrapMessage wraps v as a protoreflect.Message,
 // where v must be a *struct kind and not implement the v2 API already.
-func legacyWrapMessage(v reflect.Value) pref.Message {
+func legacyWrapMessage(v reflect.Value) protoreflect.Message {
 	t := v.Type()
 	if t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct {
 		return aberrantMessage{v: v}
@@ -35,7 +33,7 @@
 // legacyLoadMessageType dynamically loads a protoreflect.Type for t,
 // where t must be not implement the v2 API already.
 // The provided name is used if it cannot be determined from the message.
-func legacyLoadMessageType(t reflect.Type, name pref.FullName) protoreflect.MessageType {
+func legacyLoadMessageType(t reflect.Type, name protoreflect.FullName) protoreflect.MessageType {
 	if t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct {
 		return aberrantMessageType{t}
 	}
@@ -47,7 +45,7 @@
 // legacyLoadMessageInfo dynamically loads a *MessageInfo for t,
 // where t must be a *struct kind and not implement the v2 API already.
 // The provided name is used if it cannot be determined from the message.
-func legacyLoadMessageInfo(t reflect.Type, name pref.FullName) *MessageInfo {
+func legacyLoadMessageInfo(t reflect.Type, name protoreflect.FullName) *MessageInfo {
 	// Fast-path: check if a MessageInfo is cached for this concrete type.
 	if mt, ok := legacyMessageTypeCache.Load(t); ok {
 		return mt.(*MessageInfo)
@@ -68,7 +66,7 @@
 		// supports deterministic serialization or not, but this
 		// preserves the v1 implementation's behavior of always
 		// calling Marshal methods when present.
-		mi.methods.Flags |= piface.SupportMarshalDeterministic
+		mi.methods.Flags |= protoiface.SupportMarshalDeterministic
 	}
 	if _, hasUnmarshal = v.(legacyUnmarshaler); hasUnmarshal {
 		mi.methods.Unmarshal = legacyUnmarshal
@@ -89,18 +87,18 @@
 // which should be a *struct kind and must not implement the v2 API already.
 //
 // This is exported for testing purposes.
-func LegacyLoadMessageDesc(t reflect.Type) pref.MessageDescriptor {
+func LegacyLoadMessageDesc(t reflect.Type) protoreflect.MessageDescriptor {
 	return legacyLoadMessageDesc(t, "")
 }
-func legacyLoadMessageDesc(t reflect.Type, name pref.FullName) pref.MessageDescriptor {
+func legacyLoadMessageDesc(t reflect.Type, name protoreflect.FullName) protoreflect.MessageDescriptor {
 	// Fast-path: check if a MessageDescriptor is cached for this concrete type.
 	if mi, ok := legacyMessageDescCache.Load(t); ok {
-		return mi.(pref.MessageDescriptor)
+		return mi.(protoreflect.MessageDescriptor)
 	}
 
 	// Slow-path: initialize MessageDescriptor from the raw descriptor.
 	mv := reflect.Zero(t).Interface()
-	if _, ok := mv.(pref.ProtoMessage); ok {
+	if _, ok := mv.(protoreflect.ProtoMessage); ok {
 		panic(fmt.Sprintf("%v already implements proto.Message", t))
 	}
 	mdV1, ok := mv.(messageV1)
@@ -164,7 +162,7 @@
 //
 // This is a best-effort derivation of the message descriptor using the protobuf
 // tags on the struct fields.
-func aberrantLoadMessageDesc(t reflect.Type, name pref.FullName) pref.MessageDescriptor {
+func aberrantLoadMessageDesc(t reflect.Type, name protoreflect.FullName) protoreflect.MessageDescriptor {
 	aberrantMessageDescLock.Lock()
 	defer aberrantMessageDescLock.Unlock()
 	if aberrantMessageDescCache == nil {
@@ -172,7 +170,7 @@
 	}
 	return aberrantLoadMessageDescReentrant(t, name)
 }
-func aberrantLoadMessageDescReentrant(t reflect.Type, name pref.FullName) pref.MessageDescriptor {
+func aberrantLoadMessageDescReentrant(t reflect.Type, name protoreflect.FullName) protoreflect.MessageDescriptor {
 	// Fast-path: check if an MessageDescriptor is cached for this concrete type.
 	if md, ok := aberrantMessageDescCache[t]; ok {
 		return md
@@ -225,9 +223,9 @@
 		vs := fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[0]
 		for i := 0; i < vs.Len(); i++ {
 			v := vs.Index(i)
-			md.L2.ExtensionRanges.List = append(md.L2.ExtensionRanges.List, [2]pref.FieldNumber{
-				pref.FieldNumber(v.FieldByName("Start").Int()),
-				pref.FieldNumber(v.FieldByName("End").Int() + 1),
+			md.L2.ExtensionRanges.List = append(md.L2.ExtensionRanges.List, [2]protoreflect.FieldNumber{
+				protoreflect.FieldNumber(v.FieldByName("Start").Int()),
+				protoreflect.FieldNumber(v.FieldByName("End").Int() + 1),
 			})
 			md.L2.ExtensionRangeOptions = append(md.L2.ExtensionRangeOptions, nil)
 		}
@@ -245,7 +243,7 @@
 			n := len(md.L2.Oneofs.List)
 			md.L2.Oneofs.List = append(md.L2.Oneofs.List, filedesc.Oneof{})
 			od := &md.L2.Oneofs.List[n]
-			od.L0.FullName = md.FullName().Append(pref.Name(tag))
+			od.L0.FullName = md.FullName().Append(protoreflect.Name(tag))
 			od.L0.ParentFile = md.L0.ParentFile
 			od.L0.Parent = md
 			od.L0.Index = n
@@ -267,14 +265,14 @@
 	return md
 }
 
-func aberrantDeriveMessageName(t reflect.Type, name pref.FullName) pref.FullName {
+func aberrantDeriveMessageName(t reflect.Type, name protoreflect.FullName) protoreflect.FullName {
 	if name.IsValid() {
 		return name
 	}
 	func() {
 		defer func() { recover() }() // swallow possible nil panics
 		if m, ok := reflect.Zero(t).Interface().(interface{ XXX_MessageName() string }); ok {
-			name = pref.FullName(m.XXX_MessageName())
+			name = protoreflect.FullName(m.XXX_MessageName())
 		}
 	}()
 	if name.IsValid() {
@@ -305,7 +303,7 @@
 	fd.L0.Index = n
 
 	if fd.L1.IsWeak || fd.L1.HasPacked {
-		fd.L1.Options = func() pref.ProtoMessage {
+		fd.L1.Options = func() protoreflect.ProtoMessage {
 			opts := descopts.Field.ProtoReflect().New()
 			if fd.L1.IsWeak {
 				opts.Set(opts.Descriptor().Fields().ByName("weak"), protoreflect.ValueOfBool(true))
@@ -318,17 +316,17 @@
 	}
 
 	// Populate Enum and Message.
-	if fd.Enum() == nil && fd.Kind() == pref.EnumKind {
+	if fd.Enum() == nil && fd.Kind() == protoreflect.EnumKind {
 		switch v := reflect.Zero(t).Interface().(type) {
-		case pref.Enum:
+		case protoreflect.Enum:
 			fd.L1.Enum = v.Descriptor()
 		default:
 			fd.L1.Enum = LegacyLoadEnumDesc(t)
 		}
 	}
-	if fd.Message() == nil && (fd.Kind() == pref.MessageKind || fd.Kind() == pref.GroupKind) {
+	if fd.Message() == nil && (fd.Kind() == protoreflect.MessageKind || fd.Kind() == protoreflect.GroupKind) {
 		switch v := reflect.Zero(t).Interface().(type) {
-		case pref.ProtoMessage:
+		case protoreflect.ProtoMessage:
 			fd.L1.Message = v.ProtoReflect().Descriptor()
 		case messageV1:
 			fd.L1.Message = LegacyLoadMessageDesc(t)
@@ -337,13 +335,13 @@
 				n := len(md.L1.Messages.List)
 				md.L1.Messages.List = append(md.L1.Messages.List, filedesc.Message{L2: new(filedesc.MessageL2)})
 				md2 := &md.L1.Messages.List[n]
-				md2.L0.FullName = md.FullName().Append(pref.Name(strs.MapEntryName(string(fd.Name()))))
+				md2.L0.FullName = md.FullName().Append(protoreflect.Name(strs.MapEntryName(string(fd.Name()))))
 				md2.L0.ParentFile = md.L0.ParentFile
 				md2.L0.Parent = md
 				md2.L0.Index = n
 
 				md2.L1.IsMapEntry = true
-				md2.L2.Options = func() pref.ProtoMessage {
+				md2.L2.Options = func() protoreflect.ProtoMessage {
 					opts := descopts.Message.ProtoReflect().New()
 					opts.Set(opts.Descriptor().Fields().ByName("map_entry"), protoreflect.ValueOfBool(true))
 					return opts.Interface()
@@ -364,8 +362,8 @@
 	protoreflect.EnumValueDescriptors
 }
 
-func (placeholderEnumValues) ByNumber(n pref.EnumNumber) pref.EnumValueDescriptor {
-	return filedesc.PlaceholderEnumValue(pref.FullName(fmt.Sprintf("UNKNOWN_%d", n)))
+func (placeholderEnumValues) ByNumber(n protoreflect.EnumNumber) protoreflect.EnumValueDescriptor {
+	return filedesc.PlaceholderEnumValue(protoreflect.FullName(fmt.Sprintf("UNKNOWN_%d", n)))
 }
 
 // legacyMarshaler is the proto.Marshaler interface superseded by protoiface.Methoder.
@@ -383,7 +381,7 @@
 	Merge(protoiface.MessageV1)
 }
 
-var aberrantProtoMethods = &piface.Methods{
+var aberrantProtoMethods = &protoiface.Methods{
 	Marshal:   legacyMarshal,
 	Unmarshal: legacyUnmarshal,
 	Merge:     legacyMerge,
@@ -392,40 +390,40 @@
 	// supports deterministic serialization or not, but this
 	// preserves the v1 implementation's behavior of always
 	// calling Marshal methods when present.
-	Flags: piface.SupportMarshalDeterministic,
+	Flags: protoiface.SupportMarshalDeterministic,
 }
 
-func legacyMarshal(in piface.MarshalInput) (piface.MarshalOutput, error) {
+func legacyMarshal(in protoiface.MarshalInput) (protoiface.MarshalOutput, error) {
 	v := in.Message.(unwrapper).protoUnwrap()
 	marshaler, ok := v.(legacyMarshaler)
 	if !ok {
-		return piface.MarshalOutput{}, errors.New("%T does not implement Marshal", v)
+		return protoiface.MarshalOutput{}, errors.New("%T does not implement Marshal", v)
 	}
 	out, err := marshaler.Marshal()
 	if in.Buf != nil {
 		out = append(in.Buf, out...)
 	}
-	return piface.MarshalOutput{
+	return protoiface.MarshalOutput{
 		Buf: out,
 	}, err
 }
 
-func legacyUnmarshal(in piface.UnmarshalInput) (piface.UnmarshalOutput, error) {
+func legacyUnmarshal(in protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
 	v := in.Message.(unwrapper).protoUnwrap()
 	unmarshaler, ok := v.(legacyUnmarshaler)
 	if !ok {
-		return piface.UnmarshalOutput{}, errors.New("%T does not implement Unmarshal", v)
+		return protoiface.UnmarshalOutput{}, errors.New("%T does not implement Unmarshal", v)
 	}
-	return piface.UnmarshalOutput{}, unmarshaler.Unmarshal(in.Buf)
+	return protoiface.UnmarshalOutput{}, unmarshaler.Unmarshal(in.Buf)
 }
 
-func legacyMerge(in piface.MergeInput) piface.MergeOutput {
+func legacyMerge(in protoiface.MergeInput) protoiface.MergeOutput {
 	// Check whether this supports the legacy merger.
 	dstv := in.Destination.(unwrapper).protoUnwrap()
 	merger, ok := dstv.(legacyMerger)
 	if ok {
 		merger.Merge(Export{}.ProtoMessageV1Of(in.Source))
-		return piface.MergeOutput{Flags: piface.MergeComplete}
+		return protoiface.MergeOutput{Flags: protoiface.MergeComplete}
 	}
 
 	// If legacy merger is unavailable, implement merge in terms of
@@ -433,29 +431,29 @@
 	srcv := in.Source.(unwrapper).protoUnwrap()
 	marshaler, ok := srcv.(legacyMarshaler)
 	if !ok {
-		return piface.MergeOutput{}
+		return protoiface.MergeOutput{}
 	}
 	dstv = in.Destination.(unwrapper).protoUnwrap()
 	unmarshaler, ok := dstv.(legacyUnmarshaler)
 	if !ok {
-		return piface.MergeOutput{}
+		return protoiface.MergeOutput{}
 	}
 	if !in.Source.IsValid() {
 		// Legacy Marshal methods may not function on nil messages.
 		// Check for a typed nil source only after we confirm that
 		// legacy Marshal/Unmarshal methods are present, for
 		// consistency.
-		return piface.MergeOutput{Flags: piface.MergeComplete}
+		return protoiface.MergeOutput{Flags: protoiface.MergeComplete}
 	}
 	b, err := marshaler.Marshal()
 	if err != nil {
-		return piface.MergeOutput{}
+		return protoiface.MergeOutput{}
 	}
 	err = unmarshaler.Unmarshal(b)
 	if err != nil {
-		return piface.MergeOutput{}
+		return protoiface.MergeOutput{}
 	}
-	return piface.MergeOutput{Flags: piface.MergeComplete}
+	return protoiface.MergeOutput{Flags: protoiface.MergeComplete}
 }
 
 // aberrantMessageType implements MessageType for all types other than pointer-to-struct.
@@ -463,19 +461,19 @@
 	t reflect.Type
 }
 
-func (mt aberrantMessageType) New() pref.Message {
+func (mt aberrantMessageType) New() protoreflect.Message {
 	if mt.t.Kind() == reflect.Ptr {
 		return aberrantMessage{reflect.New(mt.t.Elem())}
 	}
 	return aberrantMessage{reflect.Zero(mt.t)}
 }
-func (mt aberrantMessageType) Zero() pref.Message {
+func (mt aberrantMessageType) Zero() protoreflect.Message {
 	return aberrantMessage{reflect.Zero(mt.t)}
 }
 func (mt aberrantMessageType) GoType() reflect.Type {
 	return mt.t
 }
-func (mt aberrantMessageType) Descriptor() pref.MessageDescriptor {
+func (mt aberrantMessageType) Descriptor() protoreflect.MessageDescriptor {
 	return LegacyLoadMessageDesc(mt.t)
 }
 
@@ -499,56 +497,56 @@
 	}
 }
 
-func (m aberrantMessage) ProtoReflect() pref.Message {
+func (m aberrantMessage) ProtoReflect() protoreflect.Message {
 	return m
 }
 
-func (m aberrantMessage) Descriptor() pref.MessageDescriptor {
+func (m aberrantMessage) Descriptor() protoreflect.MessageDescriptor {
 	return LegacyLoadMessageDesc(m.v.Type())
 }
-func (m aberrantMessage) Type() pref.MessageType {
+func (m aberrantMessage) Type() protoreflect.MessageType {
 	return aberrantMessageType{m.v.Type()}
 }
-func (m aberrantMessage) New() pref.Message {
+func (m aberrantMessage) New() protoreflect.Message {
 	if m.v.Type().Kind() == reflect.Ptr {
 		return aberrantMessage{reflect.New(m.v.Type().Elem())}
 	}
 	return aberrantMessage{reflect.Zero(m.v.Type())}
 }
-func (m aberrantMessage) Interface() pref.ProtoMessage {
+func (m aberrantMessage) Interface() protoreflect.ProtoMessage {
 	return m
 }
-func (m aberrantMessage) Range(f func(pref.FieldDescriptor, pref.Value) bool) {
+func (m aberrantMessage) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
 	return
 }
-func (m aberrantMessage) Has(pref.FieldDescriptor) bool {
+func (m aberrantMessage) Has(protoreflect.FieldDescriptor) bool {
 	return false
 }
-func (m aberrantMessage) Clear(pref.FieldDescriptor) {
+func (m aberrantMessage) Clear(protoreflect.FieldDescriptor) {
 	panic("invalid Message.Clear on " + string(m.Descriptor().FullName()))
 }
-func (m aberrantMessage) Get(fd pref.FieldDescriptor) pref.Value {
+func (m aberrantMessage) Get(fd protoreflect.FieldDescriptor) protoreflect.Value {
 	if fd.Default().IsValid() {
 		return fd.Default()
 	}
 	panic("invalid Message.Get on " + string(m.Descriptor().FullName()))
 }
-func (m aberrantMessage) Set(pref.FieldDescriptor, pref.Value) {
+func (m aberrantMessage) Set(protoreflect.FieldDescriptor, protoreflect.Value) {
 	panic("invalid Message.Set on " + string(m.Descriptor().FullName()))
 }
-func (m aberrantMessage) Mutable(pref.FieldDescriptor) pref.Value {
+func (m aberrantMessage) Mutable(protoreflect.FieldDescriptor) protoreflect.Value {
 	panic("invalid Message.Mutable on " + string(m.Descriptor().FullName()))
 }
-func (m aberrantMessage) NewField(pref.FieldDescriptor) pref.Value {
+func (m aberrantMessage) NewField(protoreflect.FieldDescriptor) protoreflect.Value {
 	panic("invalid Message.NewField on " + string(m.Descriptor().FullName()))
 }
-func (m aberrantMessage) WhichOneof(pref.OneofDescriptor) pref.FieldDescriptor {
+func (m aberrantMessage) WhichOneof(protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
 	panic("invalid Message.WhichOneof descriptor on " + string(m.Descriptor().FullName()))
 }
-func (m aberrantMessage) GetUnknown() pref.RawFields {
+func (m aberrantMessage) GetUnknown() protoreflect.RawFields {
 	return nil
 }
-func (m aberrantMessage) SetUnknown(pref.RawFields) {
+func (m aberrantMessage) SetUnknown(protoreflect.RawFields) {
 	// SetUnknown discards its input on messages which don't support unknown field storage.
 }
 func (m aberrantMessage) IsValid() bool {
@@ -557,7 +555,7 @@
 	}
 	return false
 }
-func (m aberrantMessage) ProtoMethods() *piface.Methods {
+func (m aberrantMessage) ProtoMethods() *protoiface.Methods {
 	return aberrantProtoMethods
 }
 func (m aberrantMessage) protoUnwrap() interface{} {
diff --git a/internal/impl/message.go b/internal/impl/message.go
index a104e28..3945ab2 100644
--- a/internal/impl/message.go
+++ b/internal/impl/message.go
@@ -14,8 +14,7 @@
 
 	"google.golang.org/protobuf/internal/genid"
 	"google.golang.org/protobuf/reflect/protoreflect"
-	pref "google.golang.org/protobuf/reflect/protoreflect"
-	preg "google.golang.org/protobuf/reflect/protoregistry"
+	"google.golang.org/protobuf/reflect/protoregistry"
 )
 
 // MessageInfo provides protobuf related functionality for a given Go type
@@ -29,7 +28,7 @@
 	GoReflectType reflect.Type // pointer to struct
 
 	// Desc is the underlying message descriptor type and must be populated.
-	Desc pref.MessageDescriptor
+	Desc protoreflect.MessageDescriptor
 
 	// Exporter must be provided in a purego environment in order to provide
 	// access to unexported fields.
@@ -54,7 +53,7 @@
 // is generated by our implementation of protoc-gen-go (for v2 and on).
 // If it is unable to obtain a MessageInfo, it returns nil.
 func getMessageInfo(mt reflect.Type) *MessageInfo {
-	m, ok := reflect.Zero(mt).Interface().(pref.ProtoMessage)
+	m, ok := reflect.Zero(mt).Interface().(protoreflect.ProtoMessage)
 	if !ok {
 		return nil
 	}
@@ -97,7 +96,7 @@
 // getPointer returns the pointer for a message, which should be of
 // the type of the MessageInfo. If the message is of a different type,
 // it returns ok==false.
-func (mi *MessageInfo) getPointer(m pref.Message) (p pointer, ok bool) {
+func (mi *MessageInfo) getPointer(m protoreflect.Message) (p pointer, ok bool) {
 	switch m := m.(type) {
 	case *messageState:
 		return m.pointer(), m.messageInfo() == mi
@@ -134,10 +133,10 @@
 	extensionOffset offset
 	extensionType   reflect.Type
 
-	fieldsByNumber        map[pref.FieldNumber]reflect.StructField
-	oneofsByName          map[pref.Name]reflect.StructField
-	oneofWrappersByType   map[reflect.Type]pref.FieldNumber
-	oneofWrappersByNumber map[pref.FieldNumber]reflect.Type
+	fieldsByNumber        map[protoreflect.FieldNumber]reflect.StructField
+	oneofsByName          map[protoreflect.Name]reflect.StructField
+	oneofWrappersByType   map[reflect.Type]protoreflect.FieldNumber
+	oneofWrappersByNumber map[protoreflect.FieldNumber]reflect.Type
 }
 
 func (mi *MessageInfo) makeStructInfo(t reflect.Type) structInfo {
@@ -147,10 +146,10 @@
 		unknownOffset:   invalidOffset,
 		extensionOffset: invalidOffset,
 
-		fieldsByNumber:        map[pref.FieldNumber]reflect.StructField{},
-		oneofsByName:          map[pref.Name]reflect.StructField{},
-		oneofWrappersByType:   map[reflect.Type]pref.FieldNumber{},
-		oneofWrappersByNumber: map[pref.FieldNumber]reflect.Type{},
+		fieldsByNumber:        map[protoreflect.FieldNumber]reflect.StructField{},
+		oneofsByName:          map[protoreflect.Name]reflect.StructField{},
+		oneofWrappersByType:   map[reflect.Type]protoreflect.FieldNumber{},
+		oneofWrappersByNumber: map[protoreflect.FieldNumber]reflect.Type{},
 	}
 
 fieldLoop:
@@ -180,12 +179,12 @@
 			for _, s := range strings.Split(f.Tag.Get("protobuf"), ",") {
 				if len(s) > 0 && strings.Trim(s, "0123456789") == "" {
 					n, _ := strconv.ParseUint(s, 10, 64)
-					si.fieldsByNumber[pref.FieldNumber(n)] = f
+					si.fieldsByNumber[protoreflect.FieldNumber(n)] = f
 					continue fieldLoop
 				}
 			}
 			if s := f.Tag.Get("protobuf_oneof"); len(s) > 0 {
-				si.oneofsByName[pref.Name(s)] = f
+				si.oneofsByName[protoreflect.Name(s)] = f
 				continue fieldLoop
 			}
 		}
@@ -208,8 +207,8 @@
 		for _, s := range strings.Split(f.Tag.Get("protobuf"), ",") {
 			if len(s) > 0 && strings.Trim(s, "0123456789") == "" {
 				n, _ := strconv.ParseUint(s, 10, 64)
-				si.oneofWrappersByType[tf] = pref.FieldNumber(n)
-				si.oneofWrappersByNumber[pref.FieldNumber(n)] = tf
+				si.oneofWrappersByType[tf] = protoreflect.FieldNumber(n)
+				si.oneofWrappersByNumber[protoreflect.FieldNumber(n)] = tf
 				break
 			}
 		}
@@ -237,7 +236,7 @@
 	fd := mi.Desc.Fields().Get(i)
 	switch {
 	case fd.IsWeak():
-		mt, _ := preg.GlobalTypes.FindMessageByName(fd.Message().FullName())
+		mt, _ := protoregistry.GlobalTypes.FindMessageByName(fd.Message().FullName())
 		return mt
 	case fd.IsMap():
 		return mapEntryType{fd.Message(), mi.fieldTypes[fd.Number()]}
diff --git a/internal/order/order_test.go b/internal/order/order_test.go
index ecf5e18..2560c23 100644
--- a/internal/order/order_test.go
+++ b/internal/order/order_test.go
@@ -11,7 +11,6 @@
 
 	"github.com/google/go-cmp/cmp"
 	"google.golang.org/protobuf/reflect/protoreflect"
-	pref "google.golang.org/protobuf/reflect/protoreflect"
 )
 
 type fieldDesc struct {
@@ -20,15 +19,15 @@
 	number     protoreflect.FieldNumber
 	extension  bool
 	oneofIndex int // non-zero means within oneof; negative means synthetic
-	pref.FieldDescriptor
+	protoreflect.FieldDescriptor
 }
 
-func (d fieldDesc) Index() int               { return d.index }
-func (d fieldDesc) Name() pref.Name          { return d.name.Name() }
-func (d fieldDesc) FullName() pref.FullName  { return d.name }
-func (d fieldDesc) Number() pref.FieldNumber { return d.number }
-func (d fieldDesc) IsExtension() bool        { return d.extension }
-func (d fieldDesc) ContainingOneof() pref.OneofDescriptor {
+func (d fieldDesc) Index() int                       { return d.index }
+func (d fieldDesc) Name() protoreflect.Name          { return d.name.Name() }
+func (d fieldDesc) FullName() protoreflect.FullName  { return d.name }
+func (d fieldDesc) Number() protoreflect.FieldNumber { return d.number }
+func (d fieldDesc) IsExtension() bool                { return d.extension }
+func (d fieldDesc) ContainingOneof() protoreflect.OneofDescriptor {
 	switch {
 	case d.oneofIndex < 0:
 		return oneofDesc{index: -d.oneofIndex, synthetic: true}
@@ -42,7 +41,7 @@
 type oneofDesc struct {
 	index     int
 	synthetic bool
-	pref.OneofDescriptor
+	protoreflect.OneofDescriptor
 }
 
 func (d oneofDesc) Index() int        { return d.index }
@@ -158,7 +157,7 @@
 		t.Run(tt.label, func(t *testing.T) {
 			var got, want []protoreflect.MapKey
 			for _, v := range tt.keys {
-				want = append(want, pref.ValueOf(v).MapKey())
+				want = append(want, protoreflect.ValueOf(v).MapKey())
 			}
 			got = append(got, want...)
 			for i, j := range rand.Perm(len(got)) {
diff --git a/proto/extension_test.go b/proto/extension_test.go
index b3ab788..8bf5da5 100644
--- a/proto/extension_test.go
+++ b/proto/extension_test.go
@@ -14,7 +14,6 @@
 
 	"google.golang.org/protobuf/proto"
 	"google.golang.org/protobuf/reflect/protoreflect"
-	pref "google.golang.org/protobuf/reflect/protoreflect"
 	"google.golang.org/protobuf/runtime/protoimpl"
 	"google.golang.org/protobuf/testing/protocmp"
 
@@ -27,7 +26,7 @@
 func TestExtensionFuncs(t *testing.T) {
 	for _, test := range []struct {
 		message     proto.Message
-		ext         pref.ExtensionType
+		ext         protoreflect.ExtensionType
 		wantDefault interface{}
 		value       interface{}
 	}{
@@ -209,10 +208,10 @@
 func TestExtensionRanger(t *testing.T) {
 	tests := []struct {
 		msg  proto.Message
-		want map[pref.ExtensionType]interface{}
+		want map[protoreflect.ExtensionType]interface{}
 	}{{
 		msg: &testpb.TestAllExtensions{},
-		want: map[pref.ExtensionType]interface{}{
+		want: map[protoreflect.ExtensionType]interface{}{
 			testpb.E_OptionalInt32:         int32(5),
 			testpb.E_OptionalString:        string("hello"),
 			testpb.E_OptionalNestedMessage: &testpb.TestAllExtensions_NestedMessage{},
@@ -223,7 +222,7 @@
 		},
 	}, {
 		msg: &descpb.MessageOptions{},
-		want: map[pref.ExtensionType]interface{}{
+		want: map[protoreflect.ExtensionType]interface{}{
 			test3pb.E_OptionalInt32:          int32(5),
 			test3pb.E_OptionalString:         string("hello"),
 			test3pb.E_OptionalForeignMessage: &test3pb.ForeignMessage{},
@@ -241,8 +240,8 @@
 			proto.SetExtension(tt.msg, xt, v)
 		}
 
-		got := make(map[pref.ExtensionType]interface{})
-		proto.RangeExtensions(tt.msg, func(xt pref.ExtensionType, v interface{}) bool {
+		got := make(map[protoreflect.ExtensionType]interface{})
+		proto.RangeExtensions(tt.msg, func(xt protoreflect.ExtensionType, v interface{}) bool {
 			got[xt] = v
 			return true
 		})
diff --git a/testing/protopack/pack_test.go b/testing/protopack/pack_test.go
index 61ea336..26680ea 100644
--- a/testing/protopack/pack_test.go
+++ b/testing/protopack/pack_test.go
@@ -14,14 +14,13 @@
 	"github.com/google/go-cmp/cmp"
 
 	"google.golang.org/protobuf/encoding/prototext"
-	pdesc "google.golang.org/protobuf/reflect/protodesc"
+	"google.golang.org/protobuf/reflect/protodesc"
 	"google.golang.org/protobuf/reflect/protoreflect"
-	pref "google.golang.org/protobuf/reflect/protoreflect"
 
 	"google.golang.org/protobuf/types/descriptorpb"
 )
 
-var msgDesc = func() pref.MessageDescriptor {
+var msgDesc = func() protoreflect.MessageDescriptor {
 	const s = `
 		name:   "test.proto"
 		syntax: "proto2"
@@ -50,7 +49,7 @@
 	if err := prototext.Unmarshal([]byte(s), pb); err != nil {
 		panic(err)
 	}
-	fd, err := pdesc.NewFile(pb, nil)
+	fd, err := protodesc.NewFile(pb, nil)
 	if err != nil {
 		panic(err)
 	}
diff --git a/testing/prototest/message.go b/testing/prototest/message.go
index 9f111f7..d64b0af 100644
--- a/testing/prototest/message.go
+++ b/testing/prototest/message.go
@@ -18,7 +18,6 @@
 	"google.golang.org/protobuf/encoding/protowire"
 	"google.golang.org/protobuf/proto"
 	"google.golang.org/protobuf/reflect/protoreflect"
-	pref "google.golang.org/protobuf/reflect/protoreflect"
 	"google.golang.org/protobuf/reflect/protoregistry"
 )
 
@@ -30,14 +29,14 @@
 	// Resolver is used to determine the list of extension fields to test with.
 	// If nil, this defaults to using protoregistry.GlobalTypes.
 	Resolver interface {
-		FindExtensionByName(field pref.FullName) (pref.ExtensionType, error)
-		FindExtensionByNumber(message pref.FullName, field pref.FieldNumber) (pref.ExtensionType, error)
-		RangeExtensionsByMessage(message pref.FullName, f func(pref.ExtensionType) bool)
+		FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error)
+		FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error)
+		RangeExtensionsByMessage(message protoreflect.FullName, f func(protoreflect.ExtensionType) bool)
 	}
 }
 
 // Test performs tests on a MessageType implementation.
-func (test Message) Test(t testing.TB, mt pref.MessageType) {
+func (test Message) Test(t testing.TB, mt protoreflect.MessageType) {
 	testType(t, mt)
 
 	md := mt.Descriptor()
@@ -49,8 +48,8 @@
 	if test.Resolver == nil {
 		test.Resolver = protoregistry.GlobalTypes
 	}
-	var extTypes []pref.ExtensionType
-	test.Resolver.RangeExtensionsByMessage(md.FullName(), func(e pref.ExtensionType) bool {
+	var extTypes []protoreflect.ExtensionType
+	test.Resolver.RangeExtensionsByMessage(md.FullName(), func(e protoreflect.ExtensionType) bool {
 		extTypes = append(extTypes, e)
 		return true
 	})
@@ -86,7 +85,7 @@
 	}
 }
 
-func testType(t testing.TB, mt pref.MessageType) {
+func testType(t testing.TB, mt protoreflect.MessageType) {
 	m := mt.New().Interface()
 	want := reflect.TypeOf(m)
 	if got := reflect.TypeOf(m.ProtoReflect().Interface()); got != want {
@@ -98,19 +97,19 @@
 	if got := reflect.TypeOf(m.ProtoReflect().Type().Zero().Interface()); got != want {
 		t.Errorf("type mismatch: reflect.TypeOf(m) != reflect.TypeOf(m.ProtoReflect().Type().Zero().Interface()): %v != %v", got, want)
 	}
-	if mt, ok := mt.(pref.MessageFieldTypes); ok {
+	if mt, ok := mt.(protoreflect.MessageFieldTypes); ok {
 		testFieldTypes(t, mt)
 	}
 }
 
-func testFieldTypes(t testing.TB, mt pref.MessageFieldTypes) {
-	descName := func(d pref.Descriptor) pref.FullName {
+func testFieldTypes(t testing.TB, mt protoreflect.MessageFieldTypes) {
+	descName := func(d protoreflect.Descriptor) protoreflect.FullName {
 		if d == nil {
 			return "<nil>"
 		}
 		return d.FullName()
 	}
-	typeName := func(mt pref.MessageType) pref.FullName {
+	typeName := func(mt protoreflect.MessageType) protoreflect.FullName {
 		if mt == nil {
 			return "<nil>"
 		}
@@ -173,7 +172,7 @@
 			checkMessageDesc(i,
 				"mti.Descriptor()", "fd.Message()",
 				mti.Descriptor(), fd.Message())
-			if mti := mti.(pref.MessageFieldTypes); mti != nil {
+			if mti := mti.(protoreflect.MessageFieldTypes); mti != nil {
 				if fd.MapValue().Enum() != nil {
 					checkEnumDesc(i,
 						"mti.Enum(fd.MapValue().Index()).Descriptor()", "fd.MapValue().Enum()",
@@ -207,7 +206,7 @@
 }
 
 // testField exercises set/get/has/clear of a field.
-func testField(t testing.TB, m pref.Message, fd pref.FieldDescriptor) {
+func testField(t testing.TB, m protoreflect.Message, fd protoreflect.FieldDescriptor) {
 	name := fd.FullName()
 	num := fd.Number()
 
@@ -221,7 +220,7 @@
 		if got, want := m.NewField(fd), fd.Default(); !valueEqual(got, want) {
 			t.Errorf("Message.NewField(%v) = %v, want default value %v", name, formatValue(got), formatValue(want))
 		}
-		if fd.Kind() == pref.FloatKind || fd.Kind() == pref.DoubleKind {
+		if fd.Kind() == protoreflect.FloatKind || fd.Kind() == protoreflect.DoubleKind {
 			testFieldFloat(t, m, fd)
 		}
 	}
@@ -232,20 +231,20 @@
 		m.Set(fd, v)
 		wantHas := true
 		if n == 0 {
-			if fd.Syntax() == pref.Proto3 && fd.Message() == nil {
+			if fd.Syntax() == protoreflect.Proto3 && fd.Message() == nil {
 				wantHas = false
 			}
 			if fd.IsExtension() {
 				wantHas = true
 			}
-			if fd.Cardinality() == pref.Repeated {
+			if fd.Cardinality() == protoreflect.Repeated {
 				wantHas = false
 			}
 			if fd.ContainingOneof() != nil {
 				wantHas = true
 			}
 		}
-		if fd.Syntax() == pref.Proto3 && fd.Cardinality() != pref.Repeated && fd.ContainingOneof() == nil && fd.Kind() == pref.EnumKind && v.Enum() == 0 {
+		if fd.Syntax() == protoreflect.Proto3 && fd.Cardinality() != protoreflect.Repeated && fd.ContainingOneof() == nil && fd.Kind() == protoreflect.EnumKind && v.Enum() == 0 {
 			wantHas = false
 		}
 		if got, want := m.Has(fd), wantHas; got != want {
@@ -255,7 +254,7 @@
 			t.Errorf("after setting %q:\nMessage.Get(%v) = %v, want %v", name, num, formatValue(got), formatValue(want))
 		}
 		found := false
-		m.Range(func(d pref.FieldDescriptor, got pref.Value) bool {
+		m.Range(func(d protoreflect.FieldDescriptor, got protoreflect.Value) bool {
 			if fd != d {
 				return true
 			}
@@ -293,7 +292,7 @@
 	switch {
 	case fd.IsList() || fd.IsMap():
 		m.Set(fd, m.Mutable(fd))
-		if got, want := m.Has(fd), (fd.IsExtension() && fd.Cardinality() != pref.Repeated) || fd.ContainingOneof() != nil; got != want {
+		if got, want := m.Has(fd), (fd.IsExtension() && fd.Cardinality() != protoreflect.Repeated) || fd.ContainingOneof() != nil; got != want {
 			t.Errorf("after setting %q to default:\nMessage.Has(%v) = %v, want %v", name, num, got, want)
 		}
 	case fd.Message() == nil:
@@ -305,9 +304,9 @@
 	m.Clear(fd)
 
 	// Set to the wrong type.
-	v := pref.ValueOfString("")
-	if fd.Kind() == pref.StringKind {
-		v = pref.ValueOfInt32(0)
+	v := protoreflect.ValueOfString("")
+	if fd.Kind() == protoreflect.StringKind {
+		v = protoreflect.ValueOfInt32(0)
 	}
 	if !panics(func() {
 		m.Set(fd, v)
@@ -317,7 +316,7 @@
 }
 
 // testFieldMap tests set/get/has/clear of entries in a map field.
-func testFieldMap(t testing.TB, m pref.Message, fd pref.FieldDescriptor) {
+func testFieldMap(t testing.TB, m protoreflect.Message, fd protoreflect.FieldDescriptor) {
 	name := fd.FullName()
 	num := fd.Number()
 
@@ -331,7 +330,7 @@
 		t.Errorf("message.Get(%v).NewValue() = %v, want %v", name, formatValue(got), formatValue(want))
 	}
 	if !panics(func() {
-		m.Set(fd, pref.ValueOfMap(mapv))
+		m.Set(fd, protoreflect.ValueOfMap(mapv))
 	}) {
 		t.Errorf("message.Set(%v, <invalid>) does not panic", name)
 	}
@@ -359,36 +358,36 @@
 		v := newMapValue(fd, mapv, n, nil)
 		mapv.Set(k, v)
 		want.Set(k, v)
-		if got, want := m.Get(fd), pref.ValueOfMap(want); !valueEqual(got, want) {
+		if got, want := m.Get(fd), protoreflect.ValueOfMap(want); !valueEqual(got, want) {
 			t.Errorf("after inserting %d elements to %q:\nMessage.Get(%v) = %v, want %v", i, name, num, formatValue(got), formatValue(want))
 		}
 	}
 
 	// Set values.
-	want.Range(func(k pref.MapKey, v pref.Value) bool {
+	want.Range(func(k protoreflect.MapKey, v protoreflect.Value) bool {
 		nv := newMapValue(fd, mapv, 10, nil)
 		mapv.Set(k, nv)
 		want.Set(k, nv)
-		if got, want := m.Get(fd), pref.ValueOfMap(want); !valueEqual(got, want) {
+		if got, want := m.Get(fd), protoreflect.ValueOfMap(want); !valueEqual(got, want) {
 			t.Errorf("after setting element %v of %q:\nMessage.Get(%v) = %v, want %v", formatValue(k.Value()), name, num, formatValue(got), formatValue(want))
 		}
 		return true
 	})
 
 	// Clear values.
-	want.Range(func(k pref.MapKey, v pref.Value) bool {
+	want.Range(func(k protoreflect.MapKey, v protoreflect.Value) bool {
 		mapv.Clear(k)
 		want.Clear(k)
 		if got, want := m.Has(fd), want.Len() > 0; got != want {
 			t.Errorf("after clearing elements of %q:\nMessage.Has(%v) = %v, want %v", name, num, got, want)
 		}
-		if got, want := m.Get(fd), pref.ValueOfMap(want); !valueEqual(got, want) {
+		if got, want := m.Get(fd), protoreflect.ValueOfMap(want); !valueEqual(got, want) {
 			t.Errorf("after clearing elements of %q:\nMessage.Get(%v) = %v, want %v", name, num, formatValue(got), formatValue(want))
 		}
 		return true
 	})
 	if mapv := m.Get(fd).Map(); mapv.IsValid() {
-		t.Errorf("after clearing all elements: message.Get(%v).IsValid() = true, want false %v", name, formatValue(pref.ValueOfMap(mapv)))
+		t.Errorf("after clearing all elements: message.Get(%v).IsValid() = true, want false %v", name, formatValue(protoreflect.ValueOfMap(mapv)))
 	}
 
 	// Non-existent map keys.
@@ -422,18 +421,18 @@
 	}
 }
 
-type testMap map[interface{}]pref.Value
+type testMap map[interface{}]protoreflect.Value
 
-func (m testMap) Get(k pref.MapKey) pref.Value     { return m[k.Interface()] }
-func (m testMap) Set(k pref.MapKey, v pref.Value)  { m[k.Interface()] = v }
-func (m testMap) Has(k pref.MapKey) bool           { return m.Get(k).IsValid() }
-func (m testMap) Clear(k pref.MapKey)              { delete(m, k.Interface()) }
-func (m testMap) Mutable(k pref.MapKey) pref.Value { panic("unimplemented") }
-func (m testMap) Len() int                         { return len(m) }
-func (m testMap) NewValue() pref.Value             { panic("unimplemented") }
-func (m testMap) Range(f func(pref.MapKey, pref.Value) bool) {
+func (m testMap) Get(k protoreflect.MapKey) protoreflect.Value     { return m[k.Interface()] }
+func (m testMap) Set(k protoreflect.MapKey, v protoreflect.Value)  { m[k.Interface()] = v }
+func (m testMap) Has(k protoreflect.MapKey) bool                   { return m.Get(k).IsValid() }
+func (m testMap) Clear(k protoreflect.MapKey)                      { delete(m, k.Interface()) }
+func (m testMap) Mutable(k protoreflect.MapKey) protoreflect.Value { panic("unimplemented") }
+func (m testMap) Len() int                                         { return len(m) }
+func (m testMap) NewValue() protoreflect.Value                     { panic("unimplemented") }
+func (m testMap) Range(f func(protoreflect.MapKey, protoreflect.Value) bool) {
 	for k, v := range m {
-		if !f(pref.ValueOf(k).MapKey(), v) {
+		if !f(protoreflect.ValueOf(k).MapKey(), v) {
 			return
 		}
 	}
@@ -441,7 +440,7 @@
 func (m testMap) IsValid() bool { return true }
 
 // testFieldList exercises set/get/append/truncate of values in a list.
-func testFieldList(t testing.TB, m pref.Message, fd pref.FieldDescriptor) {
+func testFieldList(t testing.TB, m protoreflect.Message, fd protoreflect.FieldDescriptor) {
 	name := fd.FullName()
 	num := fd.Number()
 
@@ -451,7 +450,7 @@
 		t.Errorf("message.Get(%v).IsValid() = true, want false", name)
 	}
 	if !panics(func() {
-		m.Set(fd, pref.ValueOfList(list))
+		m.Set(fd, protoreflect.ValueOfList(list))
 	}) {
 		t.Errorf("message.Set(%v, <invalid>) does not panic", name)
 	}
@@ -472,7 +471,7 @@
 	}
 
 	// Append values.
-	var want pref.List = &testList{}
+	var want protoreflect.List = &testList{}
 	for i, n := range []seed{1, 0, minVal, maxVal} {
 		if got, want := m.Has(fd), i > 0; got != want {
 			t.Errorf("after appending %d elements to %q:\nMessage.Has(%v) = %v, want %v", i, name, num, got, want)
@@ -481,7 +480,7 @@
 		want.Append(v)
 		list.Append(v)
 
-		if got, want := m.Get(fd), pref.ValueOfList(want); !valueEqual(got, want) {
+		if got, want := m.Get(fd), protoreflect.ValueOfList(want); !valueEqual(got, want) {
 			t.Errorf("after appending %d elements to %q:\nMessage.Get(%v) = %v, want %v", i+1, name, num, formatValue(got), formatValue(want))
 		}
 	}
@@ -491,7 +490,7 @@
 		v := newListElement(fd, list, seed(i+10), nil)
 		want.Set(i, v)
 		list.Set(i, v)
-		if got, want := m.Get(fd), pref.ValueOfList(want); !valueEqual(got, want) {
+		if got, want := m.Get(fd), protoreflect.ValueOfList(want); !valueEqual(got, want) {
 			t.Errorf("after setting element %d of %q:\nMessage.Get(%v) = %v, want %v", i, name, num, formatValue(got), formatValue(want))
 		}
 	}
@@ -504,7 +503,7 @@
 		if got, want := m.Has(fd), want.Len() > 0; got != want {
 			t.Errorf("after truncating %q to %d:\nMessage.Has(%v) = %v, want %v", name, n, num, got, want)
 		}
-		if got, want := m.Get(fd), pref.ValueOfList(want); !valueEqual(got, want) {
+		if got, want := m.Get(fd), protoreflect.ValueOfList(want); !valueEqual(got, want) {
 			t.Errorf("after truncating %q to %d:\nMessage.Get(%v) = %v, want %v", name, n, num, formatValue(got), formatValue(want))
 		}
 	}
@@ -530,29 +529,29 @@
 }
 
 type testList struct {
-	a []pref.Value
+	a []protoreflect.Value
 }
 
-func (l *testList) Append(v pref.Value)       { l.a = append(l.a, v) }
-func (l *testList) AppendMutable() pref.Value { panic("unimplemented") }
-func (l *testList) Get(n int) pref.Value      { return l.a[n] }
-func (l *testList) Len() int                  { return len(l.a) }
-func (l *testList) Set(n int, v pref.Value)   { l.a[n] = v }
-func (l *testList) Truncate(n int)            { l.a = l.a[:n] }
-func (l *testList) NewElement() pref.Value    { panic("unimplemented") }
-func (l *testList) IsValid() bool             { return true }
+func (l *testList) Append(v protoreflect.Value)       { l.a = append(l.a, v) }
+func (l *testList) AppendMutable() protoreflect.Value { panic("unimplemented") }
+func (l *testList) Get(n int) protoreflect.Value      { return l.a[n] }
+func (l *testList) Len() int                          { return len(l.a) }
+func (l *testList) Set(n int, v protoreflect.Value)   { l.a[n] = v }
+func (l *testList) Truncate(n int)                    { l.a = l.a[:n] }
+func (l *testList) NewElement() protoreflect.Value    { panic("unimplemented") }
+func (l *testList) IsValid() bool                     { return true }
 
 // testFieldFloat exercises some interesting floating-point scalar field values.
-func testFieldFloat(t testing.TB, m pref.Message, fd pref.FieldDescriptor) {
+func testFieldFloat(t testing.TB, m protoreflect.Message, fd protoreflect.FieldDescriptor) {
 	name := fd.FullName()
 	num := fd.Number()
 
 	for _, v := range []float64{math.Inf(-1), math.Inf(1), math.NaN(), math.Copysign(0, -1)} {
-		var val pref.Value
-		if fd.Kind() == pref.FloatKind {
-			val = pref.ValueOfFloat32(float32(v))
+		var val protoreflect.Value
+		if fd.Kind() == protoreflect.FloatKind {
+			val = protoreflect.ValueOfFloat32(float32(v))
 		} else {
-			val = pref.ValueOfFloat64(float64(v))
+			val = protoreflect.ValueOfFloat64(float64(v))
 		}
 		m.Set(fd, val)
 		// Note that Has is true for -0.
@@ -566,7 +565,7 @@
 }
 
 // testOneof tests the behavior of fields in a oneof.
-func testOneof(t testing.TB, m pref.Message, od pref.OneofDescriptor) {
+func testOneof(t testing.TB, m protoreflect.Message, od protoreflect.OneofDescriptor) {
 	for _, mutable := range []bool{false, true} {
 		for i := 0; i < od.Fields().Len(); i++ {
 			fda := od.Fields().Get(i)
@@ -594,19 +593,19 @@
 }
 
 // testUnknown tests the behavior of unknown fields.
-func testUnknown(t testing.TB, m pref.Message) {
+func testUnknown(t testing.TB, m protoreflect.Message) {
 	var b []byte
 	b = protowire.AppendTag(b, 1000, protowire.VarintType)
 	b = protowire.AppendVarint(b, 1001)
-	m.SetUnknown(pref.RawFields(b))
+	m.SetUnknown(protoreflect.RawFields(b))
 	if got, want := []byte(m.GetUnknown()), b; !bytes.Equal(got, want) {
 		t.Errorf("after setting unknown fields:\nGetUnknown() = %v, want %v", got, want)
 	}
 }
 
-func formatValue(v pref.Value) string {
+func formatValue(v protoreflect.Value) string {
 	switch v := v.Interface().(type) {
-	case pref.List:
+	case protoreflect.List:
 		var buf bytes.Buffer
 		buf.WriteString("list[")
 		for i := 0; i < v.Len(); i++ {
@@ -617,11 +616,11 @@
 		}
 		buf.WriteString("]")
 		return buf.String()
-	case pref.Map:
+	case protoreflect.Map:
 		var buf bytes.Buffer
 		buf.WriteString("map[")
-		var keys []pref.MapKey
-		v.Range(func(k pref.MapKey, v pref.Value) bool {
+		var keys []protoreflect.MapKey
+		v.Range(func(k protoreflect.MapKey, v protoreflect.Value) bool {
 			keys = append(keys, k)
 			return true
 		})
@@ -638,7 +637,7 @@
 		}
 		buf.WriteString("]")
 		return buf.String()
-	case pref.Message:
+	case protoreflect.Message:
 		b, err := prototext.Marshal(v.Interface())
 		if err != nil {
 			return fmt.Sprintf("<%v>", err)
@@ -651,15 +650,15 @@
 	}
 }
 
-func valueEqual(a, b pref.Value) bool {
+func valueEqual(a, b protoreflect.Value) bool {
 	ai, bi := a.Interface(), b.Interface()
 	switch ai.(type) {
-	case pref.Message:
+	case protoreflect.Message:
 		return proto.Equal(
 			a.Message().Interface(),
 			b.Message().Interface(),
 		)
-	case pref.List:
+	case protoreflect.List:
 		lista, listb := a.List(), b.List()
 		if lista.Len() != listb.Len() {
 			return false
@@ -670,13 +669,13 @@
 			}
 		}
 		return true
-	case pref.Map:
+	case protoreflect.Map:
 		mapa, mapb := a.Map(), b.Map()
 		if mapa.Len() != mapb.Len() {
 			return false
 		}
 		equal := true
-		mapa.Range(func(k pref.MapKey, v pref.Value) bool {
+		mapa.Range(func(k protoreflect.MapKey, v protoreflect.Value) bool {
 			if !valueEqual(v, mapb.Get(k)) {
 				equal = false
 				return false
@@ -727,7 +726,7 @@
 //
 // The stack parameter is used to avoid infinite recursion when populating circular
 // data structures.
-func newValue(m pref.Message, fd pref.FieldDescriptor, n seed, stack []pref.MessageDescriptor) pref.Value {
+func newValue(m protoreflect.Message, fd protoreflect.FieldDescriptor, n seed, stack []protoreflect.MessageDescriptor) protoreflect.Value {
 	switch {
 	case fd.IsList():
 		if n == 0 {
@@ -738,7 +737,7 @@
 		list.Append(newListElement(fd, list, minVal, stack))
 		list.Append(newListElement(fd, list, maxVal, stack))
 		list.Append(newListElement(fd, list, n, stack))
-		return pref.ValueOfList(list)
+		return protoreflect.ValueOfList(list)
 	case fd.IsMap():
 		if n == 0 {
 			return m.New().Mutable(fd)
@@ -748,7 +747,7 @@
 		mapv.Set(newMapKey(fd, minVal), newMapValue(fd, mapv, minVal, stack))
 		mapv.Set(newMapKey(fd, maxVal), newMapValue(fd, mapv, maxVal, stack))
 		mapv.Set(newMapKey(fd, n), newMapValue(fd, mapv, newSeed(n, 0), stack))
-		return pref.ValueOfMap(mapv)
+		return protoreflect.ValueOfMap(mapv)
 	case fd.Message() != nil:
 		return populateMessage(m.NewField(fd).Message(), n, stack)
 	default:
@@ -756,19 +755,19 @@
 	}
 }
 
-func newListElement(fd pref.FieldDescriptor, list pref.List, n seed, stack []pref.MessageDescriptor) pref.Value {
+func newListElement(fd protoreflect.FieldDescriptor, list protoreflect.List, n seed, stack []protoreflect.MessageDescriptor) protoreflect.Value {
 	if fd.Message() == nil {
 		return newScalarValue(fd, n)
 	}
 	return populateMessage(list.NewElement().Message(), n, stack)
 }
 
-func newMapKey(fd pref.FieldDescriptor, n seed) pref.MapKey {
+func newMapKey(fd protoreflect.FieldDescriptor, n seed) protoreflect.MapKey {
 	kd := fd.MapKey()
 	return newScalarValue(kd, n).MapKey()
 }
 
-func newMapValue(fd pref.FieldDescriptor, mapv pref.Map, n seed, stack []pref.MessageDescriptor) pref.Value {
+func newMapValue(fd protoreflect.FieldDescriptor, mapv protoreflect.Map, n seed, stack []protoreflect.MessageDescriptor) protoreflect.Value {
 	vd := fd.MapValue()
 	if vd.Message() == nil {
 		return newScalarValue(vd, n)
@@ -776,11 +775,11 @@
 	return populateMessage(mapv.NewValue().Message(), n, stack)
 }
 
-func newScalarValue(fd pref.FieldDescriptor, n seed) pref.Value {
+func newScalarValue(fd protoreflect.FieldDescriptor, n seed) protoreflect.Value {
 	switch fd.Kind() {
-	case pref.BoolKind:
-		return pref.ValueOfBool(n != 0)
-	case pref.EnumKind:
+	case protoreflect.BoolKind:
+		return protoreflect.ValueOfBool(n != 0)
+	case protoreflect.EnumKind:
 		vals := fd.Enum().Values()
 		var i int
 		switch n {
@@ -791,85 +790,85 @@
 		default:
 			i = int(n) % vals.Len()
 		}
-		return pref.ValueOfEnum(vals.Get(i).Number())
-	case pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind:
+		return protoreflect.ValueOfEnum(vals.Get(i).Number())
+	case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:
 		switch n {
 		case minVal:
-			return pref.ValueOfInt32(math.MinInt32)
+			return protoreflect.ValueOfInt32(math.MinInt32)
 		case maxVal:
-			return pref.ValueOfInt32(math.MaxInt32)
+			return protoreflect.ValueOfInt32(math.MaxInt32)
 		default:
-			return pref.ValueOfInt32(int32(n))
+			return protoreflect.ValueOfInt32(int32(n))
 		}
-	case pref.Uint32Kind, pref.Fixed32Kind:
+	case protoreflect.Uint32Kind, protoreflect.Fixed32Kind:
 		switch n {
 		case minVal:
 			// Only use 0 for the zero value.
-			return pref.ValueOfUint32(1)
+			return protoreflect.ValueOfUint32(1)
 		case maxVal:
-			return pref.ValueOfUint32(math.MaxInt32)
+			return protoreflect.ValueOfUint32(math.MaxInt32)
 		default:
-			return pref.ValueOfUint32(uint32(n))
+			return protoreflect.ValueOfUint32(uint32(n))
 		}
-	case pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:
+	case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
 		switch n {
 		case minVal:
-			return pref.ValueOfInt64(math.MinInt64)
+			return protoreflect.ValueOfInt64(math.MinInt64)
 		case maxVal:
-			return pref.ValueOfInt64(math.MaxInt64)
+			return protoreflect.ValueOfInt64(math.MaxInt64)
 		default:
-			return pref.ValueOfInt64(int64(n))
+			return protoreflect.ValueOfInt64(int64(n))
 		}
-	case pref.Uint64Kind, pref.Fixed64Kind:
+	case protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
 		switch n {
 		case minVal:
 			// Only use 0 for the zero value.
-			return pref.ValueOfUint64(1)
+			return protoreflect.ValueOfUint64(1)
 		case maxVal:
-			return pref.ValueOfUint64(math.MaxInt64)
+			return protoreflect.ValueOfUint64(math.MaxInt64)
 		default:
-			return pref.ValueOfUint64(uint64(n))
+			return protoreflect.ValueOfUint64(uint64(n))
 		}
-	case pref.FloatKind:
+	case protoreflect.FloatKind:
 		switch n {
 		case minVal:
-			return pref.ValueOfFloat32(math.SmallestNonzeroFloat32)
+			return protoreflect.ValueOfFloat32(math.SmallestNonzeroFloat32)
 		case maxVal:
-			return pref.ValueOfFloat32(math.MaxFloat32)
+			return protoreflect.ValueOfFloat32(math.MaxFloat32)
 		default:
-			return pref.ValueOfFloat32(1.5 * float32(n))
+			return protoreflect.ValueOfFloat32(1.5 * float32(n))
 		}
-	case pref.DoubleKind:
+	case protoreflect.DoubleKind:
 		switch n {
 		case minVal:
-			return pref.ValueOfFloat64(math.SmallestNonzeroFloat64)
+			return protoreflect.ValueOfFloat64(math.SmallestNonzeroFloat64)
 		case maxVal:
-			return pref.ValueOfFloat64(math.MaxFloat64)
+			return protoreflect.ValueOfFloat64(math.MaxFloat64)
 		default:
-			return pref.ValueOfFloat64(1.5 * float64(n))
+			return protoreflect.ValueOfFloat64(1.5 * float64(n))
 		}
-	case pref.StringKind:
+	case protoreflect.StringKind:
 		if n == 0 {
-			return pref.ValueOfString("")
+			return protoreflect.ValueOfString("")
 		}
-		return pref.ValueOfString(fmt.Sprintf("%d", n))
-	case pref.BytesKind:
+		return protoreflect.ValueOfString(fmt.Sprintf("%d", n))
+	case protoreflect.BytesKind:
 		if n == 0 {
-			return pref.ValueOfBytes(nil)
+			return protoreflect.ValueOfBytes(nil)
 		}
-		return pref.ValueOfBytes([]byte{byte(n >> 24), byte(n >> 16), byte(n >> 8), byte(n)})
+		return protoreflect.ValueOfBytes([]byte{byte(n >> 24), byte(n >> 16), byte(n >> 8), byte(n)})
 	}
 	panic("unhandled kind")
 }
 
-func populateMessage(m pref.Message, n seed, stack []pref.MessageDescriptor) pref.Value {
+func populateMessage(m protoreflect.Message, n seed, stack []protoreflect.MessageDescriptor) protoreflect.Value {
 	if n == 0 {
-		return pref.ValueOfMessage(m)
+		return protoreflect.ValueOfMessage(m)
 	}
 	md := m.Descriptor()
 	for _, x := range stack {
 		if md == x {
-			return pref.ValueOfMessage(m)
+			return protoreflect.ValueOfMessage(m)
 		}
 	}
 	stack = append(stack, md)
@@ -880,7 +879,7 @@
 		}
 		m.Set(fd, newValue(m, fd, newSeed(n, i), stack))
 	}
-	return pref.ValueOfMessage(m)
+	return protoreflect.ValueOfMessage(m)
 }
 
 func panics(f func()) (didPanic bool) {