Skip to content

Commit 2872210

Browse files
committed
[CodeCompletion] Fix a call to computeDefaultMap
Resolves SR-10795.
1 parent dcabcb3 commit 2872210

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/IDE/CodeCompletion.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,9 +1457,8 @@ protocolForLiteralKind(CodeCompletionLiteralKind kind) {
14571457
/// that is of type () -> ().
14581458
static bool hasTrivialTrailingClosure(const FuncDecl *FD,
14591459
AnyFunctionType *funcType) {
1460-
SmallBitVector defaultMap =
1461-
computeDefaultMap(funcType->getParams(), FD,
1462-
/*level*/ FD->isInstanceMember() ? 1 : 0);
1460+
auto defaultMap = computeDefaultMap(funcType->getParams(), FD,
1461+
/*skipCurriedSelf*/ FD->hasCurriedSelf());
14631462

14641463
if (defaultMap.size() - defaultMap.count() == 1) {
14651464
auto param = funcType->getParams().back();

test/IDE/complete_trailing_closure.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ func test1() {
5656
struct S {
5757
func method1(_: ()->()) {}
5858
static func method2(_: ()->()) {}
59+
static func method3(_ a: Int = 0, _: ()->()) {}
5960
func nonTrivial1(_: (Int)->()) {}
6061
func nonTrivial2(_: @autoclosure ()->()) {}
6162
func test2() {
@@ -81,6 +82,7 @@ func test5() {
8182
}
8283
// STATIC_METHOD_1-NOT: {|}
8384
// STATIC_METHOD_1: Decl[StaticMethod]/CurrNominal: method2 {|}[#Void#]
85+
// STATIC_METHOD_1: Decl[StaticMethod]/CurrNominal: method3 {|}[#Void#]
8486
// STATIC_METHOD_1-NOT: {|}
8587

8688
class C {

0 commit comments

Comments
 (0)