Skip to content

Commit b22c200

Browse files
committed
[CodeCompletion] Calling a static function on a type is not unapplied
1 parent 146d8bc commit b22c200

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/IDE/PostfixCompletion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static bool isUnappliedFunctionRef(const OverloadChoice &Choice) {
9494
// We consider curried member calls as unapplied. E.g.
9595
// MyStruct.someInstanceFunc(theInstance)#^COMPLETE^#
9696
// is unapplied.
97-
return BaseTy->is<MetatypeType>();
97+
return BaseTy->is<MetatypeType>() && !Choice.getDeclOrNull()->isStatic();
9898
} else {
9999
return false;
100100
}

test/IDE/complete_call_pattern_heuristics.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,13 @@ func testArg2Name3() {
4242
// LABELED_FIRSTARG-NOT: ['(']{#arg1: Int#}, {#arg2: Int#}[')'][#Void#];
4343
// LABELED_FIRSTARG: End completions
4444

45+
struct StaticMethods {
46+
static func before() {
47+
self.after(num)#^AFTER_STATIC_FUNC^#
48+
}
49+
static func after(_ num: Int) -> (() -> Int) {}
50+
// AFTER_STATIC_FUNC: Begin completions, 2 items
51+
// AFTER_STATIC_FUNC-DAG: Keyword[self]/CurrNominal: .self[#(() -> Int)#];
52+
// AFTER_STATIC_FUNC-DAG: Pattern/CurrModule/Flair[ArgLabels]: ()[#Int#];
53+
// AFTER_STATIC_FUNC: End completions
54+
}

0 commit comments

Comments
 (0)