mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[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:
@@ -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 };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user