Skip to content

Commit 79c5706

Browse files
committed
[Type checker] Loosen an assertion to cope with multiple pre-checks
Function builders perform the expression "pre-check" operation multiple times, which means that nested closures might have a more-nested DeclContext than PreCheck expects. Loosen this assertion to cope with that change.
1 parent b4e80cf commit 79c5706

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/Sema/TypeCheckConstraints.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,9 @@ bool PreCheckExpression::walkToClosureExprPre(ClosureExpr *closure) {
13891389

13901390
// Update the current DeclContext to be the closure we're about to
13911391
// recurse into.
1392-
assert(DC == closure->getParent() && "Decl context isn't correct");
1392+
assert((closure->getParent() == DC ||
1393+
closure->getParent()->isChildContextOf(DC)) &&
1394+
"Decl context isn't correct");
13931395
DC = closure;
13941396
return true;
13951397
}

0 commit comments

Comments
 (0)