Skip to content

Commit 7c1dffb

Browse files
authored
Merge pull request #82549 from xedin/rdar-153083848
[CSFix] Fix `getConcurrencyFixBehavior` to account for non-decl overl…
2 parents 0775d25 + 3ae8d56 commit 7c1dffb

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/Sema/CSFix.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ getConcurrencyFixBehavior(ConstraintSystem &cs, ConstraintKind constraintKind,
300300
if (auto *argument = getAsExpr(simplifyLocatorToAnchor(argLoc))) {
301301
if (auto overload = cs.findSelectedOverloadFor(
302302
argument->getSemanticsProvidingExpr())) {
303-
auto *decl = overload->choice.getDecl();
303+
auto *decl = overload->choice.getDeclOrNull();
304304
if (decl && decl->isStatic())
305305
return FixBehavior::DowngradeToWarning;
306306
}

test/Concurrency/sendable_checking.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,3 +526,11 @@ func sendablePacks<each Element: Sendable>(
526526

527527
@available(SwiftStdlib 5.1, *)
528528
func sendPack<each Element>(_: repeat each Element) async {}
529+
530+
// rdar://153083848 - crash in `getConcurrencyFixBehavior` when member comes from a tuple
531+
func test(value: (_: Int, _: () -> Void)) {
532+
func takesSendable(_: @Sendable () -> Void) {}
533+
534+
takesSendable(value.1) // Ok
535+
// expected-warning@-1 {{converting non-Sendable function value to '@Sendable () -> Void' may introduce data races}}
536+
}

0 commit comments

Comments
 (0)