Skip to content

Commit 4051246

Browse files
authored
Merge pull request #16811 from AnthonyLatsis/code-compl-dup-restated-requirements
[CodeCompletion] Duplicate existential requirements when restated
2 parents 7937406 + f3fed2e commit 4051246

File tree

4 files changed

+263
-26
lines changed

4 files changed

+263
-26
lines changed

lib/AST/LookupVisibleDecls.cpp

Lines changed: 104 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717

1818
#include "NameLookupImpl.h"
1919
#include "swift/AST/ASTContext.h"
20+
#include "swift/AST/GenericSignature.h"
2021
#include "swift/AST/GenericSignatureBuilder.h"
2122
#include "swift/AST/Initializer.h"
2223
#include "swift/AST/LazyResolver.h"
2324
#include "swift/AST/NameLookup.h"
2425
#include "swift/AST/ProtocolConformance.h"
25-
#include "swift/AST/SubstitutionMap.h"
2626
#include "swift/Basic/SourceManager.h"
2727
#include "swift/Basic/STLExtras.h"
2828
#include "swift/Sema/IDETypeChecking.h"
@@ -113,7 +113,7 @@ struct LookupState {
113113
return Result;
114114
}
115115
};
116-
} // unnamed namespace
116+
} // end anonymous namespace
117117

