mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
35 lines
1.1 KiB
Swift
35 lines
1.1 KiB
Swift
// RUN: %target-swift-frontend -target %target-swift-5.1-abi-triple %s -emit-sil -o /dev/null -verify
|
|
// RUN: %target-swift-frontend -target %target-swift-5.1-abi-triple %s -emit-sil -o /dev/null -verify -strict-concurrency=targeted
|
|
// RUN: %target-swift-frontend -target %target-swift-5.1-abi-triple %s -emit-sil -o /dev/null -verify -strict-concurrency=complete
|
|
|
|
// REQUIRES: concurrency
|
|
|
|
// https://github.com/apple/swift/issues/60276
|
|
|
|
@discardableResult @MainActor
|
|
func mainActorAsyncDiscardable() async -> Int { 0 }
|
|
|
|
func consumesMainActorAsyncDiscardable() async {
|
|
await mainActorAsyncDiscardable() // ok
|
|
}
|
|
|
|
// https://github.com/swiftlang/swift/issues/83463
|
|
|
|
@MainActor
|
|
@discardableResult
|
|
func returnsDiscardableFunc() -> () -> Void { return {} }
|
|
|
|
@MainActor
|
|
func testDiscardsSyncFuncWithImplicitSendableConversion() {
|
|
returnsDiscardableFunc()
|
|
}
|
|
|
|
@MainActor
|
|
@discardableResult
|
|
func mainActorAsyncReturnsDiscardableFunc() async -> () -> Void { return {} }
|
|
|
|
@MainActor
|
|
func discardsAsyncFuncWithImplicitSendableConversion() async {
|
|
await mainActorAsyncReturnsDiscardableFunc()
|
|
}
|