@@ -65,16 +65,14 @@ static Type dropResultOptionality(Type type, unsigned uncurryLevel) {
65
65
return FunctionType::get (parameters, resultType, fnType->getExtInfo ());
66
66
}
67
67
68
- Type swift::getMemberTypeForComparison (ASTContext &ctx, ValueDecl *member,
69
- ValueDecl *derivedDecl) {
68
+ Type swift::getMemberTypeForComparison (const ValueDecl *member,
69
+ const ValueDecl *derivedDecl) {
70
70
auto *method = dyn_cast<AbstractFunctionDecl>(member);
71
- ConstructorDecl *ctor = nullptr ;
72
- if (method)
73
- ctor = dyn_cast<ConstructorDecl>(method);
71
+ auto *ctor = dyn_cast_or_null<ConstructorDecl>(method);
74
72
75
73
auto abstractStorage = dyn_cast<AbstractStorageDecl>(member);
76
74
assert ((method || abstractStorage) && " Not a method or abstractStorage?" );
77
- SubscriptDecl *subscript = dyn_cast_or_null<SubscriptDecl>(abstractStorage);
75
+ auto *subscript = dyn_cast_or_null<SubscriptDecl>(abstractStorage);
78
76
79
77
auto memberType = member->getInterfaceType ();
80
78
if (memberType->is <ErrorType>())
@@ -112,8 +110,9 @@ Type swift::getMemberTypeForComparison(ASTContext &ctx, ValueDecl *member,
112
110
return memberType;
113
111
}
114
112
115
- static bool areAccessorsOverrideCompatible (AbstractStorageDecl *storage,
116
- AbstractStorageDecl *parentStorage) {
113
+ static bool
114
+ areAccessorsOverrideCompatible (const AbstractStorageDecl *storage,
115
+ const AbstractStorageDecl *parentStorage) {
117
116
// It's okay for the storage to disagree about whether to use a getter or
118
117
// a read accessor; we'll patch up any differences when setting overrides
119
118
// for the accessors. We don't want to diagnose anything involving
@@ -143,8 +142,9 @@ static bool areAccessorsOverrideCompatible(AbstractStorageDecl *storage,
143
142
return true ;
144
143
}
145
144
146
- bool swift::isOverrideBasedOnType (ValueDecl *decl, Type declTy,
147
- ValueDecl *parentDecl, Type parentDeclTy) {
145
+ bool swift::isOverrideBasedOnType (const ValueDecl *decl, Type declTy,
146
+ const ValueDecl *parentDecl,
147
+ Type parentDeclTy) {
148
148
auto genericSig =
149
149
decl->getInnermostDeclContext ()->getGenericSignatureOfContext ();
150
150
@@ -667,7 +667,7 @@ namespace {
667
667
// / Retrieve the type of the declaration, to be used in comparisons.
668
668
Type getDeclComparisonType () {
669
669
if (!cachedDeclType) {
670
- cachedDeclType = getMemberTypeForComparison (ctx, decl);
670
+ cachedDeclType = getMemberTypeForComparison (decl);
671
671
}
672
672
673
673
return cachedDeclType;
@@ -756,7 +756,7 @@ SmallVector<OverrideMatch, 2> OverrideMatcher::match(
756
756
(void )parentStorage;
757
757
758
758
// Check whether the types are identical.
759
- auto parentDeclTy = getMemberTypeForComparison (ctx, parentDecl, decl);
759
+ auto parentDeclTy = getMemberTypeForComparison (parentDecl, decl);
760
760
if (parentDeclTy->hasError ())
761
761
continue ;
762
762
@@ -931,7 +931,7 @@ static void checkOverrideAccessControl(ValueDecl *baseDecl, ValueDecl *decl,
931
931
bool OverrideMatcher::checkOverride (ValueDecl *baseDecl,
932
932
OverrideCheckingAttempt attempt) {
933
933
auto &diags = ctx.Diags ;
934
- auto baseTy = getMemberTypeForComparison (ctx, baseDecl, decl);
934
+ auto baseTy = getMemberTypeForComparison (baseDecl, decl);
935
935
bool emittedMatchError = false ;
936
936
937
937
// If the name of our match differs from the name we were looking for,
0 commit comments