@@ -104,12 +104,7 @@ namespace {
104104
105105 if (auto CE = dyn_cast<ClosureExpr>(E)) {
106106 CE->setParent (ParentDC);
107-
108- // If the closure was type checked within its enclosing context,
109- // we need to walk into it. Otherwise, it'll have been separately
110- // type-checked.
111- if (!CE->isSeparatelyTypeChecked ())
112- CE->getBody ()->walk (ContextualizeClosuresAndMacros (CE));
107+ CE->getBody ()->walk (ContextualizeClosuresAndMacros (CE));
113108
114109 TypeChecker::computeCaptures (CE);
115110 return Action::SkipNode (E);
@@ -283,18 +278,14 @@ namespace {
283278 if (CE->getRawDiscriminator () == ClosureExpr::InvalidDiscriminator)
284279 CE->setDiscriminator (NextClosureDiscriminator++);
285280
286- // If the closure was type checked within its enclosing context,
287- // we need to walk into it with a new sequence.
288- // Otherwise, it'll have been separately type-checked.
289- if (!CE->isSeparatelyTypeChecked ()) {
290- SetLocalDiscriminators innerVisitor;
291- if (auto params = CE->getParameters ()) {
292- for (auto *param : *params) {
293- innerVisitor.setLocalDiscriminator (param);
294- }
281+ // We need to walk into closure bodies with a new sequence.
282+ SetLocalDiscriminators innerVisitor;
283+ if (auto params = CE->getParameters ()) {
284+ for (auto *param : *params) {
285+ innerVisitor.setLocalDiscriminator (param);
295286 }
296- CE->getBody ()->walk (innerVisitor);
297287 }
288+ CE->getBody ()->walk (innerVisitor);
298289
299290 return Action::SkipNode (E);
300291 }
@@ -2978,25 +2969,6 @@ TypeCheckFunctionBodyRequest::evaluate(Evaluator &eval,
29782969 return hadError ? errorBody () : body;
29792970}
29802971
2981- bool TypeChecker::typeCheckClosureBody (ClosureExpr *closure) {
2982- TypeChecker::checkClosureAttributes (closure);
2983- TypeChecker::checkParameterList (closure->getParameters (), closure);
2984-
2985- BraceStmt *body = closure->getBody ();
2986-
2987- std::optional<FunctionBodyTimer> timer;
2988- const auto &tyOpts = closure->getASTContext ().TypeCheckerOpts ;
2989- if (tyOpts.DebugTimeFunctionBodies || tyOpts.WarnLongFunctionBodies )
2990- timer.emplace (closure);
2991-
2992- bool HadError = StmtChecker (closure).typeCheckBody (body);
2993- if (body) {
2994- closure->setBody (body);
2995- }
2996- closure->setBodyState (ClosureExpr::BodyState::SeparatelyTypeChecked);
2997- return HadError;
2998- }
2999-
30002972bool TypeChecker::typeCheckTapBody (TapExpr *expr, DeclContext *DC) {
30012973 // We intentionally use typeCheckStmt instead of typeCheckBody here
30022974 // because we want to contextualize TapExprs with the body they're in.
0 commit comments