Skip to content

Commit 1af4c6d

Browse files
committed
Adjust for 5.3 branch
1 parent d3ab488 commit 1af4c6d

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

lib/Sema/CSApply.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5703,7 +5703,7 @@ Expr *ExprRewriter::coerceCallArguments(
57035703
SmallVector<LocatorPathElt, 4> path;
57045704
auto anchor = locator.getLocatorParts(path);
57055705
if (!path.empty() && path.back().is<LocatorPathElt::ApplyArgument>() &&
5706-
(anchor.isExpr(ExprKind::Call) || anchor.isExpr(ExprKind::Subscript))) {
5706+
(isa<CallExpr>(anchor) || isa<SubscriptExpr>(anchor))) {
57075707
auto locatorPtr = cs.getConstraintLocator(locator);
57085708
assert(solution.trailingClosureMatchingChoices.count(locatorPtr) == 1);
57095709
trailingClosureMatching = solution.trailingClosureMatchingChoices.find(

lib/Sema/CSGen.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1409,7 +1409,8 @@ namespace {
14091409
auto funcType = constr->getMethodInterfaceType()->castTo<FunctionType>();
14101410
::matchCallArguments(
14111411
CS, funcType, args, params, ConstraintKind::ArgumentConversion,
1412-
CS.getConstraintLocator(expr, ConstraintLocator::ApplyArgument));
1412+
CS.getConstraintLocator(expr, ConstraintLocator::ApplyArgument),
1413+
TrailingClosureMatching::Forward);
14131414

14141415
Type result = tv;
14151416
if (constr->isFailable())

test/Constraints/diagnostics.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,8 +1259,11 @@ func rdar17170728() {
12591259
}
12601260

12611261
let _ = [i, j, k].reduce(0 as Int?) {
1262+
// expected-error@-1 {{missing argument label 'into:' in call}}
1263+
// expected-error@-2 {{cannot convert value of type 'Int?' to expected argument type '(inout @escaping (Bool, Bool) -> Bool, Int?) throws -> ()'}}
12621264
$0 && $1 ? $0 + $1 : ($0 ? $0 : ($1 ? $1 : nil))
12631265
// expected-error@-1 {{binary operator '+' cannot be applied to two 'Bool' operands}}
1266+
// expected-error@-2 {{'nil' cannot be used in context expecting type 'Bool'}}
12641267
}
12651268
}
12661269

0 commit comments

Comments
 (0)