Skip to content

Commit 785bda0

Browse files
committed
Discard ResolveEncodable and ResolveDecodable
1 parent fbdd907 commit 785bda0

File tree

4 files changed

+4
-48
lines changed

4 files changed

+4
-48
lines changed

include/swift/AST/TypeCheckRequests.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1679,8 +1679,6 @@ class InheritsSuperclassInitializersRequest
16791679
enum class ImplicitMemberAction : uint8_t {
16801680
ResolveImplicitInit,
16811681
ResolveCodingKeys,
1682-
ResolveEncodable,
1683-
ResolveDecodable,
16841682
};
16851683

16861684
class ResolveImplicitMemberRequest

lib/AST/Decl.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3995,19 +3995,6 @@ void NominalTypeDecl::synthesizeSemanticMembersIfNeeded(DeclName member) {
39953995
if (baseName.getIdentifier() == getASTContext().Id_CodingKeys) {
39963996
action.emplace(ImplicitMemberAction::ResolveCodingKeys);
39973997
}
3998-
} else {
3999-
auto argumentNames = member.getArgumentNames();
4000-
if (!member.isCompoundName() || argumentNames.size() == 1) {
4001-
if (baseName == DeclBaseName::createConstructor() &&
4002-
(member.isSimpleName() || argumentNames.front() == Context.Id_from)) {
4003-
action.emplace(ImplicitMemberAction::ResolveDecodable);
4004-
} else if (!baseName.isSpecial() &&
4005-
baseName.getIdentifier() == Context.Id_encode &&
4006-
(member.isSimpleName() ||
4007-
argumentNames.front() == Context.Id_to)) {
4008-
action.emplace(ImplicitMemberAction::ResolveEncodable);
4009-
}
4010-
}
40113998
}
40123999

40134000
if (auto actionToTake = action) {

lib/AST/TypeCheckRequests.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,12 +1074,6 @@ void swift::simple_display(llvm::raw_ostream &out,
10741074
case ImplicitMemberAction::ResolveCodingKeys:
10751075
out << "resolve CodingKeys";
10761076
break;
1077-
case ImplicitMemberAction::ResolveEncodable:
1078-
out << "resolve Encodable.encode(to:)";
1079-
break;
1080-
case ImplicitMemberAction::ResolveDecodable:
1081-
out << "resolve Decodable.init(from:)";
1082-
break;
10831077
}
10841078
}
10851079

lib/Sema/CodeSynthesis.cpp

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,11 +1070,8 @@ ResolveImplicitMemberRequest::evaluate(Evaluator &evaluator,
10701070
// FIXME: This entire request is a layering violation made of smaller,
10711071
// finickier layering violations. See rdar://56844567
10721072

1073-
// Checks whether the target conforms to the given protocol. If the
1074-
// conformance is incomplete, force the conformance.
1075-
//
1076-
// Returns whether the target conforms to the protocol.
1077-
auto evaluateTargetConformanceTo = [&](ProtocolDecl *protocol) {
1073+
auto &Context = target->getASTContext();
1074+
auto tryToInstallCodingKeys = [&](ProtocolDecl *protocol) {
10781075
if (!protocol)
10791076
return false;
10801077

@@ -1097,7 +1094,6 @@ ResolveImplicitMemberRequest::evaluate(Evaluator &evaluator,
10971094
return true;
10981095
};
10991096

1100-
auto &Context = target->getASTContext();
11011097
switch (action) {
11021098
case ImplicitMemberAction::ResolveImplicitInit:
11031099
TypeChecker::addImplicitConstructors(target);
@@ -1115,30 +1111,11 @@ ResolveImplicitMemberRequest::evaluate(Evaluator &evaluator,
11151111
// synthesized, it will be synthesized.
11161112
auto *decodableProto = Context.getProtocol(KnownProtocolKind::Decodable);
11171113
auto *encodableProto = Context.getProtocol(KnownProtocolKind::Encodable);
1118-
if (!evaluateTargetConformanceTo(decodableProto)) {
1119-
(void)evaluateTargetConformanceTo(encodableProto);
1114+
if (!tryToInstallCodingKeys(decodableProto)) {
1115+
(void)tryToInstallCodingKeys(encodableProto);
11201116
}
11211117
}
11221118
break;
1123-
case ImplicitMemberAction::ResolveEncodable: {
1124-
// encode(to:) may be synthesized as part of derived conformance to the
1125-
// Encodable protocol.
1126-
// If the target should conform to the Encodable protocol, check the
1127-
// conformance here to attempt synthesis.
1128-
auto *encodableProto = Context.getProtocol(KnownProtocolKind::Encodable);
1129-
(void)evaluateTargetConformanceTo(encodableProto);
1130-
}
1131-
break;
1132-
case ImplicitMemberAction::ResolveDecodable: {
1133-
// init(from:) may be synthesized as part of derived conformance to the
1134-
// Decodable protocol.
1135-
// If the target should conform to the Decodable protocol, check the
1136-
// conformance here to attempt synthesis.
1137-
TypeChecker::addImplicitConstructors(target);
1138-
auto *decodableProto = Context.getProtocol(KnownProtocolKind::Decodable);
1139-
(void)evaluateTargetConformanceTo(decodableProto);
1140-
}
1141-
break;
11421119
}
11431120
return true;
11441121
}

0 commit comments

Comments
 (0)