mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[ConstraintSystem] Minor refactor to avoid creating scopes we don't need.
This probably won't hit much, and shouldn't change behavior in any way outside of statistics we generate about the number of scopes that get opened.
This commit is contained in:
@@ -623,16 +623,15 @@ bool ConstraintSystem::tryTypeVariableBindings(
|
||||
<< "\n";
|
||||
}
|
||||
|
||||
// If we were able to solve this without considering
|
||||
// default literals, don't bother looking at default literals.
|
||||
if (anySolved && binding.DefaultedProtocol && !sawFirstLiteralConstraint)
|
||||
break;
|
||||
|
||||
// Try to solve the system with typeVar := type
|
||||
ConstraintSystem::SolverScope scope(*this);
|
||||
if (binding.DefaultedProtocol) {
|
||||
// If we were able to solve this without considering
|
||||
// default literals, don't bother looking at default literals.
|
||||
if (!sawFirstLiteralConstraint) {
|
||||
sawFirstLiteralConstraint = true;
|
||||
if (anySolved)
|
||||
break;
|
||||
}
|
||||
sawFirstLiteralConstraint = true;
|
||||
type = openUnboundGenericType(type, typeVar->getImpl().getLocator());
|
||||
type = type->reconstituteSugar(/*recursive=*/false);
|
||||
} else if (binding.BindingSource == ConstraintKind::ArgumentConversion &&
|
||||
|
||||
Reference in New Issue
Block a user