Skip to content

[5.2][CodeCompletion] Always look into decls to find the parsed expression #29175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions lib/IDE/ExprContextAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,6 @@ class ExprFinder : public ASTWalker {
return {isInterstingRange(S), S};
}

bool walkToDeclPre(Decl *D) override { return isInterstingRange(D); }

bool walkToTypeLocPre(TypeLoc &TL) override { return false; }
bool walkToTypeReprPre(TypeRepr *T) override { return false; }
};
Expand Down
57 changes: 57 additions & 0 deletions test/SourceKit/CodeComplete/complete_sequence_bodyrange.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
class TestChain {
class Child {
var value: Struct1?
}
class Struct1 {
var value: Struct2
}
class Struct2 {
var prop1: Int
var prop2: Int
}

var child: Child!

func foo() {
let _ = child.value?.value.
}
}

// rdar://problem/58098222

// RUN: %sourcekitd-test \
// RUN: -req=complete -req-opts=reuseastcontext=1 -pos=16:32 %s -async -- %s == \
// RUN: -req=complete -req-opts=reuseastcontext=1 -pos=16:32 %s -async -- %s == \
// RUN: -req=complete -req-opts=reuseastcontext=1 -pos=16:32 %s -async -- %s == \
// RUN: -req=complete -req-opts=reuseastcontext=1 -pos=16:32 %s -async -- %s == \
// RUN: -req=complete -req-opts=reuseastcontext=1 -pos=16:32 %s -async -- %s == \
// RUN: -req=complete -req-opts=reuseastcontext=1 -pos=16:32 %s -async -- %s == \
// RUN: -req=complete -req-opts=reuseastcontext=1 -pos=16:32 %s -async -- %s == \
// RUN: -req=complete -req-opts=reuseastcontext=1 -pos=16:32 %s -async -- %s == \
// RUN: -req=complete -req-opts=reuseastcontext=1 -pos=16:32 %s -async -- %s == \
// RUN: -req=complete -req-opts=reuseastcontext=1 -pos=16:32 %s -async -- %s | %FileCheck %s

// CHECK-NOT: key.name: "prop1"
// CHECK-NOT: key.name: "prop2"
// CHECK: key.name: "prop1",
// CHECK: key.name: "prop2",
// CHECK: key.name: "prop1",
// CHECK: key.name: "prop2",
// CHECK: key.name: "prop1",
// CHECK: key.name: "prop2",
// CHECK: key.name: "prop1",
// CHECK: key.name: "prop2",
// CHECK: key.name: "prop1",
// CHECK: key.name: "prop2",
// CHECK: key.name: "prop1",
// CHECK: key.name: "prop2",
// CHECK: key.name: "prop1",
// CHECK: key.name: "prop2",
// CHECK: key.name: "prop1",
// CHECK: key.name: "prop2",
// CHECK: key.name: "prop1",
// CHECK: key.name: "prop2",
// CHECK: key.name: "prop1",
// CHECK: key.name: "prop2",
// CHECK-NOT: key.name: "prop1"
// CHECK-NOT: key.name: "prop2"