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:
@@ -4369,10 +4369,15 @@ bool ConstraintSystem::generateConstraints(StmtCondition condition,
|
||||
continue;
|
||||
|
||||
case StmtConditionElement::CK_HasSymbol: {
|
||||
ASTContext &ctx = getASTContext();
|
||||
ctx.Diags.diagnose(condElement.getStartLoc(),
|
||||
diag::has_symbol_unsupported_in_closures);
|
||||
return true;
|
||||
Expr *symbolExpr = condElement.getHasSymbolInfo()->getSymbolExpr();
|
||||
auto target = SolutionApplicationTarget(symbolExpr, dc, CTP_Unused,
|
||||
Type(), /*isDiscarded=*/false);
|
||||
|
||||
if (generateConstraints(target, FreeTypeVariableBinding::Disallow))
|
||||
return true;
|
||||
|
||||
setSolutionApplicationTarget(&condElement, target);
|
||||
continue;
|
||||
}
|
||||
|
||||
case StmtConditionElement::CK_Boolean: {
|
||||
|
||||
Reference in New Issue
Block a user