Skip to content

Commit 0f0d14f

Browse files
committed
Sema: Add hack until we can request-ify computeCaptures()
typeCheckDecl() is not going to get called on a synthesized accessor if its in local context. Previously, accessors in local context were only created by the parser, but that code path is going away. Until capture computation is request-ified, force it to happen for accessors of local properties.
1 parent b18d168 commit 0f0d14f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/Sema/TypeCheckDecl.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2335,6 +2335,16 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
23352335

23362336
triggerAccessorSynthesis(TC, VD);
23372337

2338+
// FIXME: Temporary hack until capture computation has been request-ified.
2339+
if (VD->getDeclContext()->isLocalContext()) {
2340+
VD->visitExpectedOpaqueAccessors([&](AccessorKind kind) {
2341+
auto accessor = VD->getAccessor(kind);
2342+
if (!accessor) return;
2343+
2344+
TC.definedFunctions.push_back(accessor);
2345+
});
2346+
}
2347+
23382348
// Under the Swift 3 inference rules, if we have @IBInspectable or
23392349
// @GKInspectable but did not infer @objc, warn that the attribute is
23402350
if (!VD->isObjC() && TC.Context.LangOpts.EnableSwift3ObjCInference) {

0 commit comments

Comments
 (0)