118118
static bool areTypeDeclsVisibleInLookupMode(LookupState LS) {
119119
// Nested type declarations can be accessed only with unqualified lookup or
@@ -473,19 +473,107 @@ lookupVisibleMemberDeclsImpl(Type BaseTy, VisibleDeclConsumer &Consumer,
473473
GenericSignatureBuilder *GSB,
474474
VisitedSet &Visited);
475475

476-
static void lookupVisibleProtocolMemberDecls(
477-
Type BaseTy, ProtocolType *PT, VisibleDeclConsumer &Consumer,
478-
const DeclContext *CurrDC, LookupState LS, DeclVisibilityKind Reason,
479-
LazyResolver *TypeResolver, GenericSignatureBuilder *GSB,
480-
VisitedSet &Visited) {
476+
// Filters out restated declarations from a protocol hierarchy
477+
// or equivalent requirements from protocol composition types.
478+
class RestateFilteringConsumer : public VisibleDeclConsumer {
479+
LazyResolver *resolver;
480+
481+
using FoundDecl = std::pair<ValueDecl*, DeclVisibilityKind>;
482+
using NameAndType = std::pair<DeclName, CanType>;
483+
484+
llvm::DenseMap<DeclName, FoundDecl> foundVars;
485+
llvm::DenseMap<NameAndType, FoundDecl> foundFuncs;
486+
llvm::MapVector<ValueDecl*, DeclVisibilityKind> declsToReport;
487+
488+
template <typename K>
489+
void addDecl(llvm::DenseMap<K, FoundDecl> &Map, K Key, FoundDecl FD) {
490+
// Add the declaration if we haven't found an equivalent yet, otherwise
491+
// replace the equivalent if the found decl has a higher access level.
492+
auto existingDecl = Map.find(Key);
493+
494+
if ((existingDecl == Map.end()) ||
495+
(Map[Key].first->getFormalAccess() < FD.first->getFormalAccess())) {
496+
if (existingDecl != Map.end())
497+
declsToReport.erase({existingDecl->getSecond().first});
498+
Map[Key] = FD;
499+
declsToReport.insert(FD);
500+
}
501+
}
502+
503+
CanType stripSelfRequirementsIfNeeded(ValueDecl *VD,
504+
GenericFunctionType *GFT) const {
505+
// Preserve the generic signature if this is a subscript, which are uncurried,
506+
// or if we have generic params other than Self. Otherwise, use
507+
// the resultType of the curried function type.
508+
// When we keep the generic signature, we remove the requirements
509+
// from Self to make sure they don't prevent us from recognizing restatements.
510+
auto params = GFT->getGenericParams();
511+
if (params.size() == 1 && !isa<SubscriptDecl>(VD)) {
512+
return GFT->getResult()->getCanonicalType();
513+
}
514+
auto Self = VD->getDeclContext()->getSelfInterfaceType();
515+
SmallVector<Requirement, 4> newReqs;
516+
for (auto req: GFT->getRequirements()) {
517+
if (!Self->isEqual(req.getFirstType()))
518+
newReqs.push_back(req);
519+
}
520+
auto newSig = GenericSignature::get(params, newReqs, false);
521+
522+
return GenericFunctionType::get(newSig, GFT->getInput(),
523+
GFT->getResult(), GFT->getExtInfo())
524+
->getCanonicalType();
525+
}
526+
527+
public:
528+
RestateFilteringConsumer(Type baseTy, const DeclContext *DC,
529+
LazyResolver *resolver)
530+
: resolver(resolver) {
531+
assert(DC && baseTy && !baseTy->hasLValueType());
532+
}
533+
534+
void foundDecl(ValueDecl *VD, DeclVisibilityKind Reason) override {
535+
assert(VD);
536+
// If this isn't a protocol context, don't look further into the decl.
537+
if (!isa<ProtocolDecl>(VD->getDeclContext())) {
538+
declsToReport.insert({VD, Reason});
539+
return;
540+
}
541+
if (resolver)
542+
resolver->resolveDeclSignature(VD);
543+
544+
if (!VD->hasInterfaceType()) {
545+
declsToReport.insert({VD, Reason});
546+
return;
547+
}
548+
if (auto GFT = VD->getInterfaceType()->getAs<GenericFunctionType>()) {
549+
auto type = stripSelfRequirementsIfNeeded(VD, GFT);
550+
addDecl(foundFuncs, {VD->getFullName(), type}, {VD, Reason});
551+
return;
552+
}
553+
addDecl(foundVars, VD->getFullName(), {VD, Reason});
554+
}
555+
556+
void feedResultsToConsumer(VisibleDeclConsumer &Consumer) const {
557+
for (const auto entry: declsToReport)
558+
Consumer.foundDecl(entry.first, entry.second);
559+
}
560+
};
561+
562+
static void
563+
lookupVisibleProtocolMemberDecls(Type BaseTy, ProtocolType *PT,
564+
VisibleDeclConsumer &Consumer,
565+
const DeclContext *CurrDC, LookupState LS,
566+
DeclVisibilityKind Reason,
567+
LazyResolver *TypeResolver,
568+
GenericSignatureBuilder *GSB,
569+
VisitedSet &Visited) {
481570
if (!Visited.insert(PT->getDecl()).second)
482571
return;
483572

484573
for (auto Proto : PT->getDecl()->getInheritedProtocols())
485574
lookupVisibleProtocolMemberDecls(BaseTy, Proto->getDeclaredType(), Consumer, CurrDC,
486-
LS, getReasonForSuper(Reason), TypeResolver,
487-
GSB, Visited);
488-
575+
LS, getReasonForSuper(Reason), TypeResolver,
576+
GSB, Visited);
489577
lookupTypeMembers(BaseTy, PT, Consumer, CurrDC, LS, Reason, TypeResolver);
490578
}
491579

@@ -834,7 +922,7 @@ class OverrideFilteringConsumer : public VisibleDeclConsumer {
834922
DeclsToReport.insert(FoundDeclTy(VD, Reason));
835923
}
836924
};
837-
} // unnamed namespace
925+
} // end anonymous namespace
838926

