@@ -1702,12 +1702,6 @@ void ConstraintSystem::partitionDisjunction(
1702
1702
return ;
1703
1703
}
1704
1704
1705
- SmallVector<unsigned , 4 > disabled;
1706
- SmallVector<unsigned , 4 > unavailable;
1707
- SmallVector<unsigned , 4 > globalScope;
1708
- SmallVector<SmallVector<unsigned , 4 >, 4 > definedInDesignatedType;
1709
- SmallVector<SmallVector<unsigned , 4 >, 4 > definedInExtensionOfDesignatedType;
1710
- SmallVector<unsigned , 4 > everythingElse;
1711
1705
SmallSet<Constraint *, 16 > taken;
1712
1706
1713
1707
// Local function used to iterate over the untaken choices from the
@@ -1729,6 +1723,14 @@ void ConstraintSystem::partitionDisjunction(
1729
1723
}
1730
1724
};
1731
1725
1726
+
1727
+ // First collect some things that we'll generally put near the end
1728
+ // of the partitioning.
1729
+
1730
+ SmallVector<unsigned , 4 > disabled;
1731
+ SmallVector<unsigned , 4 > unavailable;
1732
+ SmallVector<unsigned , 4 > globalScope;
1733
+
1732
1734
// First collect disabled constraints.
1733
1735
forEachChoice (Choices, [&](unsigned index, Constraint *constraint) -> bool {
1734
1736
if (!constraint->isDisabled ())
@@ -1765,6 +1767,19 @@ void ConstraintSystem::partitionDisjunction(
1765
1767
return true ;
1766
1768
});
1767
1769
1770
+ // Local function to create the next partition based on the options
1771
+ // passed in.
1772
+ auto appendPartition = [&](SmallVectorImpl<unsigned > &options) {
1773
+ if (options.size ()) {
1774
+ PartitionBeginning.push_back (Ordering.size ());
1775
+ Ordering.insert (Ordering.end (), options.begin (), options.end ());
1776
+ }
1777
+ };
1778
+
1779
+ SmallVector<SmallVector<unsigned , 4 >, 4 > definedInDesignatedType;
1780
+ SmallVector<SmallVector<unsigned , 4 >, 4 > definedInExtensionOfDesignatedType;
1781
+ SmallVector<unsigned , 4 > everythingElse;
1782
+
1768
1783
// Now collect the overload choices that are defined within the type
1769
1784
// that was designated in the operator declaration.
1770
1785
auto designatedNominalTypes = getOperatorDesignatedNominalTypes (Choices[0 ]);
@@ -1806,25 +1821,8 @@ void ConstraintSystem::partitionDisjunction(
1806
1821
});
1807
1822
}
1808
1823
1809
- // Gather the remaining options.
1810
- forEachChoice (Choices, [&](unsigned index, Constraint *constraint) -> bool {
1811
- everythingElse.push_back (index);
1812
- return true ;
1813
- });
1814
-
1815
- // Local function to create the next partition based on the options
1816
- // passed in.
1817
- auto appendPartition = [&](SmallVectorImpl<unsigned > &options) {
1818
- if (options.size ()) {
1819
- PartitionBeginning.push_back (Ordering.size ());
1820
- Ordering.insert (Ordering.end (), options.begin (), options.end ());
1821
- }
1822
- };
1823
-
1824
- // Now create the partitioning based on what was collected.
1825
-
1826
- // First we'll add partitions for each of the overloads we found in
1827
- // types that were designated as part of the operator declaration.
1824
+ // Add partitions for each of the overloads we found in types that
1825
+ // were designated as part of the operator declaration.
1828
1826
for (auto designatedTypeIndex : indices (designatedNominalTypes)) {
1829
1827
if (designatedTypeIndex < definedInDesignatedType.size ()) {
1830
1828
auto &primary = definedInDesignatedType[designatedTypeIndex];
@@ -1835,6 +1833,15 @@ void ConstraintSystem::partitionDisjunction(
1835
1833
appendPartition (secondary);
1836
1834
}
1837
1835
}
1836
+
1837
+ // Gather the remaining options.
1838
+ forEachChoice (Choices, [&](unsigned index, Constraint *constraint) -> bool {
1839
+ everythingElse.push_back (index);
1840
+ return true ;
1841
+ });
1842
+
1843
+ // Now create the remaining partitions from what we previously collected.
1844
+
1838
1845
appendPartition (everythingElse);
1839
1846
appendPartition (globalScope);
1840
1847
appendPartition (unavailable);
0 commit comments