@@ -105,6 +105,7 @@ Solution::computeSubstitutions(NullablePtr<ValueDecl> decl,
105
105
subs[opened.first ] = type;
106
106
}
107
107
108
+ auto *DC = constraintSystem->DC ;
108
109
auto lookupConformanceFn =
109
110
[&](CanType original, Type replacement,
110
111
ProtocolDecl *protoType) -> ProtocolConformanceRef {
@@ -115,8 +116,25 @@ Solution::computeSubstitutions(NullablePtr<ValueDecl> decl,
115
116
}
116
117
117
118
// FIXME: Retrieve the conformance from the solution itself.
118
- return getConstraintSystem ().DC ->getParentModule ()->lookupConformance (
119
- replacement, protoType, /* allowMissing=*/ true );
119
+ auto conformance =
120
+ getConstraintSystem ().DC ->getParentModule ()->lookupConformance (
121
+ replacement, protoType, /* allowMissing=*/ true );
122
+
123
+ if (conformance.isInvalid ()) {
124
+ if (auto *funcDecl = dyn_cast<FuncDecl>(decl.getPtrOrNull ())) {
125
+ if (funcDecl->isDistributedActorSystemRemoteCall (
126
+ /* isVoidResult=*/ false )) {
127
+ // `Res` conformances would be looked by at runtime but are
128
+ // guaranteed to be there by Sema because all distributed
129
+ // methods and accessors are checked to conform to
130
+ // `SerializationRequirement` of `DistributedActorSystem`.
131
+ if (original->isEqual (funcDecl->getResultInterfaceType ()))
132
+ return ProtocolConformanceRef (protoType);
133
+ }
134
+ }
135
+ }
136
+
137
+ return conformance;
120
138
};
121
139
122
140
return SubstitutionMap::get (sig,
0 commit comments