Skip to content

Commit 2c7c743

Browse files
committed
[QoI] Ignore incorrect parameter types when trying to diagnose trailing closures
Resolves: rdar://problem/28004686
1 parent a5960d8 commit 2c7c743

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/Sema/CSDiag.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6116,7 +6116,7 @@ bool FailureDiagnosis::diagnoseTrailingClosureErrors(ApplyExpr *callExpr) {
61166116
case TypeKind::Tuple: {
61176117
auto tuple = paramType->getAs<TupleType>();
61186118
if (tuple->getNumElements() != 1)
6119-
return false;
6119+
continue;
61206120

61216121
paramType = tuple->getElement(0).getType();
61226122
break;

test/Constraints/trailing_closures_objc.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,8 @@ func foo(options: [AVMediaSelectionOption]) {
1313
// expected-error@-1 {{type 'NSViewController' has no member 'respondToMediaOptionSelection(from:)'}}
1414
}
1515
}
16+
17+
func rdar28004686(a: [IndexPath]) {
18+
_ = a.sorted { (lhs: NSIndexPath, rhs: NSIndexPath) -> Bool in true }
19+
// expected-error@-1 {{'NSIndexPath' is not convertible to 'IndexPath'}}
20+
}

0 commit comments

Comments
 (0)