reflect/protoreflect: add {Message,List,Map}.IsValid

Various protoreflect methods can return an "empty, read-only" message,
list, or map value. Provide a method to test if a value is one of these.

Fixes golang/protobuf#966

Change-Id: I793d8426d6e2201755983c06f024412a7e09bc4c
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/209018
Reviewed-by: Joe Tsai <joetsai@google.com>
diff --git a/internal/impl/convert_map.go b/internal/impl/convert_map.go
index 2ddfc78..a05b131 100644
--- a/internal/impl/convert_map.go
+++ b/internal/impl/convert_map.go
@@ -102,6 +102,9 @@
 func (ms *mapReflect) NewValue() pref.Value {
 	return ms.valConv.New()
 }
+func (ms *mapReflect) IsValid() bool {
+	return !ms.v.IsNil()
+}
 func (ms *mapReflect) protoUnwrap() interface{} {
 	return ms.v.Interface()
 }