Skip to content

Commit 8f30626

Browse files
Merge pull request swiftlang#30574 from AnthonyLatsis/code-complete-broken-conf-no-static
[CodeCompletion] Add overlooked 'isDeclVisibleInLookupMode' check when collecting value requirements
2 parents 6dd557a + cf43a56 commit 8f30626

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

lib/Sema/LookupVisibleDecls.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,9 @@ static void lookupDeclsFromProtocolsBeingConformedTo(
438438
continue;
439439
}
440440
if (auto *VD = dyn_cast<ValueDecl>(Member)) {
441+
if (!isDeclVisibleInLookupMode(VD, LS, FromContext))
442+
continue;
443+
441444
if (!VD->isProtocolRequirement())
442445
continue;
443446

test/IDE/complete_value_expr.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@
200200
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_DICTIONARY_LITERAL_1 | %FileCheck %s -check-prefix=SIMPLE_OBJECT_DOT
201201
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_DICTIONARY_LITERAL_2 | %FileCheck %s -check-prefix=SIMPLE_OBJECT_DOT
202202
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COMPLETE_CALL_RESULT | %FileCheck %s -check-prefix=COMPLETE_CALL_RESULT
203+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-keywords=false -code-completion-token=BROKEN_CONFORMANCE | %FileCheck %s -check-prefix=BROKEN_CONFORMANCE
203204

204205
// Test code completion of expressions that produce a value.
205206

@@ -2185,3 +2186,19 @@ func testWrapSuccess(promise: Int, seal: Resolver<Void>) {
21852186
// COMPLETE_CALL_RESULT: Pattern/CurrModule: ({#Void#}, {#Bool#})[#Void#]; name=(Void, Bool)
21862187
// COMPLETE_CALL_RESULT: End completions
21872188
}
2189+
2190+
protocol BrokenConformanceP {
2191+
static func staticFunc()
2192+
func instanceFunc()
2193+
}
2194+
extension BrokenConformanceP {
2195+
static func staticFuncExtension() {}
2196+
}
2197+
struct BrokenConformanceS: BrokenConformanceP {
2198+
}
2199+
func testBrokenConformance(arg: BrokenConformanceS) {
2200+
arg.#^BROKEN_CONFORMANCE^#
2201+
// BROKEN_CONFORMANCE: Begin completions, 1 items
2202+
// BROKEN_CONFORMANCE: Decl[InstanceMethod]/Super: instanceFunc()[#Void#];
2203+
// BROKEN_CONFORMANCE: End completions
2204+
}

0 commit comments

Comments
 (0)