internal/value: rename the Unwrap method as ProtoUnwrap

Add a Proto prefix before the Unwrap method to reduce the probability that
it would ever conflict with a method of the same name that a
custom implementation of Enum, Message, List, or Map may have.

Change-Id: I628bf8335583f2747ab4589f3e6ff82e4501ce98
Reviewed-on: https://go-review.googlesource.com/c/151817
Reviewed-by: Herbie Ong <herbie@google.com>
diff --git a/internal/value/convert.go b/internal/value/convert.go
index 6660d44..cc9d94d 100644
--- a/internal/value/convert.go
+++ b/internal/value/convert.go
@@ -17,7 +17,7 @@
 // Unwrapper unwraps the value to the underlying value.
 // This is implemented by List and Map.
 type Unwrapper interface {
-	Unwrap() interface{}
+	ProtoUnwrap() interface{}
 }
 
 var (
@@ -174,7 +174,7 @@
 					return pref.ValueOf(mvOf(v).ProtoReflect())
 				},
 				GoValueOf: func(v pref.Value) reflect.Value {
-					rv := reflect.ValueOf(v.Message().(Unwrapper).Unwrap())
+					rv := reflect.ValueOf(v.Message().(Unwrapper).ProtoUnwrap())
 					if rv.Type() != t {
 						panic(fmt.Sprintf("invalid type: got %v, want %v", rv.Type(), t))
 					}
diff --git a/internal/value/list.go b/internal/value/list.go
index ba82b30..dadb05f 100644
--- a/internal/value/list.go
+++ b/internal/value/list.go
@@ -10,7 +10,10 @@
 	pref "github.com/golang/protobuf/v2/reflect/protoreflect"
 )
 
-func ListOf(p interface{}, c Converter) pref.List {
+func ListOf(p interface{}, c Converter) interface {
+	pref.List
+	Unwrapper
+} {
 	// TODO: Validate that p is a *[]T?
 	rv := reflect.ValueOf(p).Elem()
 	return listReflect{rv, c}
@@ -46,12 +49,7 @@
 func (ls listReflect) Truncate(i int) {
 	ls.v.Set(ls.v.Slice(0, i))
 }
-func (ls listReflect) Unwrap() interface{} {
+func (ls listReflect) ProtoUnwrap() interface{} {
 	return ls.v.Addr().Interface()
 }
 func (ls listReflect) ProtoMutable() {}
-
-var (
-	_ pref.List = listReflect{}
-	_ Unwrapper = listReflect{}
-)
diff --git a/internal/value/map.go b/internal/value/map.go
index db9656e..8505798 100644
--- a/internal/value/map.go
+++ b/internal/value/map.go
@@ -10,7 +10,10 @@
 	pref "github.com/golang/protobuf/v2/reflect/protoreflect"
 )
 
-func MapOf(p interface{}, kc, kv Converter) pref.Map {
+func MapOf(p interface{}, kc, kv Converter) interface {
+	pref.Map
+	Unwrapper
+} {
 	// TODO: Validate that p is a *map[K]V?
 	rv := reflect.ValueOf(p).Elem()
 	return mapReflect{rv, kc, kv}
@@ -75,12 +78,7 @@
 		}
 	}
 }
-func (ms mapReflect) Unwrap() interface{} {
+func (ms mapReflect) ProtoUnwrap() interface{} {
 	return ms.v.Addr().Interface()
 }
 func (ms mapReflect) ProtoMutable() {}
-
-var (
-	_ pref.Map  = mapReflect{}
-	_ Unwrapper = mapReflect{}
-)