Skip to content

Commit e47aea4

Browse files
committed
[SourceKit] Disable completion-like cursor info for ParamDecls
1 parent 04d44bf commit e47aea4

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lib/IDE/CursorInfo.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,10 @@ class NodeFinder : ASTWalker {
150150
}
151151

152152
if (auto VD = dyn_cast<ValueDecl>(D)) {
153-
if (VD->hasName()) {
153+
// FIXME: ParamDecls might be closure parameters that can have ambiguous
154+
// types. The current infrastructure of just asking for the VD's type
155+
// doesn't work here. We need to inspect the constraints system solution.
156+
if (VD->hasName() && !isa<ParamDecl>(D)) {
154157
assert(Result == nullptr);
155158
Result = std::make_unique<NodeFinderDeclResult>(VD);
156159
return Action::Stop();
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
func save(_ record: Int, _ x: (String) -> Void) {}
2+
3+
func test() {
4+
let record = 2
5+
// RUN: %sourcekitd-test -req=cursor -pos=%(line + 1):19 %s -- %s
6+
save(record) { (record) in
7+
}
8+
}

0 commit comments

Comments
 (0)