Skip to content

Commit f7b1cd4

Browse files
authored
Don't emit an error for code completion (swiftlang#31286)
Don't emit an error for code completion
2 parents d385e28 + 59b228f commit f7b1cd4

File tree

3 files changed

+1
-15
lines changed

3 files changed

+1
-15
lines changed

include/swift/AST/DiagnosticsFrontend.def

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,6 @@ ERROR(repl_must_be_initialized,none,
193193
"variables currently must have an initial value when entered at the "
194194
"top level of the REPL", ())
195195

196-
ERROR(error_doing_code_completion,none,
197-
"compiler is in code completion mode (benign diagnostic)", ())
198-
199-
WARNING(completion_reusing_astcontext,none,
200-
"completion reusing previous ASTContext (benign diagnostic)", ())
201-
202196
ERROR(verify_encountered_fatal,none,
203197
"fatal error encountered while in -verify mode", ())
204198

lib/Frontend/Frontend.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -822,13 +822,6 @@ void CompilerInstance::parseAndCheckTypesUpTo(
822822
FrontendStatsTracer tracer(getStatsReporter(), "parse-and-check-types");
823823

824824
bool hadLoadError = parsePartialModulesAndInputFiles();
825-
if (Invocation.isCodeCompletion()) {
826-
// When we are doing code completion, make sure to emit at least one
827-
// diagnostic, so that ASTContext is marked as erroneous. In this case
828-
// various parts of the compiler (for example, AST verifier) have less
829-
// strict assumptions about the AST.
830-
Diagnostics.diagnose(SourceLoc(), diag::error_doing_code_completion);
831-
}
832825
if (hadLoadError)
833826
return;
834827

tools/SourceKit/lib/SwiftLang/SwiftEditor.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ void EditorDiagConsumer::handleDiagnostic(SourceManager &SM,
8383
}
8484

8585
// Filter out benign diagnostics for editing.
86-
if (Info.ID == diag::lex_editor_placeholder.ID ||
87-
Info.ID == diag::error_doing_code_completion.ID)
86+
if (Info.ID == diag::lex_editor_placeholder.ID)
8887
return;
8988

9089
bool IsNote = (Info.Kind == DiagnosticKind::Note);

0 commit comments

Comments
 (0)