Skip to content

Commit b2fb118

Browse files
authored
Merge pull request #17288 from AnthonyLatsis/multifile-code-compl-fix-witness-and-req-shown
[CodeCompletion] Resolve witnesses when conformance in different file to avoid dups
2 parents 62b7310 + d80ca85 commit b2fb118

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

lib/AST/LookupVisibleDecls.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,9 +441,13 @@ static void lookupDeclsFromProtocolsBeingConformedTo(
441441
continue;
442442
}
443443
if (auto *VD = dyn_cast<ValueDecl>(Member)) {
444-
if (TypeResolver)
444+
if (TypeResolver) {
445445
TypeResolver->resolveDeclSignature(VD);
446-
446+
if (!NormalConformance->hasWitness(VD) &&
447+
(Conformance->getDeclContext()->getParentSourceFile() !=
448+
FromContext->getParentSourceFile()))
449+
TypeResolver->resolveWitness(NormalConformance, VD);
450+
}
447451
// Skip value requirements that have corresponding witnesses. This cuts
448452
// down on duplicates.
449453
if (!NormalConformance->hasWitness(VD) ||

test/IDE/complete_multiple_files.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ func testObjectExpr() {
1616
// T1-NEXT: Keyword[self]/CurrNominal: self[#FooStruct#]; name=self
1717
// T1-NEXT: Decl[InstanceVar]/CurrNominal: instanceVar[#Int#]{{; name=.+$}}
1818
// T1-NEXT: Decl[InstanceMethod]/CurrNominal: instanceFunc0()[#Void#]{{; name=.+$}}
19-
//
20-
// FIX-ME(SR-7225): We shouldn't duplicate this.
21-
// T1-NEXT: Decl[InstanceVar]/Super: instanceVar[#Int#]{{; name=.+$}}
2219
// T1-NEXT: End completions
2320

2421
func testGenericObjectExpr() {
@@ -28,9 +25,6 @@ func testGenericObjectExpr() {
2825
// T2-NEXT: Keyword[self]/CurrNominal: self[#GenericFooStruct<Void>#]; name=self
2926
// T2-NEXT: Decl[InstanceVar]/CurrNominal: instanceVar[#Int#]{{; name=.+$}}
3027
// T2-NEXT: Decl[InstanceMethod]/CurrNominal: instanceFunc0()[#Void#]{{; name=.+$}}
31-
//
32-
// FIX-ME(SR-7225): We shouldn't duplicate this.
33-
// T2-NEXT: Decl[InstanceVar]/Super: instanceVar[#Int#]{{; name=.+$}}
3428
// T2-NEXT: End completions
3529

3630
func topLevel1() {

0 commit comments

Comments
 (0)