839927
/// \brief Enumerate all members in \c BaseTy (including members of extensions,
840928
/// superclasses and implemented protocols), as seen from the context \c CurrDC.
@@ -846,13 +934,15 @@ static void lookupVisibleMemberDecls(
846934
Type BaseTy, VisibleDeclConsumer &Consumer, const DeclContext *CurrDC,
847935
LookupState LS, DeclVisibilityKind Reason, LazyResolver *TypeResolver,
848936
GenericSignatureBuilder *GSB) {
849-
OverrideFilteringConsumer ConsumerWrapper(BaseTy, CurrDC, TypeResolver);
937+
OverrideFilteringConsumer overrideConsumer(BaseTy, CurrDC, TypeResolver);
938+
RestateFilteringConsumer restateConsumer(BaseTy, CurrDC, TypeResolver);
850939
VisitedSet Visited;
851-
lookupVisibleMemberDeclsImpl(BaseTy, ConsumerWrapper, CurrDC, LS, Reason,
940+
lookupVisibleMemberDeclsImpl(BaseTy, restateConsumer, CurrDC, LS, Reason,
852941
TypeResolver, GSB, Visited);
853942

854943
// Report the declarations we found to the real consumer.
855-
for (const auto &DeclAndReason : ConsumerWrapper.DeclsToReport)
944+
restateConsumer.feedResultsToConsumer(overrideConsumer);
945+
for (const auto &DeclAndReason : overrideConsumer.DeclsToReport)
856946
Consumer.foundDecl(DeclAndReason.D, DeclAndReason.Reason);
857947
}
858948

test/IDE/complete_override_access_control_protocol.swift

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -168,16 +168,15 @@ public class TestPublicDE : ProtocolDPrivate, ProtocolEPublic {
168168
#^TEST_PUBLIC_DE^#
169169
}
170170

171-
// FIXME: Should be 2 items in the three checks below.
172-
// TEST_PRIVATE_DE: Begin completions, 4 items
171+
// TEST_PRIVATE_DE: Begin completions, 2 items
173172
// TEST_PRIVATE_DE-DAG: Decl[InstanceMethod]/Super: func colliding() {|}{{; name=.+$}}
174173
// TEST_PRIVATE_DE-DAG: Decl[InstanceMethod]/Super: func collidingGeneric<T>(x: T) {|}{{; name=.+$}}
175174

176-
// TEST_INTERNAL_DE: Begin completions, 4 items
175+
// TEST_INTERNAL_DE: Begin completions, 2 items
177176
// TEST_INTERNAL_DE-DAG: Decl[InstanceMethod]/Super: func colliding() {|}{{; name=.+$}}
178177
// TEST_INTERNAL_DE-DAG: Decl[InstanceMethod]/Super: func collidingGeneric<T>(x: T) {|}{{; name=.+$}}
179178

180-
// TEST_PUBLIC_DE: Begin completions, 4 items
179+
// TEST_PUBLIC_DE: Begin completions, 2 items
181180
// TEST_PUBLIC_DE-DAG: Decl[InstanceMethod]/Super: public func colliding() {|}{{; name=.+$}}
182181
// TEST_PUBLIC_DE-DAG: Decl[InstanceMethod]/Super: public func collidingGeneric<T>(x: T) {|}{{; name=.+$}}
183182

@@ -195,16 +194,15 @@ public class TestPublicED : ProtocolEPublic, ProtocolDPrivate {
195194
#^TEST_PUBLIC_ED^#
196195
}
197196

198-
// FIXME: Should be 2 items in the three checks below.
199-
// TEST_PRIVATE_ED: Begin completions, 4 items
197+
// TEST_PRIVATE_ED: Begin completions, 2 items
200198
// TEST_PRIVATE_ED-DAG: Decl[InstanceMethod]/Super: func colliding() {|}{{; name=.+$}}
201199
// TEST_PRIVATE_ED-DAG: Decl[InstanceMethod]/Super: func collidingGeneric<T>(x: T) {|}{{; name=.+$}}
202200

203-
// TEST_INTERNAL_ED: Begin completions, 4 items
201+
// TEST_INTERNAL_ED: Begin completions, 2 items
204202
// TEST_INTERNAL_ED-DAG: Decl[InstanceMethod]/Super: func collidingGeneric<T>(x: T) {|}{{; name=.+$}}
205203
// TEST_INTERNAL_ED-DAG: Decl[InstanceMethod]/Super: func colliding() {|}{{; name=.+$}}
206204

207-
// TEST_PUBLIC_ED: Begin completions, 4 items
205+
// TEST_PUBLIC_ED: Begin completions, 2 items
208206
// TEST_PUBLIC_ED-DAG: Decl[InstanceMethod]/Super: public func collidingGeneric<T>(x: T) {|}{{; name=.+$}}
209207
// TEST_PUBLIC_ED-DAG: Decl[InstanceMethod]/Super: public func colliding() {|}{{; name=.+$}}
210208

@@ -222,15 +220,14 @@ public class TestPublicEF : ProtocolEPublic, ProtocolFPublic {
222220
#^TEST_PUBLIC_EF^#
223221
}
224222

225-
// FIXME: Should be 2 items in the three checks below.
226-
// TEST_PRIVATE_EF: Begin completions, 4 items
223+
// TEST_PRIVATE_EF: Begin completions, 2 items
227224
// TEST_PRIVATE_EF-DAG: Decl[InstanceMethod]/Super: func colliding() {|}{{; name=.+$}}
228225
// TEST_PRIVATE_EF-DAG: Decl[InstanceMethod]/Super: func collidingGeneric<T>(x: T) {|}{{; name=.+$}}
229226

230-
// TEST_INTERNAL_EF: Begin completions, 4 items
227+
// TEST_INTERNAL_EF: Begin completions, 2 items
231228
// TEST_INTERNAL_EF-DAG: Decl[InstanceMethod]/Super: func colliding() {|}{{; name=.+$}}
232229
// TEST_INTERNAL_EF-DAG: Decl[InstanceMethod]/Super: func collidingGeneric<T>(x: T) {|}{{; name=.+$}}
233230

234-
// TEST_PUBLIC_EF: Begin completions, 4 items
231+
// TEST_PUBLIC_EF: Begin completions, 2 items
235232
// TEST_PUBLIC_EF-DAG: Decl[InstanceMethod]/Super: public func colliding() {|}{{; name=.+$}}
236233
// TEST_PUBLIC_EF-DAG: Decl[InstanceMethod]/Super: public func collidingGeneric<T>(x: T) {|}{{; name=.+$}}

test/IDE/complete_value_expr.swift

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,20 @@
116116
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_GENERICP1 | %FileCheck %s -check-prefix=PROTOCOL_EXT_GENERICP1
117117
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_GENERICP2 | %FileCheck %s -check-prefix=PROTOCOL_EXT_GENERICP2
118118
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_GENERICP3 | %FileCheck %s -check-prefix=PROTOCOL_EXT_GENERICP3
119+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NODUP_RESTATED_REQ1 | %FileCheck %s -check-prefix=CHECK_NODUP_RESTATED_REQ
120+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NODUP_RESTATED_REQ2 | %FileCheck %s -check-prefix=CHECK_NODUP_RESTATED_REQ
121+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NODUP_RESTATED_REQ3 | %FileCheck %s -check-prefix=CHECK_NODUP_RESTATED_REQ
122+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NODUP_RESTATED_REQ4 | %FileCheck %s -check-prefix=CHECK_NODUP_RESTATED_REQ
123+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NODUP_RESTATED_REQ5 | %FileCheck %s -check-prefix=CHECK_NODUP_RESTATED_REQ
124+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NODUP_RESTATED_REQ6 | %FileCheck %s -check-prefix=CHECK_NODUP_RESTATED_REQ
125+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NODUP_RESTATED_REQ_TYPE1 | %FileCheck %s -check-prefix=CHECK_NODUP_RESTATED_REQ_TYPE
126+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NODUP_RESTATED_REQ_TYPE2 | %FileCheck %s -check-prefix=CHECK_NODUP_RESTATED_REQ_TYPE
127+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NODUP_RESTATED_REQ_TYPE3 | %FileCheck %s -check-prefix=CHECK_NODUP_RESTATED_REQ_TYPE
128+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NODUP_RESTATED_REQ_NODOT1 | %FileCheck %s -check-prefix=CHECK_NODUP_RESTATED_REQ_NODOT
129+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NODUP_RESTATED_REQ_NODOT2 | %FileCheck %s -check-prefix=CHECK_NODUP_RESTATED_REQ_NODOT
130+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NODUP_RESTATED_REQ_NODOT3 | %FileCheck %s -check-prefix=CHECK_NODUP_RESTATED_REQ_NODOT
131+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CHECK_PROT_OVERRIDES1 | %FileCheck %s -check-prefix=CHECK_PROT_OVERRIDES
132+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CHECK_PROT_OVERRIDES2 | %FileCheck %s -check-prefix=CHECK_PROT_OVERRIDES
119133
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_P4 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4
120134
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_CONCRETE1 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_P1
121135
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_CONCRETE2 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_P1
@@ -1523,6 +1537,124 @@ func testGenericConforming3<T: P3>(x: T) {
15231537
// PROTOCOL_EXT_GENERICP3-DAG: Decl[InstanceMethod]/Super: extP3()[#Void#]{{; name=.+$}}
15241538
// PROTOCOL_EXT_GENERICP3: End completions
15251539
1540+
protocol NoDupReq1 {
1541+
func foo()
1542+
func roo(arg1: Int)
1543+
subscript(arg: Bool) -> Bool {get}
1544+
var doo: Int {get}
1545+
associatedtype E
1546+
}
1547+
protocol NoDupReq2 {
1548+
func foo()
1549+
subscript(arg: Bool) -> Bool {get}
1550+
var doo: Int {get}
1551+
associatedtype E
1552+
}
1553+
protocol NoDupReq3 {
1554+
func foo()
1555+
func roo(arg2: Int)
1556+
subscript(arg: Bool) -> Bool {get}
1557+
var doo: Int {get}
1558+
associatedtype E
1559+
}
1560+
1561+
protocol NoDupReq4 {
1562+
func foo()
1563+
func roo(arg1: Int)
1564+
subscript(arg: Bool) -> Bool {get}
1565+
var doo: Int {get}
1566+
associatedtype E
1567+
}
1568+
protocol NoDupReq5: NoDupReq4 {
1569+
func foo()
1570+
subscript(arg: Bool) -> Bool {get}
1571+
var doo: Int {get}
1572+
associatedtype E
1573+
}
1574+
protocol NoDupReq6: NoDupReq5 {
1575+
func foo()
1576+
func roo(arg2: Int)
1577+
subscript(arg: Bool) -> Bool {get}
1578+
var doo: Int {get}
1579+
associatedtype E
1580+
}
1581+
1582+
typealias NoDupReq23 = NoDupReq2 & NoDupReq3
1583+
1584+
protocol Override {
1585+
func foo<T: NoDupReq1>(_ arg: T)
1586+
func foo<T: NoDupReq2>(_ arg: T)
1587+
}
1588+
protocol Override2 {
1589+
func foo<T: NoDupReq1>(_ arg: T)
1590+
}
1591+
protocol Override3: Override2 {
1592+
func foo<T: NoDupReq2>(_ arg: T)
1593+
}
1594+
1595+
func checkRestatementNoDup1(_ arg: NoDupReq1 & NoDupReq2 & NoDupReq3) {
1596+
arg.#^NODUP_RESTATED_REQ1^#
1597+
arg#^NODUP_RESTATED_REQ_NODOT1^#
1598+
}
1599+
func checkRestatementNoDup2(_ arg: NoDupReq6) {
1600+
arg.#^NODUP_RESTATED_REQ2^#
1601+
}
1602+
func checkRestatementNoDup3<T: NoDupReq6>(_ arg: T) {
1603+
arg.#^NODUP_RESTATED_REQ3^#
1604+
T.#^NODUP_RESTATED_REQ_TYPE1^#
1605+
arg#^NODUP_RESTATED_REQ_NODOT2^#
1606+
}
1607+
func checkRestatementNoDup4<T: NoDupReq1 & NoDupReq2 & NoDupReq3>(_ arg: T) {
1608+
arg.#^NODUP_RESTATED_REQ4^#
1609+
T.#^NODUP_RESTATED_REQ_TYPE2^#
1610+
}
1611+
func checkRestatementNoDup5<T: NoDupReq1 & NoDupReq23>(_ arg: T) {
1612+
arg.#^NODUP_RESTATED_REQ5^#
1613+
T.#^NODUP_RESTATED_REQ_TYPE3^#
1614+
}
1615+
func checkRestatementNoDup6(_ arg: NoDupReq1 & NoDupReq23) {
1616+
arg.#^NODUP_RESTATED_REQ6^#
1617+
arg#^NODUP_RESTATED_REQ_NODOT3^#
1618+
}
1619+
func checkOverrideInclusion1(_ arg: Override) {
1620+
arg.#^CHECK_PROT_OVERRIDES1^#
1621+
}
1622+
func checkOverrideInclusion2(_ arg: Override3) {
1623+
arg.#^CHECK_PROT_OVERRIDES2^#
1624+
}
1625+
1626+
// CHECK_NODUP_RESTATED_REQ: Begin completions
1627+
// CHECK_NODUP_RESTATED_REQ-DAG: Decl[InstanceMethod]/{{Super|CurrNominal}}: foo()[#Void#]; name=foo()
1628+
// CHECK_NODUP_RESTATED_REQ-DAG: Decl[InstanceMethod]/{{Super|CurrNominal}}: roo({#arg1: Int#})[#Void#]
1629+
// CHECK_NODUP_RESTATED_REQ-DAG: Decl[InstanceVar]/{{Super|CurrNominal}}: doo[#Int#]; name=doo
1630+
// CHECK_NODUP_RESTATED_REQ-DAG: Decl[InstanceMethod]/{{Super|CurrNominal}}: roo({#arg2: Int#})[#Void#]
1631+
// CHECK_NODUP_RESTATED_REQ-NOT: Decl[InstanceMethod]/{{Super|CurrNominal}}: foo()[#Void#]; name=foo()
1632+
// CHECK_NODUP_RESTATED_REQ-NOT: Decl[InstanceVar]/{{Super|CurrNominal}}: doo[#Int#]; name=doo
1633+
// CHECK_NODUP_RESTATED_REQ: End completions
1634+
1635+
// CHECK_NODUP_RESTATED_REQ_NODOT: Begin completions
1636+
// CHECK_NODUP_RESTATED_REQ_NODOT: Decl[InstanceMethod]/{{Super|CurrNominal}}: .foo()[#Void#]; name=foo()
1637+
// CHECK_NODUP_RESTATED_REQ_NODOT: Decl[InstanceMethod]/{{Super|CurrNominal}}: .roo({#arg1: Int#})[#Void#];
1638+
// CHECK_NODUP_RESTATED_REQ_NODOT: Decl[Subscript]/{{Super|CurrNominal}}: [{#Bool#}][#Bool#]; name=[Bool]
1639+
// CHECK_NODUP_RESTATED_REQ_NODOT: Decl[InstanceVar]/{{Super|CurrNominal}}: .doo[#Int#]; name=doo
1640+
// CHECK_NODUP_RESTATED_REQ_NODOT: Decl[InstanceMethod]/{{Super|CurrNominal}}: .roo({#arg2: Int#})[#Void#];
1641+
// CHECK_NODUP_RESTATED_REQ_NODOT-NOT: Decl[InstanceMethod]/{{Super|CurrNominal}}: .foo()[#Void#]; name=foo()
1642+
// CHECK_NODUP_RESTATED_REQ_NODOT-NOT: Decl[Subscript]/{{Super|CurrNominal}}: [{#Bool#}][#Bool#]; name=[Bool]
1643+
// CHECK_NODUP_RESTATED_REQ_NODOT-NOT: Decl[InstanceVar]/{{Super|CurrNominal}}: .doo[#Int#]; name=doo
1644+
// CHECK_NODUP_RESTATED_REQ_NODOT: End completions
1645+
1646+
// CHECK_NODUP_RESTATED_REQ_TYPE: Begin completions
1647+
// CHECK_NODUP_RESTATED_REQ_TYPE-DAG: Decl[InstanceMethod]/Super: foo({#self: [[ARG:.+]]#})[#() -> Void#]; name=foo([[ARG]])
1648+
// CHECK_NODUP_RESTATED_REQ_TYPE-DAG: Decl[InstanceMethod]/Super: roo({#self: [[ARG]]#})[#(arg1: Int) -> Void#]; name=roo([[ARG]])
1649+
// CHECK_NODUP_RESTATED_REQ_TYPE-DAG: Decl[AssociatedType]/Super: E; name=E
1650+
// CHECK_NODUP_RESTATED_REQ_TYPE-DAG: Decl[InstanceMethod]/Super: roo({#self: [[ARG]]#})[#(arg2: Int) -> Void#]; name=roo([[ARG]])
1651+
// CHECK_NODUP_RESTATED_REQ_TYPE-NOT: Decl[InstanceMethod]/Super: foo({#self: [[ARG:.+]]#})[#() -> Void#]; name=foo([[ARG]])
1652+
// CHECK_NODUP_RESTATED_REQ_TYPE-NOT: Decl[AssociatedType]/Super: E; name=E
1653+
// CHECK_NODUP_RESTATED_REQ_TYPE: End completions
1654+
1655+
// CHECK_PROT_OVERRIDES: Decl[InstanceMethod]/{{Super|CurrNominal}}: foo({#(arg): NoDupReq1#})[#Void#]; name=foo(arg: NoDupReq1)
1656+
// CHECK_PROT_OVERRIDES: Decl[InstanceMethod]/{{Super|CurrNominal}}: foo({#(arg): NoDupReq2#})[#Void#]; name=foo(arg: NoDupReq2)
1657+
15261658
struct OnlyMe {}
15271659
protocol P4 {
15281660
associatedtype T

0 commit comments

Comments
 (0)