Skip to content

Commit b08993f

Browse files
authored
Merge pull request #41787 from rintaro/ide-completion-rdar90136020
[CodeCompletion] Remove a hack adding type matching nominal types
2 parents 0628969 + 504e73d commit b08993f

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

lib/IDE/CompletionLookup.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2634,22 +2634,6 @@ void CompletionLookup::getValueCompletionsInDeclContext(SourceLoc Loc,
26342634
RequestedResultsTy::toplevelResults().withModuleQualifier(
26352635
ModuleQualifier));
26362636

2637-
// Manually add any expected nominal types from imported modules so that
2638-
// they get their expected type relation. Don't include protocols, since
2639-
// they can't be initialized from the type name.
2640-
// FIXME: this does not include types that conform to an expected protocol.
2641-
// FIXME: this creates duplicate results.
2642-
for (auto T : expectedTypeContext.getPossibleTypes()) {
2643-
if (auto NT = T->getAs<NominalType>()) {
2644-
if (auto NTD = NT->getDecl()) {
2645-
if (!isa<ProtocolDecl>(NTD) && NTD->getModuleContext() != CurrModule) {
2646-
addNominalTypeRef(NT->getDecl(),
2647-
DeclVisibilityKind::VisibleAtTopLevel, {});
2648-
}
2649-
}
2650-
}
2651-
}
2652-
26532637
if (CompletionContext) {
26542638
// FIXME: this is an awful simplification that says all and only enums can
26552639
// use implicit member syntax (leading dot). Computing the accurate answer

test/IDE/complete_value_expr.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2041,3 +2041,11 @@ func testProtocolMetatype(protoProto: MetaProto.Protocol, protoType: MetaProto.T
20412041
// PROTOCOLMETA_3: End completions
20422042
}
20432043

2044+
func testRdar90136020() {
2045+
let a: Int64 = #^RDAR90136020^#
2046+
// RDAR90136020: Begin completions
2047+
// RDAR90136020-NOT: name=Int64{{$}}
2048+
// RDAR90136020: Decl[Struct]/OtherModule[Swift]/IsSystem/TypeRelation[Identical]: Int64[#Int64#]; name=Int64
2049+
// RDAR90136020-NOT: name=Int64{{$}}
2050+
// RDAR90136020: End completions
2051+
}

0 commit comments

Comments
 (0)