Skip to content

Commit 588abbc

Browse files
committed
SILVerifier: Remove usage of replaceCovariantResultType()
1 parent 9be81d0 commit 588abbc

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lib/SIL/Verifier/SILVerifier.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4286,13 +4286,16 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
42864286
if (fnDecl->hasDynamicSelfResult()) {
42874287
auto anyObjectTy = C.getAnyObjectType();
42884288
for (auto &result : results) {
4289-
auto newResultTy =
4289+
auto resultTy =
42904290
result
42914291
.getReturnValueType(F.getModule(), methodTy,
4292-
F.getTypeExpansionContext())
4293-
->replaceCovariantResultType(anyObjectTy, 0);
4294-
result = SILResultInfo(newResultTy->getCanonicalType(),
4295-
result.getConvention());
4292+
F.getTypeExpansionContext());
4293+
if (resultTy->getOptionalObjectType())
4294+
resultTy = OptionalType::get(anyObjectTy)->getCanonicalType();
4295+
else
4296+
resultTy = anyObjectTy;
4297+
4298+
result = SILResultInfo(resultTy, result.getConvention());
42964299
}
42974300
}
42984301
}

0 commit comments

Comments
 (0)