From 11e80b604130263dbbade6e36372b24ca98752a9 Mon Sep 17 00:00:00 2001 From: Neil Dhar Date: Mon, 22 May 2023 12:04:58 -0700 Subject: [PATCH] Remove upcasting test in BridgingTest.cpp (#37519) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37519 While these tests currently happen to pass, actually trying to instantiate `fromJs` fails to compile. I suspect this is attributable to some difference in how `fromJs` is instantiated in evaluated and unevaluated contexts. That is since `supportsFromJs` only instantiates it in an unevaluated context (in a decltype), the rules are presumably different. It is also worth noting that the operator of up-casting JSI types to `jsi::Value` is explicitly deleted in `Converter`, which suggests that the conversion this test is checking for may be intentionally unsupported. For now, since `fromJs` cannot actually be used with the given parameters, delete the test. This unblocks a later diff which changes the constructor of `jsi::Value` such that `std::is_convertible` is no longer true (the conversion is never allowed, but is currently enforced by `static_assert` ). With that change `supportsFromJs` also becomes false. Changelog: [Internal] Reviewed By: javache, cortinico Differential Revision: D46059603 fbshipit-source-id: 01ede3cadb74ce6a3cd9d5d3ce34b8648fd88de7 --- .../ReactCommon/react/bridging/tests/BridgingTest.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/react-native/ReactCommon/react/bridging/tests/BridgingTest.cpp b/packages/react-native/ReactCommon/react/bridging/tests/BridgingTest.cpp index 6d739619f90..b1f0e1b8138 100644 --- a/packages/react-native/ReactCommon/react/bridging/tests/BridgingTest.cpp +++ b/packages/react-native/ReactCommon/react/bridging/tests/BridgingTest.cpp @@ -475,11 +475,9 @@ TEST_F(BridgingTest, supportTest) { EXPECT_FALSE((bridging::supportsFromJs, jsi::String>)); EXPECT_FALSE((bridging::supportsFromJs, jsi::String &>)); - // Ensure copying and up/down casting JSI values is also supported. + // Ensure copying and down casting JSI values is also supported. EXPECT_TRUE((bridging::supportsFromJs)); EXPECT_TRUE((bridging::supportsFromJs)); - EXPECT_TRUE((bridging::supportsFromJs)); - EXPECT_TRUE((bridging::supportsFromJs)); EXPECT_TRUE((bridging::supportsFromJs)); EXPECT_TRUE((bridging::supportsFromJs)); EXPECT_TRUE((bridging::supportsFromJs));