Repository: protocolbuffers/protobuf (language: python)

Issue:
Remove unused internal::DownCast
Fixes https://github.com/protocolbuffers/protobuf/issues/19364


Discussion / hints:

Fix patch:
diff --git a/src/google/protobuf/message_lite.h b/src/google/protobuf/message_lite.h
index f135a35c2621..96a30911054b 100644
--- a/src/google/protobuf/message_lite.h
+++ b/src/google/protobuf/message_lite.h
@@ -1200,11 +1200,6 @@ T* OnShutdownDelete(T* p) {
   return p;
 }
 
-inline void AssertDownCast(const MessageLite& from, const MessageLite& to) {
-  ABSL_DCHECK(TypeId::Get(from) == TypeId::Get(to))
-      << "Cannot downcast " << from.GetTypeName() << " to " << to.GetTypeName();
-}
-
 template <bool test_call, typename MessageLite>
 PROTOBUF_ALWAYS_INLINE MessageLite* MessageCreator::PlacementNew(
     const MessageLite* prototype_for_func,


Test patch:
diff --git a/src/google/protobuf/extension_set_unittest.cc b/src/google/protobuf/extension_set_unittest.cc
index 511938ae445b..f49ea9e2154b 100644
--- a/src/google/protobuf/extension_set_unittest.cc
+++ b/src/google/protobuf/extension_set_unittest.cc
@@ -52,7 +52,6 @@ extern bool fully_verify_message_sets_opt_out;
 
 namespace {
 
-using ::google::protobuf::internal::DownCast;
 using TestUtil::EqualsToSerialized;
 
 // This test closely mirrors google/protobuf/compiler/cpp/unittest.cc
diff --git a/src/google/protobuf/map_test.inc b/src/google/protobuf/map_test.inc
index ac0e766e3416..af699eda3534 100644
--- a/src/google/protobuf/map_test.inc
+++ b/src/google/protobuf/map_test.inc
@@ -217,7 +217,6 @@ struct MapTestPeer {
 };
 
 namespace {
-using internal::DownCast;
 
 // Map API Test =====================================================
 
diff --git a/src/google/protobuf/repeated_field_reflection_unittest.inc b/src/google/protobuf/repeated_field_reflection_unittest.inc
index da4136fff9ed..cb9b09c90a4a 100644
--- a/src/google/protobuf/repeated_field_reflection_unittest.inc
+++ b/src/google/protobuf/repeated_field_reflection_unittest.inc
@@ -22,7 +22,6 @@ namespace protobuf {
 namespace {
 
 
-using internal::DownCast;
 using UNITTEST::ForeignMessage;
 using UNITTEST::TestAllExtensions;
 using UNITTEST::TestAllTypes;