mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Repurpose mangling operator `Y` as an umbrella operator that covers new attributes on function types. Free up operators `J`, `j`, and `k`. ``` async ::= 'Ya' // 'async' annotation on function types sendable ::= 'Yb' // @Sendable on function types throws ::= 'K' // 'throws' annotation on function types differentiable ::= 'Yjf' // @differentiable(_forward) on function type differentiable ::= 'Yjr' // @differentiable(reverse) on function type differentiable ::= 'Yjd' // @differentiable on function type differentiable ::= 'Yjl' // @differentiable(_linear) on function type ``` Resolves rdar://76299796.
16 lines
500 B
Swift
16 lines
500 B
Swift
// RUN: %target-swift-frontend -primary-file %s -emit-ir -enable-experimental-concurrency -g | %FileCheck %s
|
|
// REQUIRES: concurrency
|
|
|
|
// Don't assert on dynamically sized variables.
|
|
// CHECK: define{{( dllexport)?}}{{( protected)?}} swift{{(tail)?}}cc void @"$s5debug1fyxxYaKlF"
|
|
|
|
public func f<Success>(_ value: Success) async throws -> Success {
|
|
switch Result<Success, Error>.success(value) {
|
|
case .success(let success):
|
|
return success
|
|
|
|
case .failure(let error):
|
|
throw error;
|
|
}
|
|
}
|