mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Sema]Set IsSending flag to subscript.getter if needed
This commit is contained in:
@@ -10607,6 +10607,9 @@ AccessorDecl *AccessorDecl::createParsed(
|
||||
// The cloned parameter is implicit.
|
||||
param->setImplicit();
|
||||
|
||||
if (subscriptParam->isSending())
|
||||
param->setSending();
|
||||
|
||||
newParams.push_back(param);
|
||||
}
|
||||
}
|
||||
|
||||
11
test/Concurrency/sending_witness_subscript.swift
Normal file
11
test/Concurrency/sending_witness_subscript.swift
Normal 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() }
|
||||
}
|
||||
Reference in New Issue
Block a user