@@ -139,6 +139,20 @@ void ConstraintSystem::PotentialBindings::finalize(
139
139
binding.BindingType = OptionalType::get (binding.BindingType );
140
140
}
141
141
}
142
+
143
+ // If there are no bindings, typeVar may be a hole.
144
+ if (cs.shouldAttemptFixes () && Bindings.empty () &&
145
+ TypeVar->getImpl ().canBindToHole ()) {
146
+ IsHole = true ;
147
+ // If the base of the unresolved member reference like `.foo`
148
+ // couldn't be resolved we'd want to bind it to a hole at the
149
+ // very last moment possible, just like generic parameters.
150
+ auto *locator = TypeVar->getImpl ().getLocator ();
151
+ if (locator->isLastElement <LocatorPathElt::MemberRefBase>())
152
+ PotentiallyIncomplete = true ;
153
+
154
+ addPotentialBinding (PotentialBinding::forHole (cs.getASTContext (), locator));
155
+ }
142
156
}
143
157
144
158
Optional<ConstraintSystem::PotentialBindings>
@@ -858,21 +872,6 @@ ConstraintSystem::getPotentialBindings(TypeVariableType *typeVar) const {
858
872
result.addPotentialBinding ({type, AllowedBindingKind::Exact, constraint});
859
873
}
860
874
861
- // If there are no bindings, typeVar may be a hole.
862
- if (shouldAttemptFixes () && result.Bindings .empty () &&
863
- typeVar->getImpl ().canBindToHole ()) {
864
- result.IsHole = true ;
865
- // If the base of the unresolved member reference like `.foo`
866
- // couldn't be resolved we'd want to bind it to a hole at the
867
- // very last moment possible, just like generic parameters.
868
- auto *locator = typeVar->getImpl ().getLocator ();
869
- if (locator->isLastElement <LocatorPathElt::MemberRefBase>())
870
- result.PotentiallyIncomplete = true ;
871
-
872
- result.addPotentialBinding (
873
- PotentialBinding::forHole (getASTContext (), locator));
874
- }
875
-
876
875
// Determine if the bindings only constrain the type variable from above with
877
876
// an existential type; such a binding is not very helpful because it's
878
877
// impossible to enumerate the existential type's subtypes.
0 commit comments