reflect/protoreflect: change Options back to an interface{}

Introduce a protoreflect.OptionsMessage interface type to represent
options messages. The protoreflect package can't deal with concrete
options types, to avoid dependency cycles; OptionsMessage serves both
as documentation and a single point to define the constraints we apply
to options.

Change the constraints on options from ProtoMessage to interface{} to
permit use of option message types which only implement the v1
proto.Message interface.

This still leaves a requirement in the internal/legacy package that
options implement protoreflect.ProtoMessage, since that package now uses
the v2 Unmarshal.

Change-Id: I547518ab2c3b90c3911ef641b05b169d50a4b33a
Reviewed-on: https://go-review.googlesource.com/c/154877
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
diff --git a/reflect/protoreflect/type.go b/reflect/protoreflect/type.go
index 2810672..2cc7f70 100644
--- a/reflect/protoreflect/type.go
+++ b/reflect/protoreflect/type.go
@@ -100,11 +100,15 @@
 	//
 	// This method returns a typed nil-pointer if no options are present.
 	// The caller must import the descriptor package to use this.
-	Options() ProtoMessage
+	Options() OptionsMessage
 
 	doNotImplement
 }
 
+// An OptionsMessage is a google.protobuf.XXXOptions message, defined here
+// as an interface value to avoid a dependency cycle.
+type OptionsMessage interface{}
+
 // FileDescriptor describes the types in a complete proto file and
 // corresponds with the google.protobuf.FileDescriptorProto message.
 //
@@ -211,7 +215,7 @@
 	// The caller must not modify the returned message.
 	//
 	// This method may return a nil interface value if no options are present.
-	ExtensionRangeOptions(i int) ProtoMessage
+	ExtensionRangeOptions(i int) OptionsMessage
 
 	// Messages is a list of nested message declarations.
 	Messages() MessageDescriptors
diff --git a/reflect/prototype/placeholder_type.go b/reflect/prototype/placeholder_type.go
index 203b114..8930aab 100644
--- a/reflect/prototype/placeholder_type.go
+++ b/reflect/prototype/placeholder_type.go
@@ -42,7 +42,7 @@
 	placeholderName
 }
 
-func (t placeholderFile) Options() pref.ProtoMessage                     { return optionTypes.File }
+func (t placeholderFile) Options() pref.OptionsMessage                   { return optionTypes.File }
 func (t placeholderFile) Path() string                                   { return t.path }
 func (t placeholderFile) Package() pref.FullName                         { return t.FullName() }
 func (t placeholderFile) Imports() pref.FileImports                      { return &emptyFiles }
@@ -58,26 +58,26 @@
 	placeholderName
 }
 
