Skip to content

Commit 7063ecd

Browse files
committed
IDE: Eliminate typeCheckCompletionDecl()
1 parent d173559 commit 7063ecd

File tree

3 files changed

+6
-34
lines changed

3 files changed

+6
-34
lines changed

include/swift/Sema/IDETypeChecking.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ namespace swift {
3636
class ValueDecl;
3737
class DeclName;
3838

39-
/// Typecheck a declaration parsed during code completion.
40-
void typeCheckCompletionDecl(Decl *D);
41-
4239
/// Typecheck binding initializer at \p bindingIndex.
4340
void typeCheckPatternBinding(PatternBindingDecl *PBD, unsigned bindingIndex);
4441

lib/IDE/ExprContextAnalysis.cpp

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ void typeCheckContextImpl(DeclContext *DC, SourceLoc Loc) {
5252
case DeclContextKind::SerializedLocal:
5353
case DeclContextKind::TopLevelCodeDecl:
5454
case DeclContextKind::EnumElementDecl:
55+
case DeclContextKind::GenericTypeDecl:
56+
case DeclContextKind::SubscriptDecl:
5557
// Nothing to do for these.
5658
break;
5759

@@ -61,7 +63,7 @@ void typeCheckContextImpl(DeclContext *DC, SourceLoc Loc) {
6163
auto i = patternInit->getBindingIndex();
6264
if (PBD->getInit(i)) {
6365
PBD->getPattern(i)->forEachVariable([](VarDecl *VD) {
64-
typeCheckCompletionDecl(VD);
66+
(void) VD->getInterfaceType();
6567
});
6668
if (!PBD->isInitializerChecked(i))
6769
typeCheckPatternBinding(PBD, i);
@@ -72,29 +74,18 @@ void typeCheckContextImpl(DeclContext *DC, SourceLoc Loc) {
7274

7375
case DeclContextKind::AbstractFunctionDecl: {
7476
auto *AFD = cast<AbstractFunctionDecl>(DC);
75-
76-
// FIXME: This shouldn't be necessary, but we crash otherwise.
77-
if (auto *AD = dyn_cast<AccessorDecl>(AFD))
78-
typeCheckCompletionDecl(AD->getStorage());
79-
8077
typeCheckAbstractFunctionBodyUntil(AFD, Loc);
8178
break;
8279
}
8380

8481
case DeclContextKind::ExtensionDecl:
85-
typeCheckCompletionDecl(cast<ExtensionDecl>(DC));
86-
break;
87-
88-
case DeclContextKind::GenericTypeDecl:
89-
typeCheckCompletionDecl(cast<GenericTypeDecl>(DC));
82+
// Make sure the extension has been bound, in case it is in an
83+
// inactive #if or something weird like that.
84+
cast<ExtensionDecl>(DC)->computeExtendedNominal();
9085
break;
9186

9287
case DeclContextKind::FileUnit:
9388
llvm_unreachable("module scope context handled above");
94-
95-
case DeclContextKind::SubscriptDecl:
96-
typeCheckCompletionDecl(cast<SubscriptDecl>(DC));
97-
break;
9889
}
9990
}
10091
} // anonymous namespace

lib/Sema/TypeChecker.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -618,22 +618,6 @@ swift::handleSILGenericParams(ASTContext &Ctx, GenericParamList *genericParams,
618618
return createTypeChecker(Ctx).handleSILGenericParams(genericParams, DC);
619619
}
620620

621-
void swift::typeCheckCompletionDecl(Decl *D) {
622-
auto &Ctx = D->getASTContext();
623-
624-
DiagnosticSuppression suppression(Ctx.Diags);
625-
(void)createTypeChecker(Ctx);
626-
if (auto ext = dyn_cast<ExtensionDecl>(D)) {
627-
if (auto *nominal = ext->computeExtendedNominal()) {
628-
// FIXME(InterfaceTypeRequest): Remove this.
629-
(void)nominal->getInterfaceType();
630-
}
631-
} else {
632-
// FIXME(InterfaceTypeRequest): Remove this.
633-
(void)cast<ValueDecl>(D)->getInterfaceType();
634-
}
635-
}
636-
637621
void swift::typeCheckPatternBinding(PatternBindingDecl *PBD,
638622
unsigned bindingIndex) {
639623
assert(!PBD->isInitializerChecked(bindingIndex) &&

0 commit comments

Comments
 (0)