We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aa35045 commit d8bf4a9Copy full SHA for d8bf4a9
lib/Sema/CSApply.cpp
@@ -2544,9 +2544,9 @@ namespace {
2544
new (ctx) OtherConstructorDeclRefExpr(ref, loc, implicit, resultTy));
2545
2546
// Wrap in covariant `Self` return if needed.
2547
- if (selfTy->hasReferenceSemantics()) {
2548
- auto covariantTy = resultTy->replaceCovariantResultType(
2549
- cs.getType(base)->getWithoutSpecifierType(), 2);
+ if (ref.getDecl()->getDeclContext()->getSelfClassDecl()) {
+ auto covariantTy = resultTy->withCovariantResultType()
+ ->replaceDynamicSelfType(cs.getType(base)->getWithoutSpecifierType());
2550
if (!covariantTy->isEqual(resultTy))
2551
ctorRef = cs.cacheType(
2552
new (ctx) CovariantFunctionConversionExpr(ctorRef, covariantTy));
0 commit comments