-func (t placeholderMessage) Options() pref.ProtoMessage                  { return optionTypes.Message }
-func (t placeholderMessage) IsMapEntry() bool                            { return false }
-func (t placeholderMessage) Fields() pref.FieldDescriptors               { return &emptyFields }
-func (t placeholderMessage) Oneofs() pref.OneofDescriptors               { return &emptyOneofs }
-func (t placeholderMessage) ReservedNames() pref.Names                   { return &emptyNames }
-func (t placeholderMessage) ReservedRanges() pref.FieldRanges            { return &emptyFieldRanges }
-func (t placeholderMessage) RequiredNumbers() pref.FieldNumbers          { return &emptyNumbers }
-func (t placeholderMessage) ExtensionRanges() pref.FieldRanges           { return &emptyFieldRanges }
-func (t placeholderMessage) ExtensionRangeOptions(int) pref.ProtoMessage { panic("out of bounds") }
-func (t placeholderMessage) Enums() pref.EnumDescriptors                 { return &emptyEnums }
-func (t placeholderMessage) Messages() pref.MessageDescriptors           { return &emptyMessages }
-func (t placeholderMessage) Extensions() pref.ExtensionDescriptors       { return &emptyExtensions }
-func (t placeholderMessage) Format(s fmt.State, r rune)                  { pfmt.FormatDesc(s, r, t) }
-func (t placeholderMessage) ProtoType(pref.MessageDescriptor)            {}
+func (t placeholderMessage) Options() pref.OptionsMessage                  { return optionTypes.Message }
+func (t placeholderMessage) IsMapEntry() bool                              { return false }
+func (t placeholderMessage) Fields() pref.FieldDescriptors                 { return &emptyFields }
+func (t placeholderMessage) Oneofs() pref.OneofDescriptors                 { return &emptyOneofs }
+func (t placeholderMessage) ReservedNames() pref.Names                     { return &emptyNames }
+func (t placeholderMessage) ReservedRanges() pref.FieldRanges              { return &emptyFieldRanges }
+func (t placeholderMessage) RequiredNumbers() pref.FieldNumbers            { return &emptyNumbers }
+func (t placeholderMessage) ExtensionRanges() pref.FieldRanges             { return &emptyFieldRanges }
+func (t placeholderMessage) ExtensionRangeOptions(int) pref.OptionsMessage { panic("out of bounds") }
+func (t placeholderMessage) Enums() pref.EnumDescriptors                   { return &emptyEnums }
+func (t placeholderMessage) Messages() pref.MessageDescriptors             { return &emptyMessages }
+func (t placeholderMessage) Extensions() pref.ExtensionDescriptors         { return &emptyExtensions }
+func (t placeholderMessage) Format(s fmt.State, r rune)                    { pfmt.FormatDesc(s, r, t) }
+func (t placeholderMessage) ProtoType(pref.MessageDescriptor)              {}
 
 type placeholderEnum struct {
 	placeholderName
 }
 
-func (t placeholderEnum) Options() pref.ProtoMessage        { return optionTypes.Enum }
+func (t placeholderEnum) Options() pref.OptionsMessage      { return optionTypes.Enum }
 func (t placeholderEnum) Values() pref.EnumValueDescriptors { return &emptyEnumValues }
 func (t placeholderEnum) ReservedNames() pref.Names         { return &emptyNames }
 func (t placeholderEnum) ReservedRanges() pref.EnumRanges   { return &emptyEnumRanges }
diff --git a/reflect/prototype/protofile.go b/reflect/prototype/protofile.go
index 8ca96b0..9b141cd 100644
--- a/reflect/prototype/protofile.go
+++ b/reflect/prototype/protofile.go
@@ -44,7 +44,7 @@
 	Path    string
 	Package protoreflect.FullName
 	Imports []protoreflect.FileImport
-	Options protoreflect.ProtoMessage
+	Options protoreflect.OptionsMessage
 
 	Enums      []Enum
 	Messages   []Message
@@ -108,8 +108,8 @@
 	ReservedNames         []protoreflect.Name
 	ReservedRanges        [][2]protoreflect.FieldNumber
 	ExtensionRanges       [][2]protoreflect.FieldNumber
-	ExtensionRangeOptions []protoreflect.ProtoMessage
-	Options               protoreflect.ProtoMessage
+	ExtensionRangeOptions []protoreflect.OptionsMessage
+	Options               protoreflect.OptionsMessage
 	IsMapEntry            bool
 
 	Enums      []Enum
@@ -138,7 +138,7 @@
 	OneofName   protoreflect.Name
 	MessageType protoreflect.MessageDescriptor
 	EnumType    protoreflect.EnumDescriptor
-	Options     protoreflect.ProtoMessage
+	Options     protoreflect.OptionsMessage
 	IsPacked    OptionalBool
 	IsWeak      bool
 
@@ -148,7 +148,7 @@
 // Oneof is a constructor for protoreflect.OneofDescriptor.
 type Oneof struct {
 	Name    protoreflect.Name
-	Options protoreflect.ProtoMessage
+	Options protoreflect.OptionsMessage
 
 	*oneofMeta
 }
