Push FunctionTypeRepr Input Invariants Up

Validation of the input side of FunctionTypeRepr was previously being done in Sema because of expression folding.  If we instead push the invariant that the input TypeRepr should always be a TupleTypeRepr into the AST a number of nice cleanups fall out:

- The SIL Parser no longer accepts Swift 2-style type declarations
-  Parse is more cleanly able to reject invalid FunctionTypeReprs
- Clients of the AST can be assured the input type is always a TupleType so we can flush Swift 2 hacks
This commit is contained in:
Robert Widmann
2018-06-13 17:55:06 -07:00
parent ba4949b329
commit 1beb75583a
29 changed files with 213 additions and 179 deletions

View File

@@ -1461,7 +1461,7 @@ private:
bool walkToTypeReprPre(TypeRepr *T) override {
if (auto *FTR = dyn_cast<FunctionTypeRepr>(T)) {
FoundFunctionTypeRepr = true;
if (auto *TTR = dyn_cast_or_null<TupleTypeRepr>(FTR->getArgsTypeRepr())) {
if (auto *TTR = FTR->getArgsTypeRepr()) {
for (auto &ArgElt : TTR->getElements()) {
CharSourceRange NR;
CharSourceRange TR;