Skip to content

Commit 623128a

Browse files
authored
Merge pull request #38625 from hamishknight/trail-and-tuple
Don't apply "Convert to Trailing Closure" to call with multiple trailing closures
2 parents 2d02047 + 40e20a2 commit 623128a

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lib/IDE/Refactoring.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3709,7 +3709,7 @@ static CallExpr *findTrailingClosureTarget(
37093709
return nullptr;
37103710
CallExpr *CE = cast<CallExpr>(contexts.back().get<Expr*>());
37113711

3712-
if (CE->hasTrailingClosure())
3712+
if (CE->getUnlabeledTrailingClosureIndex().hasValue())
37133713
// Call expression already has a trailing closure.
37143714
return nullptr;
37153715

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
func lottaClosures(x: () -> Void, y: () -> Void, z: () -> Void) {
2+
lottaClosures(x: {}) {} z: {}
3+
}
4+
// RUN: not %refactor -trailingclosure -source-filename %s -pos=2:3
5+
6+
func singleClosure(x: () -> Void) {
7+
singleClosure {}
8+
}
9+
// RUN: not %refactor -trailingclosure -source-filename %s -pos=7:3

0 commit comments

Comments
 (0)