Skip to content

Commit d8bf4a9

Browse files
committed
Sema: Remove a usage of replaceCovariantResultType()
1 parent aa35045 commit d8bf4a9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/Sema/CSApply.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2544,9 +2544,9 @@ namespace {
25442544
new (ctx) OtherConstructorDeclRefExpr(ref, loc, implicit, resultTy));
25452545

25462546
// Wrap in covariant `Self` return if needed.
2547-
if (selfTy->hasReferenceSemantics()) {
2548-
auto covariantTy = resultTy->replaceCovariantResultType(
2549-
cs.getType(base)->getWithoutSpecifierType(), 2);
2547+
if (ref.getDecl()->getDeclContext()->getSelfClassDecl()) {
2548+
auto covariantTy = resultTy->withCovariantResultType()
2549+
->replaceDynamicSelfType(cs.getType(base)->getWithoutSpecifierType());
25502550
if (!covariantTy->isEqual(resultTy))
25512551
ctorRef = cs.cacheType(
25522552
new (ctx) CovariantFunctionConversionExpr(ctorRef, covariantTy));

0 commit comments

Comments
 (0)