Skip to content

Commit 18670d2

Browse files
authored
Runtime class name for bare IInspectable should not be "Object" (#930)
1 parent 342edc5 commit 18670d2

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

strings/base_implements.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,15 @@ namespace winrt::impl
430430
}
431431
};
432432

433+
template <>
434+
struct runtime_class_name<Windows::Foundation::IInspectable>
435+
{
436+
static hstring get()
437+
{
438+
return {};
439+
}
440+
};
441+
433442
template <typename D, typename I, typename Enable>
434443
struct producer
435444
{

test/old_tests/UnitTests/IInspectable_GetRuntimeClassName.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ TEST_CASE("Test_GetRuntimeClassName_NoOverride")
2828
{
2929
Windows::Foundation::IInspectable i = make<Test_GetRuntimeClassName_NoOverride>();
3030

31-
REQUIRE(get_class_name(i) == L"Object");
31+
REQUIRE(get_class_name(i) == L"");
3232
}
3333

3434
TEST_CASE("Test_GetRuntimeClassName_Override")

test/old_tests/UnitTests/constexpr.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ TEST_CASE("constexpr")
3535
REQUIRE(winrt::guid_of<winrt::IInspectable>() == winrt::guid(__uuidof(::IInspectable)));
3636
REQUIRE(winrt::guid_of<winrt_container>() == winrt::guid(__uuidof(midl_container)));
3737
REQUIRE(winrt::name_of<winrt::IInspectable>() == L"Object"sv);
38+
REQUIRE(winrt::name_of<winrt::IAsyncOperation<winrt::IInspectable>>() == L"Windows.Foundation.IAsyncOperation`1<Object>"sv);
3839

3940
REQUIRE(winrt::name_of<winrt_container>() == midl_container::z_get_rc_name_impl());
4041

test/old_tests/UnitTests/produce.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ struct produce_IInspectable_RuntimeClassName : implements<produce_IInspectable_R
133133
TEST_CASE("produce_IInspectable_RuntimeClassName")
134134
{
135135
Windows::Foundation::IInspectable without = make<produce_IInspectable_No_RuntimeClassName>();
136-
REQUIRE(get_class_name(without) == L"Object");
136+
REQUIRE(get_class_name(without) == L"");
137137

138138
Windows::Foundation::IInspectable with = make<produce_IInspectable_RuntimeClassName>();
139139
REQUIRE(get_class_name(with) == L"produce_IInspectable_RuntimeClassName");

0 commit comments

Comments
 (0)