@@ -1723,6 +1723,10 @@ void ConstraintSystem::partitionForDesignatedTypes(
1723
1723
auto *parentDC = funcDecl->getParent ();
1724
1724
auto *parentDecl = parentDC->getSelfNominalTypeDecl ();
1725
1725
1726
+ // Skip anything not defined in a nominal type.
1727
+ if (!parentDecl)
1728
+ return false ;
1729
+
1726
1730
for (auto designatedTypeIndex : indices (designatedNominalTypes)) {
1727
1731
auto *designatedNominal =
1728
1732
designatedNominalTypes[designatedTypeIndex];
@@ -1807,7 +1811,6 @@ void ConstraintSystem::partitionDisjunction(
1807
1811
1808
1812
SmallVector<unsigned , 4 > disabled;
1809
1813
SmallVector<unsigned , 4 > unavailable;
1810
- SmallVector<unsigned , 4 > globalScope;
1811
1814
1812
1815
// First collect disabled constraints.
1813
1816
forEachChoice (Choices, [&](unsigned index, Constraint *constraint) -> bool {
@@ -1831,20 +1834,6 @@ void ConstraintSystem::partitionDisjunction(
1831
1834
});
1832
1835
}
1833
1836
1834
- // Collect everything at the global scope.
1835
- forEachChoice (Choices, [&](unsigned index, Constraint *constraint) -> bool {
1836
- auto *decl = constraint->getOverloadChoice ().getDecl ();
1837
- auto *funcDecl = cast<FuncDecl>(decl);
1838
-
1839
- // Skip anything defined within a type.
1840
- auto *parentDecl = funcDecl->getParent ()->getAsDecl ();
1841
- if (parentDecl)
1842
- return false ;
1843
-
1844
- globalScope.push_back (index);
1845
- return true ;
1846
- });
1847
-
1848
1837
// Local function to create the next partition based on the options
1849
1838
// passed in.
1850
1839
PartitionAppendCallback appendPartition =
@@ -1857,9 +1846,6 @@ void ConstraintSystem::partitionDisjunction(
1857
1846
1858
1847
partitionForDesignatedTypes (Choices, forEachChoice, appendPartition);
1859
1848
1860
- // Add all the things defined at global scope.
1861
- appendPartition (globalScope);
1862
-
1863
1849
SmallVector<unsigned , 4 > everythingElse;
1864
1850
// Gather the remaining options.
1865
1851
forEachChoice (Choices, [&](unsigned index, Constraint *constraint) -> bool {
0 commit comments