Skip to content

Commit

Permalink
Remove upcasting test in BridgingTest.cpp (#37519)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #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<jsi::Object &, jsi::Value>` is no longer true (the
conversion is never allowed, but is currently enforced by
`static_assert` ). With that change
`supportsFromJs<jsi::Value, jsi::Object>` also becomes false.

Changelog: [Internal]

Reviewed By: javache, cortinico

Differential Revision: D46059603

fbshipit-source-id: 01ede3cadb74ce6a3cd9d5d3ce34b8648fd88de7
  • Loading branch information
neildhar authored and facebook-github-bot committed May 22, 2023
1 parent 133ccdc commit 11e80b6
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -475,11 +475,9 @@ TEST_F(BridgingTest, supportTest) {
EXPECT_FALSE((bridging::supportsFromJs<std::vector<int>, jsi::String>));
EXPECT_FALSE((bridging::supportsFromJs<std::vector<int>, 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<jsi::Value>));
EXPECT_TRUE((bridging::supportsFromJs<jsi::Value, jsi::Value &>));
EXPECT_TRUE((bridging::supportsFromJs<jsi::Value, jsi::Object>));
EXPECT_TRUE((bridging::supportsFromJs<jsi::Value, jsi::Object &>));
EXPECT_TRUE((bridging::supportsFromJs<jsi::String>));
EXPECT_TRUE((bridging::supportsFromJs<jsi::String, jsi::String>));
EXPECT_TRUE((bridging::supportsFromJs<jsi::String, jsi::String &>));
Expand Down

0 comments on commit 11e80b6

Please sign in to comment.