mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[CSSimplify] Synthesize conformances for ad-hoc distributed witness requirements
Instead of handing failures in `matchWitness` let's syntehsize conformances during solving. Next step would be to record them and use in `Solution::computeSubstitutions`.
This commit is contained in:
@@ -8572,6 +8572,23 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyConformsToConstraint(
|
||||
if (conformance) {
|
||||
return recordConformance(conformance);
|
||||
}
|
||||
|
||||
// Account for ad-hoc requirements on some distributed actor
|
||||
// requirements.
|
||||
if (auto witnessInfo = locator.isForWitnessGenericParameterRequirement()) {
|
||||
auto *GP = witnessInfo->second;
|
||||
|
||||
// Conformance requirement between on `Res` and `SerializationRequirement`
|
||||
// of `DistributedActorSystem.remoteCall` are not expressible at the moment
|
||||
// but they are verified by Sema so it's okay to omit them here and lookup
|
||||
// dynamically during IRGen.
|
||||
if (auto *witness = dyn_cast<FuncDecl>(witnessInfo->first)) {
|
||||
if (witness->isDistributedActorSystemRemoteCall(/*isVoidReturn=*/false)) {
|
||||
if (GP->isEqual(cast<FuncDecl>(witness)->getResultInterfaceType()))
|
||||
return recordConformance(ProtocolConformanceRef(protocol));
|
||||
}
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user