internal/impl: add fast-path for IsInitialized

This currently returns uninformative errors from the fast path and then
consults the slow, reflection-based path only when an error is detected.
Perhaps it's worth going through the effort of producing better errors
directly on the fast path.

Change-Id: I68536e9438010dbd97dbaff4f47b78430221d94b
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/171462
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
diff --git a/proto/decode_test.go b/proto/decode_test.go
index bac7fb0..b2b6227 100644
--- a/proto/decode_test.go
+++ b/proto/decode_test.go
@@ -1139,6 +1139,29 @@
 		}.Marshal(),
 	},
 	{
+		desc:    "required field in oneof message unset",
+		partial: true,
+		decodeTo: []proto.Message{
+			&testpb.TestRequiredForeign{OneofField: &testpb.TestRequiredForeign_OneofMessage{
+				&testpb.TestRequired{},
+			}},
+		},
+		wire: pack.Message{pack.Tag{4, pack.BytesType}, pack.LengthPrefix(pack.Message{})}.Marshal(),
+	},
+	{
+		desc: "required field in oneof message set",
+		decodeTo: []proto.Message{
+			&testpb.TestRequiredForeign{OneofField: &testpb.TestRequiredForeign_OneofMessage{
+				&testpb.TestRequired{
+					RequiredField: scalar.Int32(1),
+				},
+			}},
+		},
+		wire: pack.Message{pack.Tag{4, pack.BytesType}, pack.LengthPrefix(pack.Message{
+			pack.Tag{1, pack.VarintType}, pack.Varint(1),
+		})}.Marshal(),
+	},
+	{
 		desc:              "required field in extension message unset",
 		partial:           true,
 		invalidExtensions: true,