mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[CSBindings] Separate inference storage from final product usable by the solver
`PotentialBindings` lost most of its responsibilities, and are no longer comparable. Their main purpose now is binding and metadata tracking (introduction/retraction). New `BindingSet` type is something that represents a set of bindings at the current step of the solver.
This commit is contained in:
@@ -5361,9 +5361,10 @@ bool ConstraintSystem::isReadOnlyKeyPathComponent(
|
||||
return false;
|
||||
}
|
||||
|
||||
TypeVarBindingProducer::TypeVarBindingProducer(PotentialBindings &bindings)
|
||||
: BindingProducer(bindings.CS, bindings.TypeVar->getImpl().getLocator()),
|
||||
TypeVar(bindings.TypeVar), CanBeNil(bindings.canBeNil()) {
|
||||
TypeVarBindingProducer::TypeVarBindingProducer(BindingSet &bindings)
|
||||
: BindingProducer(bindings.getConstraintSystem(),
|
||||
bindings.getTypeVariable()->getImpl().getLocator()),
|
||||
TypeVar(bindings.getTypeVariable()), CanBeNil(bindings.canBeNil()) {
|
||||
if (bindings.isDirectHole()) {
|
||||
auto *locator = getLocator();
|
||||
// If this type variable is associated with a code completion token
|
||||
@@ -5371,8 +5372,9 @@ TypeVarBindingProducer::TypeVarBindingProducer(PotentialBindings &bindings)
|
||||
// to point to a code completion token to avoid attempting to "fix"
|
||||
// this problem since its rooted in the fact that constraint system
|
||||
// is under-constrained.
|
||||
if (bindings.AssociatedCodeCompletionToken) {
|
||||
locator = CS.getConstraintLocator(bindings.AssociatedCodeCompletionToken);
|
||||
if (bindings.getAssociatedCodeCompletionToken()) {
|
||||
locator =
|
||||
CS.getConstraintLocator(bindings.getAssociatedCodeCompletionToken());
|
||||
}
|
||||
|
||||
Bindings.push_back(Binding::forHole(TypeVar, locator));
|
||||
|
||||
Reference in New Issue
Block a user