@@ -24,14 +24,25 @@ using namespace swift;
24
24
bool EnableOverride;
25
25
bool Ran;
26
26
27
+ namespace {
28
+ template <typename T>
29
+ T getEmptyValue () {
30
+ return (T)0 ;
31
+ }
32
+
33
+ template <>
34
+ MetadataResponse getEmptyValue<MetadataResponse>() {
35
+ return MetadataResponse{nullptr , MetadataState::Complete};
36
+ }
37
+ }
27
38
28
39
#define OVERRIDE (name, ret, attrs, namespace, typedArgs, namedArgs ) \
29
40
static ret name ## Override(COMPATIBILITY_UNPAREN typedArgs, \
30
41
Original_ ## name originalImpl) { \
31
42
if (!EnableOverride) \
32
43
return originalImpl namedArgs; \
33
44
Ran = true ; \
34
- return ( ret) 0 ; \
45
+ return getEmptyValue< ret>(); \
35
46
}
36
47
#include " ../../stdlib/public/runtime/CompatibilityOverride.def"
37
48
@@ -164,4 +175,20 @@ TEST_F(CompatibilityOverrideTest, test_swift_conformsToProtocol) {
164
175
ASSERT_EQ (Result, nullptr );
165
176
}
166
177
178
+ TEST_F (CompatibilityOverrideTest, test_swift_getAssociatedTypeWitnessSlow) {
179
+ auto Result = swift_getAssociatedTypeWitnessSlow (MetadataState::Complete,
180
+ nullptr , nullptr ,
181
+ nullptr , nullptr );
182
+ ASSERT_EQ (Result.Value , nullptr );
183
+ ASSERT_EQ (Result.State , MetadataState::Complete);
184
+ }
185
+
186
+ TEST_F (CompatibilityOverrideTest,
187
+ test_swift_getAssociatedConformanceWitnessSlow) {
188
+ auto Result = swift_getAssociatedConformanceWitnessSlow (
189
+ nullptr , nullptr , nullptr ,
190
+ nullptr , nullptr );
191
+ ASSERT_EQ (Result, nullptr );
192
+ }
193
+
167
194
#endif
0 commit comments