[CSFix] Add a fix to remove invalid optional unwrap

If the base type is not optional, trying to unwrap it is
incorrect. Introduce a fix to make it look like base was
an optional type which leads solver to move forward
towards possible solution.
This commit is contained in:
Pavel Yaskevich
2018-12-04 17:55:00 -08:00
parent 2c5ecb477a
commit e043e2b2b3
3 changed files with 50 additions and 3 deletions

View File

@@ -213,3 +213,12 @@ AutoClosureForwarding *AutoClosureForwarding::create(ConstraintSystem &cs,
ConstraintLocator *locator) {
return new (cs.getAllocator()) AutoClosureForwarding(cs, locator);
}
bool RemoveUnwrap::diagnose(Expr *root, bool asNote) const {
return false;
}
RemoveUnwrap *RemoveUnwrap::create(ConstraintSystem &cs, Type baseType,
ConstraintLocator *locator) {
return new (cs.getAllocator()) RemoveUnwrap(cs, baseType, locator);
}