mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-01-29 09:32:38 +00:00
b57aae9def
Changes made: * Ensure protoreflect.ExtensionType.IsValidInterface never panics, especially if given a nil interface value. * Have protoreflect.ExtensionType.IsValid{Interface,Value} only perform type-checks. It does not do value checks (i.e., whether the value itself is valid). Value validity is left to when an actual protoreflect.Message.Set operation is performed. * Add special-casing on proto.SetExtension to treat an invalid message or list as functionally equivalent to Clear. This is to be more consistent with the legacy SetExtension implementation which never panicked when given such values. * Add special-casing on proto.HasExtension to treat a mismatched extension descriptor as simply not being present in the message. This is also to be more consistent with the legacy HasExtension implementation which did the same thing. Change-Id: Idf0419abf27b9f85d9b92bd2ff8088e25b7990cc Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/229558 Reviewed-by: Damien Neil <dneil@google.com>