@@ -163,7 +163,7 @@
 	MessageType  protoreflect.MessageDescriptor
 	EnumType     protoreflect.EnumDescriptor
 	ExtendedType protoreflect.MessageDescriptor
-	Options      protoreflect.ProtoMessage
+	Options      protoreflect.OptionsMessage
 	IsPacked     OptionalBool
 
 	*extensionMeta
@@ -175,7 +175,7 @@
 	Values         []EnumValue
 	ReservedNames  []protoreflect.Name
 	ReservedRanges [][2]protoreflect.EnumNumber
-	Options        protoreflect.ProtoMessage
+	Options        protoreflect.OptionsMessage
 
 	*enumMeta
 }
@@ -192,7 +192,7 @@
 type EnumValue struct {
 	Name    protoreflect.Name
 	Number  protoreflect.EnumNumber
-	Options protoreflect.ProtoMessage
+	Options protoreflect.OptionsMessage
 
 	*enumValueMeta
 }
@@ -201,7 +201,7 @@
 type Service struct {
 	Name    protoreflect.Name
 	Methods []Method
-	Options protoreflect.ProtoMessage
+	Options protoreflect.OptionsMessage
 
 	*serviceMeta
 }
@@ -213,7 +213,7 @@
 	OutputType        protoreflect.MessageDescriptor
 	IsStreamingClient bool
 	IsStreamingServer bool
-	Options           protoreflect.ProtoMessage
+	Options           protoreflect.OptionsMessage
 
 	*methodMeta
 }
diff --git a/reflect/prototype/protofile_type.go b/reflect/prototype/protofile_type.go
index 442ad92..421fe9e 100644
--- a/reflect/prototype/protofile_type.go
+++ b/reflect/prototype/protofile_type.go
@@ -48,7 +48,7 @@
 type fileDesc struct{ f *File }
 
 // altOptions returns m as is if it is non-nil. Otherwise, it returns alt.
