mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Code completion: make sure to always emit a diagnostic so that ASTContext is
marked as erroneous This is important so that other parts of the compiler (e.g., AST verifier) are less strict about AST invariants. Alternatively, we could make sure to emit a diagnostic in the parser when we consume the code completion token, but chasing every place where we do it now (and remembering to do this in future) does not scale well. Fixes the crash in rdar://problem/16100914 Swift SVN r14865
This commit is contained in:
@@ -285,6 +285,14 @@ void CompilerInstance::performParse() {
|
||||
performNameBinding(*NextInput);
|
||||
}
|
||||
|
||||
if (Invocation.isCodeCompletion()) {
|
||||
// When we are doing code completion, make sure to emit at least one
|
||||
// diagnostic, so that ASTContext is marked as erroneous. In this case
|
||||
// various parts of the compiler (for example, AST verifier) have less
|
||||
// strict assumptions about the AST.
|
||||
Diagnostics.diagnose(SourceLoc(), diag::error_doing_code_completion);
|
||||
}
|
||||
|
||||
if (hadLoadError)
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user