Skip to content

Commit ee5b7d7

Browse files
committed
---
yaml --- r: 347868 b: refs/heads/master c: 5fcbdbd h: refs/heads/master
1 parent 8f82320 commit ee5b7d7

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 98f25e0af428f0159f12613cf7130750cc269339
2+
refs/heads/master: 5fcbdbd87f7db9a119598230b313bc161e83732d
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/lib/IDE/REPLCodeCompletion.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include "swift/IDE/REPLCodeCompletion.h"
1818
#include "swift/AST/ASTContext.h"
19+
#include "swift/AST/DiagnosticSuppression.h"
1920
#include "swift/AST/Module.h"
2021
#include "swift/Basic/LLVM.h"
2122
#include "swift/Basic/SourceManager.h"
@@ -193,7 +194,7 @@ doCodeCompletion(SourceFile &SF, StringRef EnteredCode, unsigned *BufferID,
193194
CodeCompletionCallbacksFactory *CompletionCallbacksFactory) {
194195
// Temporarily disable printing the diagnostics.
195196
ASTContext &Ctx = SF.getASTContext();
196-
DiagnosticTransaction DelayedDiags(Ctx.Diags);
197+
DiagnosticSuppression SuppressedDiags(Ctx.Diags);
197198

198199
std::string AugmentedCode = EnteredCode.str();
199200
AugmentedCode += '\0';
@@ -222,7 +223,10 @@ doCodeCompletion(SourceFile &SF, StringRef EnteredCode, unsigned *BufferID,
222223
// Now we are done with code completion. Remove the declarations we
223224
// temporarily inserted.
224225
SF.Decls.resize(OriginalDeclCount);
225-
DelayedDiags.abort();
226+
227+
// Reset the error state because it's only relevant to the code that we just
228+
// processed, which now gets thrown away.
229+
Ctx.Diags.resetHadAnyError();
226230
}
227231

228232
void REPLCompletions::populate(SourceFile &SF, StringRef EnteredCode) {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// While running completion on this, the typechecker produces a diagnostic and
2+
// an AST with an error type. If the ASTVerifier ran on the AST with the error
3+
// type, then it would fail. This test verifies that the ASTVerifier does not
4+
// run on ASTs with error types produced by completion requests.
5+
6+
// RUN: %target-swift-ide-test -repl-code-completion -source-filename=%s
7+
8+
let bar: NotARealType = 0; ba

0 commit comments

Comments
 (0)