internal/value: bugfix for v2 message conversion

PBValueOf returns a protoreflect.Message, not a
protoreflect.ProtoMessage.

Change-Id: I88ed55f52bada6fc2b29ffd63e30de09e1febe8c
Reviewed-on: https://go-review.googlesource.com/c/153917
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
This commit is contained in:
Damien Neil 2018-12-12 16:09:08 -08:00
parent ae2a561335
commit 9ecf75b72e

View File

@ -168,7 +168,7 @@ func NewLegacyConverter(t reflect.Type, k pref.Kind, w LegacyWrapper) Converter
if v.Type() != t {
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), t))
}
return pref.ValueOf(v.Interface())
return pref.ValueOf(v.Interface().(pref.ProtoMessage).ProtoReflect())
},
GoValueOf: func(v pref.Value) reflect.Value {
rv := reflect.ValueOf(v.Message().Interface())