Skip to content

Commit 735ef83

Browse files
committed
[Code completion] Suppress vacuous infix operator completions.
With the previous type-checker change, we end up with some vacuous infix operator completions, where the right-hand side and result type are *both* type variables. Suppress these; they aren't useful to the developer.
1 parent f1c4e14 commit 735ef83

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/IDE/CodeCompletion.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3313,6 +3313,12 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
33133313
}
33143314
}
33153315

3316+
// If the right-hand side and result type are both type parameters, we're
3317+
// not providing a useful completion.
3318+
if (expr->getType()->isTypeParameter() &&
3319+
CCE.getType()->isTypeParameter())
3320+
return;
3321+
33163322
addInfixOperatorCompletion(op, expr->getType(), CCE.getType());
33173323
}
33183324
}

0 commit comments

Comments
 (0)