mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[SourceKit] Fix assertion failure in sortTopN
With the unqualified fallback we start to hit this assertion for `return nil` in failable intializers. We ought to be able to just skip over literal buckets though.
This commit is contained in:
@@ -847,10 +847,7 @@ static void sortTopN(const Options &options, Group *group,
|
||||
unsigned endNewIndex = 0;
|
||||
for (unsigned i = 1; i < contents.size(); ++i) {
|
||||
auto bucket = getResultBucket(*contents[i], hasRequiredTypes);
|
||||
if (bucket < best) {
|
||||
// This algorithm assumes we don't have both literal and
|
||||
// literal-type-match at the start of the list.
|
||||
assert(bucket != ResultBucket::Literal);
|
||||
if (bucket < best && bucket != ResultBucket::Literal) {
|
||||
if (isTopNonLiteralResult(*contents[i], best)) {
|
||||
beginNewIndex = i;
|
||||
endNewIndex = beginNewIndex + 1;
|
||||
|
||||
Reference in New Issue
Block a user