@@ -10431,22 +10431,33 @@ performMemberLookup(ConstraintKind constraintKind, DeclNameRef memberName,
1043110431 }
1043210432
1043310433 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+
1043410449 // We may not be able to derive a well defined type for an existential
1043510450 // 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;
1044210456
10443- case ExistentialMemberAccessLimitation::ReadOnly:
10444- case ExistentialMemberAccessLimitation::None:
10445- break;
10446- }
10457+ case ExistentialMemberAccessLimitation::ReadOnly:
10458+ case ExistentialMemberAccessLimitation::None:
10459+ return false;
1044710460 }
10448-
10449- return false;
1045010461 };
1045110462
1045210463 // See if we have an instance method, instance member or static method,
0 commit comments