reflect/protodesc: only check enum dependency syntax if resolved
For proto3 messages with an enum field that could not be resolved,
do not check the syntax of that enum dependency.
Change-Id: I7c646539351edc35243ab950d335f4018cc4c0e9
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/186001
Reviewed-by: Damien Neil <dneil@google.com>
diff --git a/reflect/protodesc/file_test.go b/reflect/protodesc/file_test.go
index 9de1d03..f3e0b0a 100644
--- a/reflect/protodesc/file_test.go
+++ b/reflect/protodesc/file_test.go
@@ -831,6 +831,20 @@
]
}]}]
`),
+ }, {
+ label: "proto3 message with unresolved enum",
+ inDesc: mustParseFile(`
+ name: "test.proto"
+ package: ""
+ syntax: "proto3"
+ message_type: [{
+ name: "M"
+ field: [
+ {name:"enum" number:1 label:LABEL_OPTIONAL type:TYPE_ENUM type_name:".fizz.buzz.Enum"}
+ ]
+ }]
+ `),
+ inOpts: []option{allowUnresolvable()},
// TODO: Test field and oneof handling in validateMessageDeclarations
// TODO: Test unmarshalDefault
// TODO: Test validateExtensionDeclarations