Skip to content

Commit 0025e8f

Browse files
committed
[CS] Sink closure attribute/param checking into applySolution
The cases where CSApply fails should be fairly limited these days, and there doesn't seem to be any reason we shouldn't run these on failure anyway.
1 parent 096c3ec commit 0025e8f

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

lib/Sema/CSApply.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8908,14 +8908,8 @@ namespace {
89088908
/// \returns true if an error occurred.
89098909
bool rewriteFunction(AnyFunctionRef fn) {
89108910
switch (Rewriter.cs.applySolution(fn, *this)) {
8911-
case SolutionApplicationToFunctionResult::Success: {
8912-
if (auto closure =
8913-
dyn_cast_or_null<ClosureExpr>(fn.getAbstractClosureExpr())) {
8914-
TypeChecker::checkClosureAttributes(closure);
8915-
TypeChecker::checkParameterList(closure->getParameters(), closure);
8916-
}
8911+
case SolutionApplicationToFunctionResult::Success:
89178912
return false;
8918-
}
89198913

89208914
case SolutionApplicationToFunctionResult::Failure:
89218915
return true;

lib/Sema/CSSyntacticElement.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2573,6 +2573,9 @@ ConstraintSystem::applySolution(AnyFunctionRef fn,
25732573
}
25742574

25752575
applySolutionToClosurePropertyWrappers(closure, solution);
2576+
2577+
TypeChecker::checkClosureAttributes(closure);
2578+
TypeChecker::checkParameterList(closure->getParameters(), closure);
25762579
}
25772580

25782581
// Enter the context of the function before performing any additional

0 commit comments

Comments
 (0)