Skip to content

Commit 4719661

Browse files
authored
Merge pull request #77595 from slavapestov/fix-rdar139747886
Sema: Fix request cycle due to unnecessary Sendable check with static method
2 parents f4aab90 + 59ba1a0 commit 4719661

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10149,6 +10149,9 @@ performMemberLookup(ConstraintKind constraintKind, DeclNameRef memberName,
1014910149
if (!isa_and_nonnull<FuncDecl>(decl))
1015010150
return false;
1015110151

10152+
if (!decl->isInstanceMember())
10153+
return false;
10154+
1015210155
auto hasAppliedSelf = decl->hasCurriedSelf() &&
1015310156
doesMemberRefApplyCurriedSelf(baseObjTy, decl);
1015410157
return getNumApplications(decl, hasAppliedSelf, functionRefKind) <

test/Concurrency/sendable_methods.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,3 +319,16 @@ do {
319319

320320
bar(Test.staticFn) // Ok
321321
}
322+
323+
// Reference to static method
324+
do {
325+
struct Outer {
326+
struct Inner: Sendable {
327+
var f: @Sendable () -> Void
328+
}
329+
330+
var g = Inner(f: Outer.ff)
331+
332+
static func ff() {}
333+
}
334+
}

0 commit comments

Comments
 (0)