Skip to content

Commit 4be80ee

Browse files
committed
AST: Address a FIXME in adjustSuperclassMemberDeclType()
This is NFC for now, but fixes tests after we remove eraseDynamicSelfType().
1 parent 337edbe commit 4be80ee

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/AST/Type.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3587,9 +3587,14 @@ Type TypeBase::adjustSuperclassMemberDeclType(const ValueDecl *baseDecl,
35873587
type = type->replaceSelfParameterType(this);
35883588
if (afd->hasDynamicSelfResult())
35893589
type = type->replaceCovariantResultType(this, /*uncurryLevel=*/2);
3590+
} else if (auto *sd = dyn_cast<SubscriptDecl>(baseDecl)) {
3591+
if (sd->getElementInterfaceType()->hasDynamicSelfType())
3592+
type = type->replaceCovariantResultType(this, /*uncurryLevel=*/1);
3593+
} else if (auto *vd = dyn_cast<VarDecl>(baseDecl)) {
3594+
if (vd->getValueInterfaceType()->hasDynamicSelfType())
3595+
type = type->replaceCovariantResultType(this, /*uncurryLevel=*/0);
35903596
}
35913597

3592-
// FIXME: Properties and subscripts can also have dynamic self returns...
35933598
return type;
35943599
}
35953600

0 commit comments

Comments
 (0)