@@ -10431,22 +10431,33 @@ performMemberLookup(ConstraintKind constraintKind, DeclNameRef memberName,
10431
10431
}
10432
10432
10433
10433
const auto isUnsupportedExistentialMemberAccess = [&] {
10434
+ if (!instanceTy->isExistentialType())
10435
+ return false;
10436
+
10437
+ // If the base type is composed with marker protocol(s) i.e.
10438
+ // `<<Type>> & Sendable`, let's skip this check because such
10439
+ // compositions are always opened and simplified down to a
10440
+ // superclass bound post-Sema.
10441
+ if (auto *existential = instanceTy->getAs<ExistentialType>()) {
10442
+ auto *compositionTy =
10443
+ existential->getConstraintType()->getAs<ProtocolCompositionType>();
10444
+ if (compositionTy &&
10445
+ !compositionTy->withoutMarkerProtocols()->isExistentialType())
10446
+ return false;
10447
+ }
10448
+
10434
10449
// We may not be able to derive a well defined type for an existential
10435
10450
// member access if the member's signature references 'Self'.
10436
- if (instanceTy->isExistentialType()) {
10437
- switch (isMemberAvailableOnExistential(instanceTy, decl)) {
10438
- case ExistentialMemberAccessLimitation::Unsupported:
10439
- // TODO: Write-only accesses are not supported yet.
10440
- case ExistentialMemberAccessLimitation::WriteOnly:
10441
- return true;
10451
+ switch (isMemberAvailableOnExistential(instanceTy, decl)) {
10452
+ case ExistentialMemberAccessLimitation::Unsupported:
10453
+ // TODO: Write-only accesses are not supported yet.
10454
+ case ExistentialMemberAccessLimitation::WriteOnly:
10455
+ return true;
10442
10456
10443
- case ExistentialMemberAccessLimitation::ReadOnly:
10444
- case ExistentialMemberAccessLimitation::None:
10445
- break;
10446
- }
10457
+ case ExistentialMemberAccessLimitation::ReadOnly:
10458
+ case ExistentialMemberAccessLimitation::None:
10459
+ return false;
10447
10460
}
10448
-
10449
- return false;
10450
10461
};
10451
10462
10452
10463
// See if we have an instance method, instance member or static method,
0 commit comments