@@ -1665,7 +1665,7 @@ ConstraintSystem::getTypeOfReference(ValueDecl *value,
16651665 ConstraintLocatorBuilder locator,
16661666 DeclContext *useDC) {
16671667 auto &ctx = getASTContext ();
1668-
1668+
16691669 if (value->getDeclContext ()->isTypeContext () && isa<FuncDecl>(value)) {
16701670 // Unqualified lookup can find operator names within nominal types.
16711671 auto func = cast<FuncDecl>(value);
@@ -1711,14 +1711,16 @@ ConstraintSystem::getTypeOfReference(ValueDecl *value,
17111711 auto funcType = funcDecl->getInterfaceType ()->castTo <AnyFunctionType>();
17121712 auto numLabelsToRemove = getNumRemovedArgumentLabels (
17131713 funcDecl, /* isCurriedInstanceReference=*/ false , functionRefKind);
1714-
1714+
17151715 if (ctx.LangOpts .hasFeature (Feature::InferSendableMethods)) {
17161716 // All global functions should be @Sendable
1717- if (funcDecl->getDeclContext ()->isLocalContext ()) {
1718- funcType = funcType->withExtInfo (funcType->getExtInfo ().withConcurrent ())->getAs <AnyFunctionType>();
1717+ if (funcDecl->getDeclContext ()->isLocalContext ()) {
1718+ funcType =
1719+ funcType->withExtInfo (funcType->getExtInfo ().withConcurrent ())
1720+ ->getAs <AnyFunctionType>();
17191721 }
17201722 }
1721-
1723+
17221724 auto openedType = openFunctionType (funcType, locator, replacements,
17231725 funcDecl->getDeclContext ())
17241726 ->removeArgumentLabels (numLabelsToRemove);
@@ -2641,26 +2643,27 @@ ConstraintSystem::getTypeOfMemberReference(
26412643 if (inferredSendable) {
26422644 auto sendableProtocol = parentModule->getASTContext ().getProtocol (
26432645 KnownProtocolKind::Sendable);
2644- auto baseConformance = TypeChecker::conformsToProtocol (
2645- baseOpenedTy, sendableProtocol, parentModule );
2646+ auto baseConformance =
2647+ parentModule-> lookupConformance ( baseOpenedTy, sendableProtocol);
26462648
26472649 if (baseTypeSendable) {
26482650 // Add @Sendable to functions without conditional conformances
2649- if (baseConformance.getConditionalRequirements ().empty ()){
2651+ if (baseConformance.getConditionalRequirements ().empty ()) {
26502652 functionType = functionType->withExtInfo (functionType->getExtInfo ().withConcurrent ())->getAs <FunctionType>();
26512653 } else {
26522654 // Handle Conditional Conformances
26532655 auto substitutionMap = SubstitutionMap::getProtocolSubstitutions (
2654- sendableProtocol, baseOpenedTy,
2655- baseConformance);
2656-
2657- auto result = TypeChecker::checkGenericArguments (parentModule, baseConformance.getConditionalRequirements (), QuerySubstitutionMap{substitutionMap} );
2658-
2656+ sendableProtocol, baseOpenedTy, baseConformance);
2657+
2658+ auto result = TypeChecker::checkGenericArguments (
2659+ parentModule, baseConformance.getConditionalRequirements (),
2660+ QuerySubstitutionMap{substitutionMap});
2661+
26592662 if (result == CheckGenericArgumentsResult::Success) {
26602663 functionType =
2661- functionType
2662- ->withExtInfo (functionType->getExtInfo ().withConcurrent ())
2663- ->getAs <FunctionType>();
2664+ functionType
2665+ ->withExtInfo (functionType->getExtInfo ().withConcurrent ())
2666+ ->getAs <FunctionType>();
26642667 }
26652668 }
26662669 }
@@ -2672,10 +2675,10 @@ ConstraintSystem::getTypeOfMemberReference(
26722675 FunctionType::get (fullFunctionType->getParams (), functionType, info);
26732676
26742677 // Add @Sendable to openedType if possible
2675- if (inferredSendable){
2678+ if (inferredSendable) {
26762679 auto origFnType = openedType->castTo <FunctionType>();
26772680 openedType =
2678- origFnType->withExtInfo (origFnType->getExtInfo ().withConcurrent ());
2681+ origFnType->withExtInfo (origFnType->getExtInfo ().withConcurrent ());
26792682 }
26802683 }
26812684
0 commit comments