internal/impl: handle irregular messages implementing proto.Message
When encountering a type that does not have a MessageInfo, don't assume
that it's a legacy message that doesn't implement proto.Message. Add a
set of test messages exercising this case (panics prior to the
internal/impl change).
Change-Id: Ic1ec5ecfbe92278fbef44284ff52a0e0622a158c
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/182477
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
diff --git a/testing/prototest/prototest_test.go b/testing/prototest/prototest_test.go
index 82eb5b2..ec502c4 100644
--- a/testing/prototest/prototest_test.go
+++ b/testing/prototest/prototest_test.go
@@ -8,6 +8,7 @@
"fmt"
"testing"
+ irregularpb "google.golang.org/protobuf/internal/testprotos/irregular"
testpb "google.golang.org/protobuf/internal/testprotos/test"
test3pb "google.golang.org/protobuf/internal/testprotos/test3"
"google.golang.org/protobuf/proto"
@@ -20,6 +21,7 @@
(*test3pb.TestAllTypes)(nil),
(*testpb.TestRequired)(nil),
(*testpb.TestWeak)(nil),
+ (*irregularpb.Message)(nil),
} {
t.Run(fmt.Sprintf("%T", m), func(t *testing.T) {
prototest.TestMessage(t, m)