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