Defer analysis of large switch bodies

This presents a regression in diagnostic quality that is definitely
worth it not to lie to SILGen about whether a switch is covered or not.

At the same time, disable SIL’s unreachable diagnostic for ‘default’
clauses which would previously cause a warning to be emitted if the
default was proven to be unreachable.  This analysis is incomplete
anyways and can be done by Sema in the future if we desire.
This commit is contained in:
Robert Widmann
2017-12-08 13:26:22 -05:00
parent 8990bd00b6
commit 43f06afef2
7 changed files with 99 additions and 54 deletions

View File

@@ -1031,7 +1031,8 @@ void PatternMatchEmission::emitDispatch(ClauseMatrix &clauses, ArgArray args,
} else {
Loc = clauses[firstRow].getCasePattern()->getStartLoc();
}
SGF.SGM.diagnose(Loc, diag::unreachable_case, isDefault);
if (!isDefault)
SGF.SGM.diagnose(Loc, diag::unreachable_case);
}
}
}