Skip to content

Commit 2be7573

Browse files
committed
Sema: Remove synthesizeWitnessAccessorsForStorage()
We can lazily synthesize accessor witnesses from SILGen now.
1 parent 4290154 commit 2be7573

File tree

4 files changed

+0
-35
lines changed

4 files changed

+0
-35
lines changed

lib/Sema/CodeSynthesis.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,22 +1320,6 @@ synthesizeModifyCoroutineSetterBody(AccessorDecl *setter, ASTContext &ctx) {
13201320
setter->getStorage(), ctx);
13211321
}
13221322

1323-
/// The specified AbstractStorageDecl was just found to satisfy a
1324-
/// protocol property requirement. Ensure that it has the full
1325-
/// complement of accessors.
1326-
void TypeChecker::synthesizeWitnessAccessorsForStorage(
1327-
AbstractStorageDecl *requirement,
1328-
AbstractStorageDecl *storage) {
1329-
// Make sure the protocol requirement itself has the right accessors.
1330-
// FIXME: This should be a request kicked off by SILGen.
1331-
DeclsToFinalize.insert(requirement);
1332-
1333-
requirement->visitExpectedOpaqueAccessors([&](AccessorKind kind) {
1334-
// Force synthesis if necessary.
1335-
(void) storage->getSynthesizedAccessor(kind);
1336-
});
1337-
}
1338-
13391323
/// Given a VarDecl with a willSet: and/or didSet: specifier, synthesize the
13401324
/// setter which calls them.
13411325
static std::pair<BraceStmt *, bool>

lib/Sema/TypeCheckProtocol.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2208,12 +2208,6 @@ void ConformanceChecker::recordWitness(ValueDecl *requirement,
22082208
// Record this witness in the conformance.
22092209
auto witness = match.getWitness(TC.Context);
22102210
Conformance->setWitness(requirement, witness);
2211-
2212-
// Synthesize accessors for the protocol witness table to use.
2213-
if (auto storage = dyn_cast<AbstractStorageDecl>(witness.getDecl()))
2214-
TC.synthesizeWitnessAccessorsForStorage(
2215-
cast<AbstractStorageDecl>(requirement),
2216-
storage);
22172211
}
22182212

22192213
void ConformanceChecker::recordOptionalWitness(ValueDecl *requirement) {
@@ -5337,12 +5331,6 @@ void DefaultWitnessChecker::recordWitness(
53375331
const RequirementMatch &match) {
53385332
Proto->setDefaultWitness(requirement,
53395333
match.getWitness(TC.Context));
5340-
5341-
// Synthesize accessors for the protocol witness table to use.
5342-
if (auto storage = dyn_cast<AbstractStorageDecl>(match.Witness))
5343-
TC.synthesizeWitnessAccessorsForStorage(
5344-
cast<AbstractStorageDecl>(requirement),
5345-
storage);
53465334
}
53475335

53485336
void TypeChecker::inferDefaultWitnesses(ProtocolDecl *proto) {

lib/Sema/TypeChecker.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,12 +1172,6 @@ class TypeChecker final : public LazyResolver {
11721172
/// target.
11731173
void synthesizeMemberForLookup(NominalTypeDecl *target, DeclName member);
11741174

1175-
/// The specified AbstractStorageDecl \c storage was just found to satisfy
1176-
/// the protocol property \c requirement. Ensure that it has the full
1177-
/// complement of accessors.
1178-
void synthesizeWitnessAccessorsForStorage(AbstractStorageDecl *requirement,
1179-
AbstractStorageDecl *storage);
1180-
11811175
/// Pre-check the expression, validating any types that occur in the
11821176
/// expression and folding sequence expressions.
11831177
bool preCheckExpression(Expr *&expr, DeclContext *dc);
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
public protocol P {
22
let x: Int
3-
// expected-error@-1 {{immutable property requirement must be declared as 'var' with a '{ get }' specifier}}
43
}

0 commit comments

Comments
 (0)