Files
swift-mirror/test/Serialization/sending.swift
Michael Gottesman 88729b9e34 [sending] Make {Transferring,Sending}ArgsAndResults a LANGUAGE_FEATURE instead of an UPCOMING_FEATURE.
TLDR: This makes it so that we always can parse sending/transferring but changes
the semantic language effects to be keyed on RegionBasedIsolation instead.

----

The key thing that makes this all work is that I changed all of the "special"
semantic changes originally triggered on *ArgsAndResults to now be triggered
based on RegionBasedIsolation being enabled. This makes a lot of sense since we
want these semantic changes specifically to be combined with the checkers that
RegionBasedIsolation turns on. As a result, even though this causes these two
features to always be enabled, we just parse it but we do not use it for
anything semantically.

rdar://128961672
2024-06-01 23:25:16 -07:00

65 lines
2.6 KiB
Swift

// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -strict-concurrency=complete -enable-upcoming-feature RegionBasedIsolation -module-name transferring_test -emit-module -o %t/transferring_test.swiftmodule %S/Inputs/sending.swift
// RUN: %target-swift-frontend -strict-concurrency=complete -enable-upcoming-feature RegionBasedIsolation -module-name transferring -emit-sil -I %t %s | %FileCheck %s
// RUN: %target-sil-opt -strict-concurrency=complete -module-name transferring_test -enable-upcoming-feature RegionBasedIsolation %t/transferring_test.swiftmodule | %FileCheck -check-prefix=AST %s
// REQUIRES: concurrency
// REQUIRES: asserts
// READ THIS!
//
// This test is meant to test serialization of transferring declarations in the
// AST.
import transferring_test
func main() {
let x = "123"
let y = testTransferring(x)
let _ = testSending(y)
do {
let f: (transferring String) -> () = {
(z: transferring String) in
print(z)
}
testTransferringFunc(f)
}
do {
let f: (sending String) -> () = {
(z: sending String) in
print(z)
}
testSendingFunc(f)
}
do {
let f: () -> transferring String = {
""
}
testTransferringResultFunc(f)
}
do {
let f: () -> sending String = {
""
}
testSendingResultFunc(f)
}
}
// CHECK: sil @$s17transferring_test0B12TransferringyS2SnF : $@convention(thin) (@sil_sending @owned String) -> @sil_sending @owned String
// CHECK: sil @$s17transferring_test0B7SendingyS2SnF : $@convention(thin) (@sil_sending @owned String) -> @sil_sending @owned String
// CHECK: sil @$s17transferring_test0B16TransferringFuncyyySSnYuXEF : $@convention(thin) (@guaranteed @noescape @callee_guaranteed (@sil_sending @owned String) -> ()) -> ()
// CHECK: sil @$s17transferring_test0B11SendingFuncyyySSnYuXEF : $@convention(thin) (@guaranteed @noescape @callee_guaranteed (@sil_sending @owned String) -> ()) -> ()
// CHECK: sil @$s17transferring_test0B22TransferringResultFuncyySSyYTXEF : $@convention(thin) (@guaranteed @noescape @callee_guaranteed () -> @sil_sending @owned String) -> ()
// CHECK: sil @$s17transferring_test0B17SendingResultFuncyySSyYTXEF : $@convention(thin) (@guaranteed @noescape @callee_guaranteed () -> @sil_sending @owned String) -> ()
// AST-LABEL: func testTransferring(_ x: sending String) -> sending String
// AST-LABEL: func testSending(_ x: sending String) -> sending String
// AST-LABEL: func testTransferringFunc(_ x: (sending String) -> ())
// AST-LABEL: func testSendingFunc(_ x: (sending String) -> ())
// AST-LABEL: func testTransferringResultFunc(_ x: () -> sending String)
// AST-LABEL: func testSendingResultFunc(_ x: () -> sending String)