Skip to content

Commit 1a409a1

Browse files
authored
Merge pull request swiftlang#75299 from xedin/issue-75244-6.0
[6.0][CSApply] Allow `@dynamicMemberLookup` subscripts to take sendable ke…
2 parents 3db75bd + 17fcb8b commit 1a409a1

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/Sema/CSApply.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5367,8 +5367,8 @@ namespace {
53675367
auto indexType = getTypeOfDynamicMemberIndex(overload);
53685368
Expr *argExpr = nullptr;
53695369
if (overload.choice.isKeyPathDynamicMemberLookup()) {
5370-
argExpr = buildKeyPathDynamicMemberArgExpr(
5371-
indexType->castTo<BoundGenericType>(), componentLoc, memberLoc);
5370+
argExpr = buildKeyPathDynamicMemberArgExpr(indexType, componentLoc,
5371+
memberLoc);
53725372
} else {
53735373
auto fieldName = overload.choice.getName().getBaseIdentifier().str();
53745374
argExpr = buildDynamicMemberLookupArgExpr(fieldName, componentLoc,

test/attr/attr_dynamic_member_lookup.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,3 +833,10 @@ public extension S3_54864 {
833833
get { s2_54864_instance[keyPath: member] } // expected-error {{key path with root type 'S3_54864' cannot be applied to a base of type 'S2_54864'}}
834834
}
835835
}
836+
837+
// https://github.com/swiftlang/swift/issues/75244
838+
struct WithSendable {
839+
subscript(dynamicMember member: KeyPath<String, Int> & Sendable) -> Bool { // Ok
840+
get { false }
841+
}
842+
}

0 commit comments

Comments
 (0)