@@ -4177,13 +4177,12 @@ class CompletionOverrideLookup : public swift::VisibleDeclConsumer {
4177
4177
}
4178
4178
}
4179
4179
4180
- void addDesignatedInitializers (Type CurrTy ) {
4180
+ void addDesignatedInitializers (NominalTypeDecl *NTD ) {
4181
4181
if (hasFuncIntroducer || hasVarIntroducer || hasTypealiasIntroducer ||
4182
4182
hasOverridabilityModifier)
4183
4183
return ;
4184
4184
4185
- assert (CurrTy);
4186
- const auto *CD = dyn_cast_or_null<ClassDecl>(CurrTy->getAnyNominal ());
4185
+ const auto *CD = dyn_cast<ClassDecl>(NTD);
4187
4186
if (!CD)
4188
4187
return ;
4189
4188
if (!CD->hasSuperclass ())
@@ -4200,14 +4199,12 @@ class CompletionOverrideLookup : public swift::VisibleDeclConsumer {
4200
4199
}
4201
4200
}
4202
4201
4203
- void addAssociatedTypes (Type CurrTy ) {
4202
+ void addAssociatedTypes (NominalTypeDecl *NTD ) {
4204
4203
if (!hasTypealiasIntroducer &&
4205
4204
(hasFuncIntroducer || hasVarIntroducer || hasInitializerModifier ||
4206
4205
hasOverride || hasOverridabilityModifier))
4207
4206
return ;
4208
4207
4209
- NominalTypeDecl *NTD = CurrTy->getAnyNominal ();
4210
-
4211
4208
for (auto Conformance : NTD->getAllConformances ()) {
4212
4209
auto Proto = Conformance->getProtocol ();
4213
4210
if (!Proto->isAccessibleFrom (CurrDeclContext))
@@ -4233,13 +4230,14 @@ class CompletionOverrideLookup : public swift::VisibleDeclConsumer {
4233
4230
if (isa<ProtocolDecl>(CurrDeclContext))
4234
4231
return ;
4235
4232
4236
- Type CurrTy = CurrDeclContext->getDeclaredTypeInContext ();
4233
+ Type CurrTy = CurrDeclContext->getSelfTypeInContext ();
4234
+ auto *NTD = CurrDeclContext->getSelfNominalTypeDecl ();
4237
4235
if (CurrTy && !CurrTy->is <ErrorType>()) {
4238
4236
lookupVisibleMemberDecls (*this , CurrTy, CurrDeclContext,
4239
4237
TypeResolver,
4240
4238
/* includeInstanceMembers=*/ false );
4241
- addDesignatedInitializers (CurrTy );
4242
- addAssociatedTypes (CurrTy );
4239
+ addDesignatedInitializers (NTD );
4240
+ addAssociatedTypes (NTD );
4243
4241
}
4244
4242
}
4245
4243
};
0 commit comments