Skip to content

Commit 4da190d

Browse files
committed
[NameLookup] Retain invalid decls when filtering via access path
Fixes missing declarations in the completions list due to their type being invalid. Resolves rdar://70704835
1 parent 4cf7426 commit 4da190d

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

lib/AST/NameLookup.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,6 @@ void DebuggerClient::anchor() {}
138138
void AccessFilteringDeclConsumer::foundDecl(
139139
ValueDecl *D, DeclVisibilityKind reason,
140140
DynamicLookupInfo dynamicLookupInfo) {
141-
if (D->hasInterfaceType() && D->isInvalid())
142-
return;
143141
if (!D->isAccessibleFrom(DC))
144142
return;
145143

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-ide-test -batch-code-completion -source-filename %s -filecheck %raw-FileCheck -completion-output-dir %t
3+
4+
// GLOBAL: Decl[GlobalVar]/CurrModule: invalidDecl[#<<error type>>#];
5+
let invalidDecl = INVALID
6+
7+
struct S {
8+
// MEMBER: Decl[InstanceMethod]/CurrNominal: invalidMethod()[#<<error type>>#];
9+
func invalidMethod() -> INVALID
10+
}
11+
12+
func test() {
13+
#^GLOBAL_1?check=GLOBAL^#
14+
#^GLOBAL_2?check=GLOBAL^#
15+
}
16+
17+
func testMember(val: S) {
18+
val.#^MEMBER_1?check=MEMBER^##^MEMBER_2?check=MEMBER^#
19+
}

0 commit comments

Comments
 (0)