@@ -867,33 +867,26 @@ Type TypeBase::getTypeOfMember(const ValueDecl *member,
867
867
868
868
Type TypeBase::adjustSuperclassMemberDeclType (const ValueDecl *baseDecl,
869
869
const ValueDecl *derivedDecl,
870
- Type memberType ) {
870
+ Type type ) {
871
871
auto subs = SubstitutionMap::getOverrideSubstitutions (
872
872
baseDecl, derivedDecl);
873
873
874
- if (auto *genericMemberType = memberType ->getAs <GenericFunctionType>()) {
875
- memberType = FunctionType::get ( genericMemberType->getParams (),
876
- genericMemberType-> getResult (),
877
- genericMemberType-> getExtInfo () );
874
+ if (auto *genericMemberType = type ->getAs <GenericFunctionType>()) {
875
+ type = genericMemberType->substGenericArgs (subs);
876
+ } else {
877
+ type = type. subst (subs );
878
878
}
879
879
880
- auto type = memberType.subst (subs);
881
880
if (baseDecl->getDeclContext ()->getSelfProtocolDecl ())
882
881
return type;
883
882
884
883
if (auto *afd = dyn_cast<AbstractFunctionDecl>(baseDecl)) {
885
884
type = type->replaceSelfParameterType (this );
886
- if (afd->hasDynamicSelfResult ())
887
- type = type->replaceCovariantResultType (this , /* uncurryLevel=*/ 2 );
888
- } else if (auto *sd = dyn_cast<SubscriptDecl>(baseDecl)) {
889
- if (sd->getElementInterfaceType ()->hasDynamicSelfType ())
890
- type = type->replaceCovariantResultType (this , /* uncurryLevel=*/ 1 );
891
- } else if (auto *vd = dyn_cast<VarDecl>(baseDecl)) {
892
- if (vd->getValueInterfaceType ()->hasDynamicSelfType ())
893
- type = type->replaceCovariantResultType (this , /* uncurryLevel=*/ 0 );
885
+ if (isa<ConstructorDecl>(afd))
886
+ return type->replaceCovariantResultType (this , /* uncurryLevel=*/ 2 );
894
887
}
895
888
896
- return type;
889
+ return type-> replaceDynamicSelfType ( this ) ;
897
890
}
898
891
899
892
// ===----------------------------------------------------------------------===//
0 commit comments