mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Sema: Accept if #_hasSymbol() conditions in closure contexts.
Resolves rdar://100129165
This commit is contained in:
@@ -8923,9 +8923,23 @@ ExprWalker::rewriteTarget(SolutionApplicationTarget target) {
|
||||
for (auto &condElement : *stmtCondition) {
|
||||
switch (condElement.getKind()) {
|
||||
case StmtConditionElement::CK_Availability:
|
||||
case StmtConditionElement::CK_HasSymbol:
|
||||
continue;
|
||||
|
||||
case StmtConditionElement::CK_HasSymbol: {
|
||||
ConstraintSystem &cs = solution.getConstraintSystem();
|
||||
auto target = *cs.getSolutionApplicationTarget(&condElement);
|
||||
auto resolvedTarget = rewriteTarget(target);
|
||||
if (!resolvedTarget)
|
||||
return None;
|
||||
|
||||
auto info = condElement.getHasSymbolInfo();
|
||||
auto rewrittenExpr = resolvedTarget->getAsExpr();
|
||||
info->setSymbolExpr(rewrittenExpr);
|
||||
info->setReferencedDecl(
|
||||
TypeChecker::getReferencedDeclForHasSymbolCondition(rewrittenExpr));
|
||||
continue;
|
||||
}
|
||||
|
||||
case StmtConditionElement::CK_Boolean: {
|
||||
auto condExpr = condElement.getBoolean();
|
||||
auto finalCondExpr = condExpr->walk(*this);
|
||||
|
||||
Reference in New Issue
Block a user