Skip to content

Commit 59b228f

Browse files
committed
Don't emit an error for code completion
Now that we no longer perform whole-file type checking for code completion, the ASTVerifier is no longer expecting fully semantically valid AST. As such, we no longer need to emit an error to force it to be more lax with its checks.
1 parent 7d7b194 commit 59b228f

File tree

3 files changed

+1
-12
lines changed

3 files changed

+1
-12
lines changed

include/swift/AST/DiagnosticsFrontend.def

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +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-
199196
ERROR(verify_encountered_fatal,none,
200197
"fatal error encountered while in -verify mode", ())
201198

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)