Skip to content

Commit d3270c1

Browse files
committed
[CodeCompletion] Calling a static function on a type is not unapplied
1 parent 928a03a commit d3270c1

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lib/IDE/PostfixCompletion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ static bool isUnappliedFunctionRef(const OverloadChoice &Choice) {
141141
// We consider curried member calls as unapplied. E.g.
142142
// MyStruct.someInstanceFunc(theInstance)#^COMPLETE^#
143143
// is unapplied.
144-
return BaseTy->is<MetatypeType>();
144+
return BaseTy->is<MetatypeType>() && !Choice.getDeclOrNull()->isStatic();
145145
} else {
146146
return false;
147147
}

test/IDE/complete_call_pattern_heuristics.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,14 @@ func subscriptAccess(info: [String: Int]) {
3838
info[#^SUBSCRIPT_ACCESS^#]
3939
// SUBSCRIPT_ACCESS: Pattern/Local/Flair[ArgLabels]: {#keyPath: KeyPath<[String : Int], Value>#}[#KeyPath<[String : Int], Value>#]; name=keyPath:
4040
}
41+
42+
struct StaticMethods {
43+
static func before() {
44+
self.after(num)#^AFTER_STATIC_FUNC^#
45+
}
46+
static func after(_ num: Int) -> (() -> Int) {}
47+
// AFTER_STATIC_FUNC: Begin completions, 2 items
48+
// AFTER_STATIC_FUNC-DAG: Keyword[self]/CurrNominal: .self[#(() -> Int)#];
49+
// AFTER_STATIC_FUNC-DAG: Pattern/CurrModule/Flair[ArgLabels]: ()[#Int#];
50+
// AFTER_STATIC_FUNC: End completions
51+
}

0 commit comments

Comments
 (0)