Sema: several improvements on missing switch cases diagnostics. (#8026)

1. Make sure the actions taken by fixits are reflected in diagnostics messages.
2. Issue missing cases diagnostics at the start of the switch statement instead of its end.
3. Use <#code#> instead of <#Code#> in the stub.
This commit is contained in:
Xi Ge
2017-03-10 19:32:37 -08:00
committed by GitHub
parent 6ee6378e5d
commit b4cf37bf7d
23 changed files with 126 additions and 85 deletions

View File

@@ -21,6 +21,7 @@
#include "SourceKit/Support/UIdent.h"
#include "swift/AST/AST.h"
#include "swift/AST/ASTPrinter.h"
#include "swift/AST/ASTVisitor.h"
#include "swift/AST/ASTWalker.h"
#include "swift/AST/SourceEntityWalker.h"
@@ -1988,7 +1989,7 @@ void SwiftEditorDocument::expandPlaceholder(unsigned Offset, unsigned Length,
}
if (HasSignature)
OS << "in";
OS << "\n<#code#>\n";
OS << "\n" << getCodePlaceholder() << "\n";
OS << "}";
}
Consumer.handleSourceText(ExpansionStr);