Skip to content

Commit 9316191

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. (cherry picked from commit 79c5706)
1 parent ccd1106 commit 9316191

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
@@ -1392,7 +1392,9 @@ bool PreCheckExpression::walkToClosureExprPre(ClosureExpr *closure) {
13921392

13931393
// Update the current DeclContext to be the closure we're about to
13941394
// recurse into.
1395-
assert(DC == closure->getParent() && "Decl context isn't correct");
1395+
assert((closure->getParent() == DC ||
1396+
closure->getParent()->isChildContextOf(DC)) &&
1397+
"Decl context isn't correct");
13961398
DC = closure;
13971399
return true;
13981400
}

0 commit comments

Comments
 (0)