-func altOptions(m, alt pref.ProtoMessage) pref.ProtoMessage {
+func altOptions(m, alt pref.OptionsMessage) pref.OptionsMessage {
 	if m != nil {
 		return m
 	}
@@ -68,7 +68,7 @@
 func (t fileDesc) Name() pref.Name                                  { return t.f.Package.Name() }
 func (t fileDesc) FullName() pref.FullName                          { return t.f.Package }
 func (t fileDesc) IsPlaceholder() bool                              { return false }
-func (t fileDesc) Options() pref.ProtoMessage                       { return altOptions(t.f.Options, optionTypes.File) }
+func (t fileDesc) Options() pref.OptionsMessage                     { return altOptions(t.f.Options, optionTypes.File) }
 func (t fileDesc) Path() string                                     { return t.f.Path }
 func (t fileDesc) Package() pref.FullName                           { return t.f.Package }
 func (t fileDesc) Imports() pref.FileImports                        { return (*fileImports)(&t.f.Imports) }
@@ -168,13 +168,15 @@
 }
 type messageDesc struct{ m *Message }
 
-func (t messageDesc) Parent() (pref.Descriptor, bool)    { return t.m.parent, true }
-func (t messageDesc) Index() int                         { return t.m.index }
-func (t messageDesc) Syntax() pref.Syntax                { return t.m.syntax }
-func (t messageDesc) Name() pref.Name                    { return t.m.Name }
-func (t messageDesc) FullName() pref.FullName            { return t.m.fullName }
-func (t messageDesc) IsPlaceholder() bool                { return false }
-func (t messageDesc) Options() pref.ProtoMessage         { return altOptions(t.m.Options, optionTypes.Message) }
+func (t messageDesc) Parent() (pref.Descriptor, bool) { return t.m.parent, true }
+func (t messageDesc) Index() int                      { return t.m.index }
+func (t messageDesc) Syntax() pref.Syntax             { return t.m.syntax }
+func (t messageDesc) Name() pref.Name                 { return t.m.Name }
+func (t messageDesc) FullName() pref.FullName         { return t.m.fullName }
+func (t messageDesc) IsPlaceholder() bool             { return false }
+func (t messageDesc) Options() pref.OptionsMessage {
+	return altOptions(t.m.Options, optionTypes.Message)
+}
 func (t messageDesc) IsMapEntry() bool                   { return t.m.IsMapEntry }
 func (t messageDesc) Fields() pref.FieldDescriptors      { return t.m.fs.lazyInit(t, t.m.Fields) }
 func (t messageDesc) Oneofs() pref.OneofDescriptors      { return t.m.os.lazyInit(t, t.m.Oneofs) }
@@ -182,7 +184,7 @@
 func (t messageDesc) ReservedRanges() pref.FieldRanges   { return (*fieldRanges)(&t.m.ReservedRanges) }
 func (t messageDesc) RequiredNumbers() pref.FieldNumbers { return t.m.ns.lazyInit(t.m.Fields) }
 func (t messageDesc) ExtensionRanges() pref.FieldRanges  { return (*fieldRanges)(&t.m.ExtensionRanges) }
-func (t messageDesc) ExtensionRangeOptions(i int) pref.ProtoMessage {
+func (t messageDesc) ExtensionRangeOptions(i int) pref.OptionsMessage {
 	return extensionRangeOptions(i, len(t.m.ExtensionRanges), t.m.ExtensionRangeOptions)
 }
 func (t messageDesc) Enums() pref.EnumDescriptors           { return t.m.es.lazyInit(t, t.m.Enums) }
@@ -192,11 +194,11 @@
 func (t messageDesc) ProtoType(pref.MessageDescriptor)      {}
 func (t messageDesc) ProtoInternal(pragma.DoNotImplement)   {}
 
-func extensionRangeOptions(i, n int, ms []pref.ProtoMessage) pref.ProtoMessage {
+func extensionRangeOptions(i, n int, ms []pref.OptionsMessage) pref.OptionsMessage {
 	if i < 0 || i >= n {
 		panic("out of bounds")
 	}
-	var m pref.ProtoMessage
+	var m pref.OptionsMessage
 	if i < len(ms) {
 		m = ms[i]
 	}
@@ -223,7 +225,7 @@
 func (t fieldDesc) Name() pref.Name                 { return t.f.Name }
 func (t fieldDesc) FullName() pref.FullName         { return t.f.fullName }
 func (t fieldDesc) IsPlaceholder() bool             { return false }
-func (t fieldDesc) Options() pref.ProtoMessage      { return altOptions(t.f.Options, optionTypes.Field) }
+func (t fieldDesc) Options() pref.OptionsMessage    { return altOptions(t.f.Options, optionTypes.Field) }
 func (t fieldDesc) Number() pref.FieldNumber        { return t.f.Number }
 func (t fieldDesc) Cardinality() pref.Cardinality   { return t.f.Cardinality }
 func (t fieldDesc) Kind() pref.Kind                 { return t.f.Kind }
@@ -324,7 +326,7 @@
 func (t oneofDesc) Name() pref.Name                     { return t.o.Name }
 func (t oneofDesc) FullName() pref.FullName             { return t.o.fullName }
 func (t oneofDesc) IsPlaceholder() bool                 { return false }
-func (t oneofDesc) Options() pref.ProtoMessage          { return altOptions(t.o.Options, optionTypes.Oneof) }
+func (t oneofDesc) Options() pref.OptionsMessage        { return altOptions(t.o.Options, optionTypes.Oneof) }
 func (t oneofDesc) Fields() pref.FieldDescriptors       { return t.o.fs.lazyInit(t) }
 func (t oneofDesc) Format(s fmt.State, r rune)          { pfmt.FormatDesc(s, r, t) }
 func (t oneofDesc) ProtoType(pref.OneofDescriptor)      {}
@@ -346,12 +348,14 @@
 func (t extensionDesc) Name() pref.Name                 { return t.x.Name }
 func (t extensionDesc) FullName() pref.FullName         { return t.x.fullName }
 func (t extensionDesc) IsPlaceholder() bool             { return false }
-func (t extensionDesc) Options() pref.ProtoMessage      { return altOptions(t.x.Options, optionTypes.Field) }
-func (t extensionDesc) Number() pref.FieldNumber        { return t.x.Number }
-func (t extensionDesc) Cardinality() pref.Cardinality   { return t.x.Cardinality }
-func (t extensionDesc) Kind() pref.Kind                 { return t.x.Kind }
-func (t extensionDesc) HasJSONName() bool               { return false }
-func (t extensionDesc) JSONName() string                { return "" }
+func (t extensionDesc) Options() pref.OptionsMessage {
+	return altOptions(t.x.Options, optionTypes.Field)
+}
+func (t extensionDesc) Number() pref.FieldNumber      { return t.x.Number }
+func (t extensionDesc) Cardinality() pref.Cardinality { return t.x.Cardinality }
+func (t extensionDesc) Kind() pref.Kind               { return t.x.Kind }
+func (t extensionDesc) HasJSONName() bool             { return false }
+func (t extensionDesc) JSONName() string              { return "" }
 func (t extensionDesc) IsPacked() bool {
 	// Extensions always use proto2 defaults for packing.
 	return isPacked(t.x.IsPacked, pref.Proto2, t.x.Cardinality, t.x.Kind)
@@ -386,7 +390,7 @@
 func (t enumDesc) Name() pref.Name                     { return t.e.Name }
 func (t enumDesc) FullName() pref.FullName             { return t.e.fullName }
 func (t enumDesc) IsPlaceholder() bool                 { return false }
-func (t enumDesc) Options() pref.ProtoMessage          { return altOptions(t.e.Options, optionTypes.Enum) }
+func (t enumDesc) Options() pref.OptionsMessage        { return altOptions(t.e.Options, optionTypes.Enum) }
 func (t enumDesc) Values() pref.EnumValueDescriptors   { return t.e.vs.lazyInit(t, t.e.Values) }
 func (t enumDesc) ReservedNames() pref.Names           { return (*names)(&t.e.ReservedNames) }
 func (t enumDesc) ReservedRanges() pref.EnumRanges     { return (*enumRanges)(&t.e.ReservedRanges) }
@@ -405,7 +409,7 @@
 func (t enumValueDesc) Name() pref.Name                 { return t.v.Name }
 func (t enumValueDesc) FullName() pref.FullName         { return t.v.fullName }
 func (t enumValueDesc) IsPlaceholder() bool             { return false }
-func (t enumValueDesc) Options() pref.ProtoMessage {
+func (t enumValueDesc) Options() pref.OptionsMessage {
 	return altOptions(t.v.Options, optionTypes.EnumValue)
 }
 func (t enumValueDesc) Number() pref.EnumNumber             { return t.v.Number }
@@ -420,13 +424,15 @@
 }
 type serviceDesc struct{ s *Service }
 
-func (t serviceDesc) Parent() (pref.Descriptor, bool)     { return t.s.parent, true }
-func (t serviceDesc) Index() int                          { return t.s.index }
-func (t serviceDesc) Syntax() pref.Syntax                 { return t.s.syntax }
-func (t serviceDesc) Name() pref.Name                     { return t.s.Name }
-func (t serviceDesc) FullName() pref.FullName             { return t.s.fullName }
-func (t serviceDesc) IsPlaceholder() bool                 { return false }
-func (t serviceDesc) Options() pref.ProtoMessage          { return altOptions(t.s.Options, optionTypes.Service) }
+func (t serviceDesc) Parent() (pref.Descriptor, bool) { return t.s.parent, true }
+func (t serviceDesc) Index() int                      { return t.s.index }
+func (t serviceDesc) Syntax() pref.Syntax             { return t.s.syntax }
+func (t serviceDesc) Name() pref.Name                 { return t.s.Name }
+func (t serviceDesc) FullName() pref.FullName         { return t.s.fullName }
+func (t serviceDesc) IsPlaceholder() bool             { return false }
+func (t serviceDesc) Options() pref.OptionsMessage {
+	return altOptions(t.s.Options, optionTypes.Service)
+}
 func (t serviceDesc) Methods() pref.MethodDescriptors     { return t.s.ms.lazyInit(t, t.s.Methods) }
 func (t serviceDesc) Format(s fmt.State, r rune)          { pfmt.FormatDesc(s, r, t) }
 func (t serviceDesc) ProtoType(pref.ServiceDescriptor)    {}
@@ -446,7 +452,7 @@
 func (t methodDesc) Name() pref.Name                     { return t.m.Name }
 func (t methodDesc) FullName() pref.FullName             { return t.m.fullName }
 func (t methodDesc) IsPlaceholder() bool                 { return false }
-func (t methodDesc) Options() pref.ProtoMessage          { return altOptions(t.m.Options, optionTypes.Method) }
+func (t methodDesc) Options() pref.OptionsMessage        { return altOptions(t.m.Options, optionTypes.Method) }
 func (t methodDesc) InputType() pref.MessageDescriptor   { return t.m.mit.lazyInit(t, &t.m.InputType) }
 func (t methodDesc) OutputType() pref.MessageDescriptor  { return t.m.mot.lazyInit(t, &t.m.OutputType) }
 func (t methodDesc) IsStreamingClient() bool             { return t.m.IsStreamingClient }
diff --git a/reflect/prototype/standalone.go b/reflect/prototype/standalone.go
index 4184e82..5dcf3a9 100644
--- a/reflect/prototype/standalone.go
+++ b/reflect/prototype/standalone.go
@@ -22,8 +22,8 @@
 	ReservedNames         []protoreflect.Name
 	ReservedRanges        [][2]protoreflect.FieldNumber
 	ExtensionRanges       [][2]protoreflect.FieldNumber
-	ExtensionRangeOptions []protoreflect.ProtoMessage
-	Options               protoreflect.ProtoMessage
+	ExtensionRangeOptions []protoreflect.OptionsMessage
+	Options               protoreflect.OptionsMessage
 	IsMapEntry            bool
 
 	fields fieldsMeta
@@ -90,7 +90,7 @@
 	Values         []EnumValue
 	ReservedNames  []protoreflect.Name
 	ReservedRanges [][2]protoreflect.EnumNumber
-	Options        protoreflect.ProtoMessage
+	Options        protoreflect.OptionsMessage
 
 	vals enumValuesMeta
 }
@@ -117,7 +117,7 @@
 	MessageType  protoreflect.MessageDescriptor
 	EnumType     protoreflect.EnumDescriptor
 	ExtendedType protoreflect.MessageDescriptor
-	Options      protoreflect.ProtoMessage
+	Options      protoreflect.OptionsMessage
 	IsPacked     OptionalBool
 
 	dv defaultValue
diff --git a/reflect/prototype/standalone_type.go b/reflect/prototype/standalone_type.go
index a087a9d..1eeb6f6 100644
--- a/reflect/prototype/standalone_type.go
+++ b/reflect/prototype/standalone_type.go
@@ -20,7 +20,7 @@
 func (t standaloneMessage) Name() pref.Name                 { return t.m.FullName.Name() }
 func (t standaloneMessage) FullName() pref.FullName         { return t.m.FullName }
 func (t standaloneMessage) IsPlaceholder() bool             { return false }
-func (t standaloneMessage) Options() pref.ProtoMessage {
+func (t standaloneMessage) Options() pref.OptionsMessage {
 	return altOptions(t.m.Options, optionTypes.Message)
 }
 func (t standaloneMessage) IsMapEntry() bool              { return t.m.IsMapEntry }
@@ -34,7 +34,7 @@
 func (t standaloneMessage) ExtensionRanges() pref.FieldRanges {
 	return (*fieldRanges)(&t.m.ExtensionRanges)
 }
-func (t standaloneMessage) ExtensionRangeOptions(i int) pref.ProtoMessage {
+func (t standaloneMessage) ExtensionRangeOptions(i int) pref.OptionsMessage {
 	return extensionRangeOptions(i, len(t.m.ExtensionRanges), t.m.ExtensionRangeOptions)
 }
 func (t standaloneMessage) Enums() pref.EnumDescriptors           { return &emptyEnums }
@@ -46,13 +46,15 @@
 
 type standaloneEnum struct{ e *StandaloneEnum }
 
-func (t standaloneEnum) Parent() (pref.Descriptor, bool)     { return nil, false }
-func (t standaloneEnum) Index() int                          { return 0 }
-func (t standaloneEnum) Syntax() pref.Syntax                 { return t.e.Syntax }
-func (t standaloneEnum) Name() pref.Name                     { return t.e.FullName.Name() }
-func (t standaloneEnum) FullName() pref.FullName             { return t.e.FullName }
-func (t standaloneEnum) IsPlaceholder() bool                 { return false }
-func (t standaloneEnum) Options() pref.ProtoMessage          { return altOptions(t.e.Options, optionTypes.Enum) }
+func (t standaloneEnum) Parent() (pref.Descriptor, bool) { return nil, false }
+func (t standaloneEnum) Index() int                      { return 0 }
+func (t standaloneEnum) Syntax() pref.Syntax             { return t.e.Syntax }
+func (t standaloneEnum) Name() pref.Name                 { return t.e.FullName.Name() }
+func (t standaloneEnum) FullName() pref.FullName         { return t.e.FullName }
+func (t standaloneEnum) IsPlaceholder() bool             { return false }
+func (t standaloneEnum) Options() pref.OptionsMessage {
+	return altOptions(t.e.Options, optionTypes.Enum)
+}
 func (t standaloneEnum) Values() pref.EnumValueDescriptors   { return t.e.vals.lazyInit(t, t.e.Values) }
 func (t standaloneEnum) ReservedNames() pref.Names           { return (*names)(&t.e.ReservedNames) }
 func (t standaloneEnum) ReservedRanges() pref.EnumRanges     { return (*enumRanges)(&t.e.ReservedRanges) }
@@ -68,7 +70,7 @@
 func (t standaloneExtension) Name() pref.Name                 { return t.x.FullName.Name() }
 func (t standaloneExtension) FullName() pref.FullName         { return t.x.FullName }
 func (t standaloneExtension) IsPlaceholder() bool             { return false }
-func (t standaloneExtension) Options() pref.ProtoMessage {
+func (t standaloneExtension) Options() pref.OptionsMessage {
 	return altOptions(t.x.Options, optionTypes.Field)
 }
 func (t standaloneExtension) Number() pref.FieldNumber      { return t.x.Number }
diff --git a/reflect/prototype/type_test.go b/reflect/prototype/type_test.go
index 56edebb..5064af4 100644
--- a/reflect/prototype/type_test.go
+++ b/reflect/prototype/type_test.go
@@ -114,7 +114,7 @@
 			ReservedNames:   []pref.Name{"fizz", "buzz"},
 			ReservedRanges:  [][2]pref.FieldNumber{{100, 200}, {300, 301}},
 			ExtensionRanges: [][2]pref.FieldNumber{{1000, 2000}, {3000, 3001}},
-			ExtensionRangeOptions: []pref.ProtoMessage{
+			ExtensionRangeOptions: []pref.OptionsMessage{
 				0: (*descriptorpb.ExtensionRangeOptions)(nil),
 				1: new(descriptorpb.ExtensionRangeOptions),
 			},