@@ -163,6 +163,8 @@ class PolymorphicConvention {
163
163
CanType type, Args... args);
164
164
bool considerType (CanType type, IsExact_t isExact,
165
165
unsigned sourceIndex, MetadataPath &&path);
166
+ bool considerTupleType (CanTupleType type, IsExact_t isExact,
167
+ unsigned sourceIndex, MetadataPath &&path);
166
168
167
169
// / Testify to generic parameters in the Self type of a protocol
168
170
// / witness method.
@@ -354,6 +356,15 @@ bool PolymorphicConvention::considerType(CanType type, IsExact_t isExact,
354
356
std::move (path), callbacks);
355
357
}
356
358
359
+ bool PolymorphicConvention::considerTupleType (CanTupleType type, IsExact_t isExact,
360
+ unsigned sourceIndex,
361
+ MetadataPath &&path) {
362
+ FulfillmentMapCallback callbacks (*this );
363
+ return Fulfillments.searchTupleTypeMetadata (IGM, type, isExact,
364
+ MetadataState::Complete, sourceIndex,
365
+ std::move (path), callbacks);
366
+ }
367
+
357
368
void PolymorphicConvention::considerWitnessSelf (CanSILFunctionType fnType) {
358
369
CanType selfTy = fnType->getSelfInstanceType (
359
370
IGM.getSILModule (), IGM.getMaximalTypeExpansionContext ());
@@ -362,13 +373,17 @@ void PolymorphicConvention::considerWitnessSelf(CanSILFunctionType fnType) {
362
373
// First, bind type metadata for Self.
363
374
Sources.emplace_back (MetadataSource::Kind::SelfMetadata, selfTy);
364
375
365
- if (selfTy->is <GenericTypeParamType>()) {
366
- // The Self type is abstract, so we can fulfill its metadata from
367
- // the Self metadata parameter.
368
- addSelfMetadataFulfillment (selfTy);
369
- }
376
+ if (auto tupleTy = dyn_cast<TupleType>(selfTy)) {
377
+ considerTupleType (tupleTy, IsInexact, Sources.size () - 1 , MetadataPath ());
378
+ } else {
379
+ if (isa<GenericTypeParamType>(selfTy)) {
380
+ // The Self type is abstract, so we can fulfill its metadata from
381
+ // the Self metadata parameter.
382
+ addSelfMetadataFulfillment (selfTy);
383
+ }
370
384
371
- considerType (selfTy, IsInexact, Sources.size () - 1 , MetadataPath ());
385
+ considerType (selfTy, IsInexact, Sources.size () - 1 , MetadataPath ());
386
+ }
372
387
373
388
// The witness table for the Self : P conformance can be
374
389
// fulfilled from the Self witness table parameter.
0 commit comments