@@ -4730,9 +4730,6 @@ class ConstraintSystem {
47304730 // / Whether the bindings of this type involve other type variables.
47314731 bool InvolvesTypeVariables = false ;
47324732
4733- // / Whether this type variable is considered a hole in the constraint system.
4734- bool IsHole = false ;
4735-
47364733 // / Whether the bindings represent (potentially) incomplete set,
47374734 // / there is no way to say with absolute certainty if that's the
47384735 // / case, but that could happen when certain constraints like
@@ -4761,6 +4758,17 @@ class ConstraintSystem {
47614758 // / Determine whether the set of bindings is non-empty.
47624759 explicit operator bool () const { return !Bindings.empty (); }
47634760
4761+ // / If there is only one binding and it's to a hole type, consider
4762+ // / this type variable to be a hole in a constraint system regardless
4763+ // / of where hole type originated.
4764+ bool isHole () const {
4765+ if (Bindings.size () != 1 )
4766+ return false ;
4767+
4768+ auto &binding = Bindings.front ();
4769+ return binding.BindingType ->is <HoleType>();
4770+ }
4771+
47644772 // / Determine if the bindings only constrain the type variable from above
47654773 // / with an existential type; such a binding is not very helpful because
47664774 // / it's impossible to enumerate the existential type's subtypes.
@@ -4784,7 +4792,7 @@ class ConstraintSystem {
47844792 auto numDefaults = b.getNumDefaultableBindings ();
47854793 auto hasNoDefaultableBindings = b.Bindings .size () > numDefaults;
47864794
4787- return std::make_tuple (b.IsHole ,
4795+ return std::make_tuple (b.isHole () ,
47884796 !hasNoDefaultableBindings,
47894797 b.FullyBound ,
47904798 b.isSubtypeOfExistentialType (),
@@ -4820,7 +4828,7 @@ class ConstraintSystem {
48204828 // for "subtype" type variable to attempt more bindings later.
48214829 // This is required because algorithm can't currently infer
48224830 // bindings for subtype transitively through superclass ones.
4823- if (!(x. IsHole && y. IsHole )) {
4831+ if (!(std::get< 0 >(xScore) && std::get< 0 >(yScore) )) {
48244832 if (x.isSubtypeOf (y.TypeVar ))
48254833 return false ;
48264834
0 commit comments