[ConstraintSystem] Don't track captures if solver was in diagnostic mode

If solution application is attempted for one of the sub-expressions,
while diagnostics are trying to narrow down where the failure is
located, don't record that captures need to be computed for closures,
because that could fail later on as in such conditions expressions
are not guaranteed to have correct types (e.g. some types could be
set to "unresolved").
This commit is contained in:
Pavel Yaskevich
2019-06-13 00:56:00 -07:00
parent 735a884c06
commit 59bc60eb20
3 changed files with 16 additions and 1 deletions

View File

@@ -7398,7 +7398,11 @@ namespace {
ClosuresToTypeCheck.push_back(closure);
}
tc.ClosuresWithUncomputedCaptures.push_back(closure);
// Don't try to register captures if constraint system is used to
// produce diagnostics for one of the sub-expressions.
if (!cs.Options.contains(
ConstraintSystemFlags::SubExpressionDiagnostics))
tc.ClosuresWithUncomputedCaptures.push_back(closure);
return { false, closure };
}