@@ -2624,9 +2624,23 @@ namespace {
26242624 return MacroWalking::Expansion;
26252625 }
26262626
2627+ PreWalkResult<Pattern *> walkToPatternPre (Pattern *pattern) override {
2628+ // Walking into patterns leads to nothing good because then we
2629+ // end up visiting the AccessorDecls of a top-level
2630+ // PatternBindingDecl twice.
2631+ return Action::SkipNode (pattern);
2632+ }
2633+
26272634 PreWalkAction walkToDeclPre (Decl *decl) override {
2635+ // Don't walk into local types because nothing in them can
2636+ // change the outcome of our analysis, and we don't want to
2637+ // assume things there have been type checked yet.
2638+ if (isa<TypeDecl>(decl)) {
2639+ return Action::SkipChildren ();
2640+ }
2641+
26282642 if (auto func = dyn_cast<AbstractFunctionDecl>(decl)) {
2629- if (func->isLocalContext ()) {
2643+ if (func->getDeclContext ()-> isLocalContext ()) {
26302644 checkLocalCaptures (func);
26312645 }
26322646
@@ -4249,7 +4263,9 @@ void swift::checkFunctionActorIsolation(AbstractFunctionDecl *decl) {
42494263 ActorIsolationChecker checker (decl);
42504264 if (auto body = decl->getBody ()) {
42514265 body->walk (checker);
4252- if (ctx.LangOpts .hasFeature (Feature::GroupActorErrors)){ checker.diagnoseIsolationErrors (); }
4266+ if (ctx.LangOpts .hasFeature (Feature::GroupActorErrors)) {
4267+ checker.diagnoseIsolationErrors ();
4268+ }
42534269 }
42544270 if (auto ctor = dyn_cast<ConstructorDecl>(decl)) {
42554271 if (auto superInit = ctor->getSuperInitCall ())
@@ -5375,11 +5391,9 @@ DefaultInitializerIsolation::evaluate(Evaluator &evaluator,
53755391 return ActorIsolation::forUnspecified ();
53765392
53775393 auto i = pbd->getPatternEntryIndexForVarDecl (var);
5378- if (!pbd->isInitializerChecked (i))
5379- TypeChecker::typeCheckPatternBinding (pbd, i);
53805394
53815395 dc = cast<Initializer>(pbd->getInitContext (i));
5382- initExpr = pbd->getInit (i);
5396+ initExpr = pbd->getCheckedAndContextualizedInit (i);
53835397 enclosingIsolation = getActorIsolation (var);
53845398 } else if (auto *param = dyn_cast<ParamDecl>(var)) {
53855399 // If this parameter corresponds to a stored property for a
0 commit comments