Skip to content

Commit 1610a89

Browse files
committed
Eliminate TypeChecker::resolveInheritedProtocols().
Ensuring that we've computed the list of "inherited" protocols is part of finalizeType(), now.
1 parent a8cc606 commit 1610a89

File tree

2 files changed

+1
-13
lines changed

2 files changed

+1
-13
lines changed

lib/Sema/TypeCheckDecl.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,6 @@ void TypeChecker::validateWhereClauses(ProtocolDecl *protocol,
233233
}
234234
}
235235

236-
void TypeChecker::resolveInheritedProtocols(ProtocolDecl *protocol) {
237-
for (unsigned i : indices(protocol->getInherited()))
238-
(void)protocol->getInheritedType(i);
239-
resolveTrailingWhereClause(protocol);
240-
}
241-
242236
/// check the inheritance clause of a type declaration or extension thereof.
243237
///
244238
/// This routine validates all of the types in the parsed inheritance clause,
@@ -3966,8 +3960,6 @@ void TypeChecker::validateDecl(ValueDecl *D) {
39663960
}
39673961
}
39683962

3969-
// Record inherited protocols.
3970-
resolveInheritedProtocols(proto);
39713963
resolveTrailingWhereClause(proto);
39723964

39733965
validateAttributes(*this, D);
@@ -4513,8 +4505,6 @@ void TypeChecker::validateDeclForNameLookup(ValueDecl *D) {
45134505

45144506
(void) proto->getFormalAccess();
45154507

4516-
// Record inherited protocols.
4517-
resolveInheritedProtocols(proto);
45184508
resolveTrailingWhereClause(proto);
45194509

45204510
for (auto ATD : proto->getAssociatedTypeMembers()) {
@@ -4734,6 +4724,7 @@ static void finalizeType(TypeChecker &TC, NominalTypeDecl *nominal) {
47344724
// validation of protocols, but clients will assume that things
47354725
// like the requirement signature have been set.
47364726
if (auto PD = dyn_cast<ProtocolDecl>(nominal)) {
4727+
(void)PD->getInheritedProtocols();
47374728
if (!PD->isRequirementSignatureComputed()) {
47384729
TC.validateDecl(PD);
47394730
}

lib/Sema/TypeChecker.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,9 +1413,6 @@ class TypeChecker final : public LazyResolver {
14131413
GenericRequirementsCheckListener *listener = nullptr,
14141414
SubstOptions options = None);
14151415

1416-
/// Resolve the inherited protocols of a given protocol.
1417-
void resolveInheritedProtocols(ProtocolDecl *protocol);
1418-
14191416
/// Validate a protocol's where clause, along with the where clauses of
14201417
/// its associated types.
14211418
void validateWhereClauses(ProtocolDecl *protocol,

0 commit comments

Comments
 (0)