@@ -4730,9 +4730,6 @@ class ConstraintSystem {
4730
4730
// / Whether the bindings of this type involve other type variables.
4731
4731
bool InvolvesTypeVariables = false ;
4732
4732
4733
- // / Whether this type variable is considered a hole in the constraint system.
4734
- bool IsHole = false ;
4735
-
4736
4733
// / Whether the bindings represent (potentially) incomplete set,
4737
4734
// / there is no way to say with absolute certainty if that's the
4738
4735
// / case, but that could happen when certain constraints like
@@ -4761,6 +4758,17 @@ class ConstraintSystem {
4761
4758
// / Determine whether the set of bindings is non-empty.
4762
4759
explicit operator bool () const { return !Bindings.empty (); }
4763
4760
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
+
4764
4772
// / Determine if the bindings only constrain the type variable from above
4765
4773
// / with an existential type; such a binding is not very helpful because
4766
4774
// / it's impossible to enumerate the existential type's subtypes.
@@ -4784,7 +4792,7 @@ class ConstraintSystem {
4784
4792
auto numDefaults = b.getNumDefaultableBindings ();
4785
4793
auto hasNoDefaultableBindings = b.Bindings .size () > numDefaults;
4786
4794
4787
- return std::make_tuple (b.IsHole ,
4795
+ return std::make_tuple (b.isHole () ,
4788
4796
!hasNoDefaultableBindings,
4789
4797
b.FullyBound ,
4790
4798
b.isSubtypeOfExistentialType (),
@@ -4820,7 +4828,7 @@ class ConstraintSystem {
4820
4828
// for "subtype" type variable to attempt more bindings later.
4821
4829
// This is required because algorithm can't currently infer
4822
4830
// bindings for subtype transitively through superclass ones.
4823
- if (!(x. IsHole && y. IsHole )) {
4831
+ if (!(std::get< 0 >(xScore) && std::get< 0 >(yScore) )) {
4824
4832
if (x.isSubtypeOf (y.TypeVar ))
4825
4833
return false ;
4826
4834
0 commit comments