[Sema]Set IsSending flag to subscript.getter if needed

This commit is contained in:
stzn
2025-01-30 19:48:27 +09:00
parent 8ec8a1229a
commit 65ac75fae5
2 changed files with 14 additions and 0 deletions

View File

@@ -10607,6 +10607,9 @@ AccessorDecl *AccessorDecl::createParsed(
// The cloned parameter is implicit.
param->setImplicit();
if (subscriptParam->isSending())
param->setSending();
newParams.push_back(param);
}
}

View File

@@ -0,0 +1,11 @@
// RUN: %target-swift-frontend -emit-sil -swift-version 6 %s -o /dev/null -verify
class NonSendableKlass {}
protocol P {
subscript(_: sending NonSendableKlass) -> sending NonSendableKlass { get }
}
struct S: P {
subscript(_: sending NonSendableKlass) -> sending NonSendableKlass { NonSendableKlass() }
}