Skip to content

Commit 82e5d7f

Browse files
authored
Merge pull request #79042 from stzn/fix-subscipt-sending
[Sema]Set IsSending flag to subscript.getter if needed
2 parents 06637ae + 65ac75f commit 82e5d7f

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

lib/AST/Decl.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -10719,6 +10719,9 @@ AccessorDecl *AccessorDecl::createParsed(
1071910719
// The cloned parameter is implicit.
1072010720
param->setImplicit();
1072110721

10722+
if (subscriptParam->isSending())
10723+
param->setSending();
10724+
1072210725
newParams.push_back(param);
1072310726
}
1072410727
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: %target-swift-frontend -emit-sil -swift-version 6 %s -o /dev/null -verify
2+
3+
class NonSendableKlass {}
4+
5+
protocol P {
6+
subscript(_: sending NonSendableKlass) -> sending NonSendableKlass { get }
7+
}
8+
9+
struct S: P {
10+
subscript(_: sending NonSendableKlass) -> sending NonSendableKlass { NonSendableKlass() }
11+
}

0 commit comments

Comments
 (0)